• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup UI_Utils
18  * @{
19  *
20  * @brief Defines basic UI utils.
21  *
22  * @since 1.0
23  * @version 1.0
24  */
25 
26 /**
27  * @file color.h
28  *
29  * @brief Defines color attributes for the graphics system and implements common color functions.
30  *
31  * @since 1.0
32  * @version 1.0
33  */
34 
35 #ifndef GRAPHIC_LITE_COLOR_H
36 #define GRAPHIC_LITE_COLOR_H
37 
38 #include "gfx_utils/diagram/common/common_basics.h"
39 #include "gfx_utils/heap_base.h"
40 #include "graphic_config.h"
41 #include "graphic_math.h"
42 #if defined(ENABLE_ARM_MATH) && ENABLE_ARM_MATH
43 #include "arm_math.h"
44 #endif
45 namespace OHOS {
46 const float PURPLE_MIN = 380.0f;
47 const float PURPLE_MIDDLE = 420.0f;
48 const float PURPLE_MAX = 440.0f;
49 const float BLUE_MAX = 490.0f;
50 const float CYAN_MAX = 510.0f;
51 const float GREEN_MAX = 580.0f;
52 const float ORANGE_MAX = 645.0f;
53 const float RED_MIN = 700.0f;
54 const float RED_MAX = 780.0f;
55 const float FIXED_VALUE = 0.3f;
56 const float COLOR_CONVERT = 255.0f;
57 
58 using OpacityType = uint8_t;
59 /**
60  * @brief Enumerates opacity values.
61  */
62 enum {
63     /** The opacity is 0. */
64     OPA_TRANSPARENT = 0,
65     /** The opacity is 100%. */
66     OPA_OPAQUE = 255,
67 };
68 
69 /**
70  * @brief Defines the color attribute when the color depth is <b>16</b>.
71  */
72 typedef union {
73     struct {
74         /** Blue */
75         uint16_t blue : 5;
76         /** Green */
77         uint16_t green : 6;
78         /** Red */
79         uint16_t red : 5;
80     };
81     /** Full RGB data */
82     uint16_t full;
83 } Color16;
84 
85 /**
86  * @brief Defines the color attribute when the color depth is <b>24</b>.
87  */
88 struct Color24 {
89     /** Blue */
90     uint8_t blue;
91     /** Green */
92     uint8_t green;
93     /** Red */
94     uint8_t red;
95 };
96 
97 /**
98  * @brief Defines the color attribute when the color depth is <b>32</b>.
99  */
100 typedef union {
101     struct {
102         /** Blue */
103         uint8_t blue;
104         /** Green */
105         uint8_t green;
106         /** Red */
107         uint8_t red;
108         /** Alpha (how opaque each pixel is) */
109         uint8_t alpha;
110     };
111     /** Full RGB data */
112     uint32_t full;
113 } Color32;
114 
115 #if defined(COLOR_DEPTH) && COLOR_DEPTH == 16
116 using ColorType = Color16;
117 #elif defined(COLOR_DEPTH) && COLOR_DEPTH == 32
118 using ColorType = Color32;
119 #else
120 #    error "Invalid COLOR_DEPTH, Set it to 16 or 32!"
121 #endif
122 
123 struct OrderBgra {
124     enum Bgra {
125         BLUE = 0,
126         GREEN = 1,
127         RED = 2,
128         ALPHA = 3
129     };
130 };
131 
132 /**
133  * @brief Rgba.
134  *
135  * Color order: red, green, blue, transparency.
136  * Note that the colors in this support floating-point processing.
137  * @see Rgba
138  * @since 1.0
139  * @version 1.0
140  */
141 struct Rgba {
142     float red;
143     float green;
144     float blue;
145     float alpha;
146 
RgbaRgba147     Rgba() : red(0), green(0), blue(0), alpha(0) {}
148 
149     /**
150      * @brief Rgba Constructor.
151      *
152      * @param Red value, green value, blue value, alpha transparency.
153      * @since 1.0
154      * @version 1.0
155      */
156     Rgba(float red, float green, float blue, float alpha = 1.0f)
redRgba157         : red(red), green(green), blue(blue), alpha(alpha) {}
158 
159     /**
160      * @brief Rgba Constructor.
161      *
162      * @param Color is the RGBA object, alpha, and transparency.
163      * @since 1.0
164      * @version 1.0.
165      */
RgbaRgba166     Rgba(const Rgba& color, float alpha)
167         : red(color.red),
168           green(color.green),
169           blue(color.blue),
170           alpha(alpha) {}
171 
172     /**
173      * @brief Clear, color transparency set to 0.
174      *
175      * @return Returns a reference to the RGBA object.
176      * @since 1.0
177      * @version 1.0
178      */
ClearRgba179     Rgba& Clear()
180     {
181         red = 0;
182         green = 0;
183         blue = 0;
184         alpha = 0;
185         return *this;
186     }
187 
188     /**
189      * @brief Fully transparent.
190      *
191      * @return Returns a reference to the RGBA object.
192      * @since 1.0
193      * @version 1.0
194      */
TransparentRgba195     Rgba& Transparent()
196     {
197         alpha = 0;
198         return *this;
199     }
200 
201     /**
202      * @brief Set transparency.
203      *
204      * @param Alpha transparency.
205      * @return Returns a reference to the RGBA object.
206      * @since 1.0
207      * @version 1.0
208      */
OpacityRgba209     Rgba& Opacity(float alphaValue)
210     {
211         if (alphaValue < 0) {
212             alpha = 0;
213         } else if (alphaValue > 1) {
214             alpha = 1;
215         } else {
216             alpha = alphaValue;
217         }
218         return *this;
219     }
220 
221     /**
222      * @brief Get transparency.
223      *
224      * @return Return transparency.
225      * @since 1.0
226      * @version 1.0
227      */
OpacityRgba228     float Opacity() const
229     {
230         return alpha;
231     }
232 
233     /**
234      * @brief Double subtraction.
235      *
236      * @return Returns a reference to the RGBA object.
237      * @since 1.0
238      * @version 1.0
239      */
DemultiplyRgba240     Rgba& Demultiply()
241     {
242         if (alpha == 0) {
243             red = 0;
244             green = 0;
245             blue = 0;
246         } else {
247             float alphaValue = 1.0f / alpha;
248             red *= alphaValue;
249             green *= alphaValue;
250             blue *= alphaValue;
251         }
252         return *this;
253     }
254 #if defined(GRAPHIC_ENABLE_GRADIENT_FILL_FLAG) && GRAPHIC_ENABLE_GRADIENT_FILL_FLAG
255     /**
256      * @brief Gradual change.
257      *
258      * @param RGBA is the RGBA object and K is the coefficient of variation.
259      * @return Returns the RGBA object.
260      * @since 1.0
261      * @version 1.0
262      */
GradientRgba263     Rgba Gradient(Rgba rgba, float k) const
264     {
265         Rgba ret;
266         ret.red = red + (rgba.red - red) * k;
267         ret.green = green + (rgba.green - green) * k;
268         ret.blue = blue + (rgba.blue - blue) * k;
269         ret.alpha = alpha+ (rgba.alpha - alpha) * k;
270         return ret;
271     }
272 #endif
273     /**
274      * @brief Overloaded operator += function.
275      *
276      * @param RGBA is a reference to the RGBA object.
277      * @return Returns a reference to the RGBA object.
278      * @since 1.0
279      * @version 1.0
280      */
281     Rgba& operator+=(const Rgba& rgba)
282     {
283         red += rgba.red;
284         green += rgba.green;
285         blue += rgba.blue;
286         alpha += rgba.alpha;
287         return *this;
288     }
289 
290     /**
291      * @brief Overloaded operator *= function.
292      *
293      * @param Multiplyvalue is the coefficient of multiplication.
294      * @return Returns a reference to the RGBA object.
295      * @since 1.0
296      * @version 1.0
297      */
298     Rgba& operator*=(float multiplyValue)
299     {
300         red *= multiplyValue;
301         green *= multiplyValue;
302         blue *= multiplyValue;
303         alpha *= multiplyValue;
304         return *this;
305     }
306 
NoColorRgba307     static Rgba NoColor()
308     {
309         return Rgba(0, 0, 0, 0);
310     }
311 
312     /**
313      * @brief Is the wavelength purple.
314      *
315      * @param waveLength wavelength.
316      * @return Returns the RGBA object.
317      * @since 1.0
318      * @version 1.0
319      */
IsPurpleWaveRgba320     inline static Rgba IsPurpleWave(float waveLength)
321     {
322         if (waveLength >= PURPLE_MIN && waveLength <= PURPLE_MAX) {
323             return Rgba(-1.0f * (waveLength - PURPLE_MAX) / (PURPLE_MAX - PURPLE_MIN), 0.0f, 1.0f);
324         } else {
325             return Rgba(0.0f, 0.0f, 0.0f);
326         }
327     }
328     /**
329      * @brief Is the wavelength blue.
330      *
331      * @param waveLength wavelength.
332      * @return Returns the RGBA object.
333      * @since 1.0
334      * @version 1.0
335      */
IsBlueWaveRgba336     inline static Rgba IsBlueWave(float waveLength)
337     {
338         if (waveLength >= PURPLE_MAX && waveLength <= BLUE_MAX) {
339             return Rgba(0.0f, (waveLength - PURPLE_MAX) / (BLUE_MAX - PURPLE_MAX), 1.0f);
340         } else {
341             return Rgba(0.0f, 0.0f, 0.0f);
342         }
343     }
344     /**
345      * @brief Is the wavelength cyan.
346      *
347      * @param waveLength wavelength.
348      * @return Returns the RGBA object.
349      * @since 1.0
350      * @version 1.0
351      */
IsCyanWaveRgba352     inline static Rgba IsCyanWave(float waveLength)
353     {
354         if (waveLength >= BLUE_MAX && waveLength <= CYAN_MAX) {
355             return Rgba(0.0f, 1.0f, -1.0f * (waveLength - CYAN_MAX) / (CYAN_MAX - BLUE_MAX));
356         } else {
357             return Rgba(0.0f, 0.0f, 0.0f);
358         }
359     }
360     /**
361      * @brief Is the wavelength green.
362      *
363      * @param waveLength wavelength.
364      * @return Returns the RGBA object.
365      * @since 1.0
366      * @version 1.0
367      */
IsGreenWaveRgba368     inline static Rgba IsGreenWave(float waveLength)
369     {
370         if (waveLength >= CYAN_MAX && waveLength <= GREEN_MAX) {
371             return Rgba((waveLength - CYAN_MAX) / (GREEN_MAX - CYAN_MAX), 1.0f, 0.0f);
372         } else {
373             return Rgba(0.0f, 0.0f, 0.0f);
374         }
375     }
376     /**
377      * @brief Is the wavelength orange.
378      *
379      * @param waveLength wavelength.
380      * @return Returns the RGBA object.
381      * @since 1.0
382      * @version 1.0
383      */
IsOrangeWaveRgba384     inline static Rgba IsOrangeWave(float waveLength)
385     {
386         if (waveLength >= GREEN_MAX && waveLength <= ORANGE_MAX) {
387             return Rgba(1.0f, -1.0f * (waveLength - ORANGE_MAX) / (ORANGE_MAX - GREEN_MAX), 0.0f);
388         } else {
389             return Rgba(0.0f, 0.0f, 0.0f);
390         }
391     }
392     /**
393      * @brief Is the wavelength red.
394      *
395      * @param waveLength wavelength.
396      * @return Returns the RGBA object.
397      * @since 1.0
398      * @version 1.0
399      */
IsRedWaveRgba400     inline static Rgba IsRedWave(float waveLength)
401     {
402         if (waveLength >= ORANGE_MAX && waveLength <= RED_MAX) {
403             return Rgba(1.0f, 0.0f, 0.0f);
404         } else {
405             return Rgba(0.0f, 0.0f, 0.0f);
406         }
407     }
408     /**
409      * @brief Initialize color based on wavelength.
410      *
411      * @param waveLength wavelength.
412      * @return Returns the RGBA object.
413      * @since 1.0
414      * @version 1.0
415      */
416     static Rgba InitColorByWaveLength(float waveLength);
417 };
418 
InitColorByWaveLength(float waveLength)419 inline Rgba Rgba::InitColorByWaveLength(float waveLength)
420 {
421     Rgba rgba(0.0f, 0.0f, 0.0f);
422     rgba += IsPurpleWave(waveLength);
423     rgba += IsBlueWave(waveLength);
424     rgba += IsCyanWave(waveLength);
425     rgba += IsGreenWave(waveLength);
426     rgba += IsOrangeWave(waveLength);
427     rgba += IsRedWave(waveLength);
428     return rgba;
429 }
430 
431 /**
432  * @brief Rgba8T color sequence conversion.
433  *
434  * Color order: red, green, blue, transparency.
435  *
436  * @see Rgba8T
437  * @since 1.0
438  * @version 1.0
439  */
440 struct Rgba8T {
441     uint8_t red;
442     uint8_t green;
443     uint8_t blue;
444     uint8_t alpha;
445 
446     enum BaseScale {
447         BASE_SHIFT = 8,
448         BASE_SCALE = 1 << BASE_SHIFT,
449         BASE_MASK = BASE_SCALE - 1,
450         BASE_MSB = 1 << (BASE_SHIFT - 1)
451     };
452 
Rgba8TRgba8T453     Rgba8T() : red(0), green(0), blue(0), alpha(0) {}
454 
455     /**
456      * @brief Rgba8T Constructor
457      *
458      * @param Red value, green value, blue value, alpha transparency
459      * @since 1.0
460      * @version 1.0
461      */
462     Rgba8T(uint32_t red, uint32_t green, uint32_t blue, uint32_t alpha = BASE_MASK)
redRgba8T463         : red(uint8_t(red)),
464         green(uint8_t(green)),
465         blue(uint8_t(blue)),
466         alpha(uint8_t(alpha)) {}
467 
468     /**
469      * @brief Rgba8T Constructor
470      *
471      * @param Color is a reference to the RGBA object
472      * @since 1.0
473      * @version 1.0
474      */
Rgba8TRgba8T475     Rgba8T(const Rgba& color)
476     {
477         Convert(*this, color);
478     }
479 
480     /**
481      * @brief Rgba8T Constructor
482      *
483      * @param Color is the reference of the rgba8t object, and alpha is the transparency
484      * @since 1.0
485      * @version 1.0
486      */
Rgba8TRgba8T487     Rgba8T(const Rgba8T& color, uint32_t alpha)
488         : red(color.red),
489         green(color.green),
490         blue(color.blue),
491         alpha(uint8_t(alpha)) {}
492 
493     /**
494      * @brief Rgba8T Constructor
495      *
496      * @param Color is a reference to the rgba8t < T > object
497      * @return Rgba8T
498      * @since 1.0
499      * @version 1.0
500      */
Rgba8TRgba8T501     Rgba8T(const Rgba8T& color)
502     {
503         Convert(*this, color);
504     }
505 
506     Rgba8T& operator=(const Rgba8T& color)
507     {
508         Convert(*this, color);
509         return *this;
510     }
511 
512     /**
513      * @brief Overloaded RGBA function
514      *
515      * @return Returns the RGBA object
516      * @since 1.0
517      * @version 1.0
518      */
RgbaRgba8T519     operator Rgba() const
520     {
521         Rgba color;
522         Convert(color, *this);
523         return color;
524     }
525 
526     /**
527      * @brief Assign the color value in RGBA to rgba8t <linear>
528      *
529      * @param DST is the reference of rgba8t <linear> object, and Src is the
530      *  constant reference of RGBA object
531      * @since 1.0
532      * @version 1.0
533      */
ConvertRgba8T534     static void Convert(Rgba8T& dst, const Rgba& src)
535     {
536         dst.red = uint8_t(MATH_UROUND(src.red * BASE_MASK));
537         dst.green = uint8_t(MATH_UROUND(src.green * BASE_MASK));
538         dst.blue = uint8_t(MATH_UROUND(src.blue * BASE_MASK));
539         dst.alpha = uint8_t(MATH_UROUND(src.alpha * BASE_MASK));
540     }
541 
542     /**
543      * @brief Assign the color value in RGBA to rgba8t <linear>
544      *
545      * @param DST is the reference of rgba8t <linear> object, and Src is the
546      *  constant reference of RGBA object
547      * @since 1.0
548      * @version 1.0
549      */
ConvertRgba8T550     static void Convert(Rgba& dst, const Rgba8T& src)
551     {
552         dst.red = static_cast<float>(src.red) / BASE_MASK;
553         dst.green = static_cast<float>(src.green) / BASE_MASK;
554         dst.blue = static_cast<float>(src.blue) / BASE_MASK;
555         dst.alpha = static_cast<float>(src.alpha) / BASE_MASK;
556     }
557 
FromFloatRgba8T558     static inline uint8_t FromFloat(float value)
559     {
560         return uint8_t(MATH_UROUND(value * BASE_MASK));
561     }
562 
EmptyValueRgba8T563     static inline uint8_t EmptyValue()
564     {
565         return 0;
566     }
567 
IsTransparentRgba8T568     inline bool IsTransparent() const
569     {
570         return alpha == 0;
571     }
572 
IsOpaqueRgba8T573     inline bool IsOpaque() const
574     {
575         return alpha == BASE_MASK;
576     }
577 
MultiplyRgba8T578     static inline uint8_t Multiply(uint8_t valueA, uint8_t valueB)
579     {
580 #if defined(ENABLE_ARM_MATH) && ENABLE_ARM_MATH
581         uint32_t uint32_t = __SMUAD(valueA, valueB) + BASE_MSB;
582 #else
583         uint32_t uint32_t = valueA * valueB + BASE_MSB;
584 #endif
585         return uint8_t(((uint32_t >> BASE_SHIFT) + uint32_t) >> BASE_SHIFT);
586     }
587 
DividMultiplyRgba8T588     static uint8_t DividMultiply(uint8_t valueA, uint8_t valueB)
589     {
590         if (valueA * valueB == 0) {
591             return 0;
592         } else if (valueA >= valueB) {
593             return BASE_MASK;
594         } else {
595             if (valueB == 0) {
596                 valueB = 1;
597             }
598 
599 #if defined(ENABLE_ARM_MATH) && ENABLE_ARM_MATH
600             return uint8_t(__UDIV(__SMUAD(valueA, BASE_MASK) + (valueB >> 1), valueB));
601 #else
602             return uint8_t((valueA * BASE_MASK + (valueB >> 1)) / valueB);
603 #endif
604         }
605     }
606 
MultCoverRgba8T607     static inline uint8_t MultCover(uint8_t valueA, uint8_t coverValue)
608     {
609         return Multiply(valueA, coverValue);
610     }
611 
ScaleCoverRgba8T612     static inline uint8_t ScaleCover(uint8_t coverValue, uint8_t value)
613     {
614         return Multiply(value, coverValue);
615     }
616 
PrelerpRgba8T617     static inline uint8_t Prelerp(uint8_t valueP, uint8_t valueQ, uint8_t valueA)
618     {
619         return valueP + valueQ - Multiply(valueP, valueA);
620     }
621 
LerpRgba8T622     static inline uint8_t Lerp(uint8_t valueP, uint8_t valueQ, uint8_t valueA)
623     {
624 #if defined(ENABLE_ARM_MATH) && ENABLE_ARM_MATH
625         int32_t t = __SMUAD((valueQ - valueP), valueA) + BASE_MSB - (valueP > valueQ);
626 #else
627         int32_t t = (valueQ - valueP) * valueA + BASE_MSB - (valueP > valueQ);
628 
629 #endif
630         return uint8_t(valueP + (((t >> BASE_SHIFT) + t) >> BASE_SHIFT));
631     }
632 
633     /**
634      * @brief Set transparency
635      *
636      * @param Alpha is transparency
637      * @return Returns a reference to the rgba8t object
638      * @since 1.0
639      * @version 1.0
640      */
OpacityRgba8T641     Rgba8T& Opacity(float alphaValue)
642     {
643         if (alphaValue < 0) {
644             alpha = 0;
645         } else if (alphaValue > 1) {
646             alpha = 1;
647         } else {
648             alpha = static_cast<uint8_t>(MATH_UROUND(alphaValue * float(BASE_MASK)));
649         }
650         return *this;
651     }
652 
OpacityRgba8T653     float Opacity() const
654     {
655         return alpha / BASE_MASK;
656     }
657 #if defined(GRAPHIC_ENABLE_GRADIENT_FILL_FLAG) && GRAPHIC_ENABLE_GRADIENT_FILL_FLAG
658     /**
659      * @brief Gradient, calculate the new rgba8t object according to the change coefficient
660      *
661      * @param Color is the reference of the rgba8t object, and K is the coefficient of variation
662      * @return Returns the rgba8t object
663      * @since 1.0
664      * @version 1.0
665      */
GradientRgba8T666     inline Rgba8T Gradient(const Rgba8T& color, float k) const
667     {
668         Rgba8T ret;
669         uint32_t increaseK = MATH_UROUND(k * BASE_MASK);
670         ret.red = Lerp(red, color.red, increaseK);
671         ret.green = Lerp(green, color.green, increaseK);
672         ret.blue = Lerp(blue, color.blue, increaseK);
673         ret.alpha = Lerp(alpha, color.alpha, increaseK);
674         return ret;
675     }
676 #endif
NoColorRgba8T677     static Rgba8T NoColor()
678     {
679         return Rgba8T(0, 0, 0, 0);
680     }
681 };
682 
683 /**
684  * @brief Converts colors in different formats and defines common colors.
685  *
686  * @since 1.0
687  * @version 1.0
688  */
689 class Color : public HeapBase {
690 public:
691     /**
692      * @brief Mixes two colors (color 1 and color 2) based on a specified opacity.
693      *
694      * @param c1 Indicates color 1.
695      * @param c2 Indicates color 2.
696      * @param mix Indicates the alpha, that is, how opaque each pixel is.
697 
698      * @return Returns the color data after mixing.
699      * @since 1.0
700      * @version 1.0
701      */
702     static ColorType GetMixColor(ColorType c1, ColorType c2, uint8_t mix);
703 
704     /**
705      * @brief Obtains the color based on the RGB color value.
706      *
707      * @param r8 Indicates the intensity of red.
708      * @param g8 Indicates the intensity of green.
709      * @param b8 Indicates the intensity of blue.
710      *
711      * @return Returns the color data generated.
712      * @since 1.0
713      * @version 1.0
714      */
715     static ColorType GetColorFromRGB(uint8_t r8, uint8_t g8, uint8_t b8);
716 
717     /**
718      * @brief Obtains the color based on the RGBA color value.
719      *
720      * @param r8 Indicates the intensity of red.
721      * @param g8 Indicates the intensity of green.
722      * @param b8 Indicates the intensity of blue.
723      * @param alpha Indicates the alpha, that is, how opaque each pixel is.
724      *
725      * @return Returns the color data generated.
726      * @since 1.0
727      * @version 1.0
728      */
729     static ColorType GetColorFromRGBA(uint8_t r8, uint8_t g8, uint8_t b8, uint8_t alpha);
730 
731     /**
732      * @brief Converts color data into the RGBA8888 format.
733      *
734      * The color data definition varies according to the color depth.
735      *
736      * @param color Indicates the color data, which is defined by {@link ColorType}.
737      * @return Returns the RGBA8888 color data.
738      * @since 1.0
739      * @version 1.0
740      */
741     static uint32_t ColorTo32(ColorType color);
742 
743     /**
744      * @brief Converts color data with the 16-bit color depth into the RGBA8888 format.
745      *
746      * @param color Indicates the color data with the 16-bit color depth, which is defined by {@link Color16}.
747      * @param alpha Indicates the alpha, that is, how opaque each pixel is.
748      * @return Returns the RGBA8888 color data.
749      * @since 1.0
750      * @version 1.0
751      */
752     static uint32_t ColorTo32(Color16 color, uint8_t alpha);
753 
754     /**
755      * @brief Converts color data from the RGBA8888 format into the RGB565 format.
756      *
757      * @param color Indicates the color data with the 32-bit color depth, which is defined by {@link Color32}.
758      * @return Returns the RGB565 color data.
759      * @since 1.0
760      * @version 1.0
761      */
762     static uint16_t ColorTo16(Color32 color);
763 
764     /**
765      * @brief Obtains the color data of white.
766      *
767      * @return Returns the color data.
768      * @since 1.0
769      * @version 1.0
770      */
771     static ColorType White();
772 
773     /**
774      * @brief Obtains the color data of silver.
775      *
776      * @return Returns the color data.
777      * @since 1.0
778      * @version 1.0
779      */
780     static ColorType Silver();
781 
782     /**
783      * @brief Obtains the color data of gray.
784      *
785      * @return Returns the color data.
786      * @since 1.0
787      * @version 1.0
788      */
789     static ColorType Gray();
790 
791     /**
792      * @brief Obtains the color data of black.
793      *
794      * @return Returns the color data.
795      * @since 1.0
796      * @version 1.0
797      */
798     static ColorType Black();
799 
800     /**
801      * @brief Obtains the color data of red.
802      *
803      * @return Returns the color data.
804      * @since 1.0
805      * @version 1.0
806      */
807     static ColorType Red();
808 
809     /**
810      * @brief Obtains the color data of maroon.
811      *
812      * @return Returns the color data.
813      * @since 1.0
814      * @version 1.0
815      */
816     static ColorType Maroon();
817 
818     /**
819      * @brief Obtains the color data of yellow.
820      *
821      * @return Returns the color data.
822      * @since 1.0
823      * @version 1.0
824      */
825     static ColorType Yellow();
826 
827     /**
828      * @brief Obtains the color data of olive.
829      *
830      * @return Returns the color data.
831      * @since 1.0
832      * @version 1.0
833      */
834     static ColorType Olive();
835 
836     /**
837      * @brief Obtains the color data of lime.
838      *
839      * @return Returns the color data.
840      * @since 1.0
841      * @version 1.0
842      */
843     static ColorType Lime();
844 
845     /**
846      * @brief Obtains the color data of green.
847      *
848      * @return Returns the color data.
849      * @since 1.0
850      * @version 1.0
851      */
852     static ColorType Green();
853 
854     /**
855      * @brief Obtains the color data of cyan.
856      *
857      * @return Returns the color data.
858      * @since 1.0
859      * @version 1.0
860      */
861     static ColorType Cyan();
862 
863     /**
864      * @brief Obtains the color data of aqua.
865      *
866      * @return Returns the color data.
867      * @since 1.0
868      * @version 1.0
869      */
870     static ColorType Aqua();
871 
872     /**
873      * @brief Obtains the color data of teal.
874      *
875      * @return Returns the color data.
876      * @since 1.0
877      * @version 1.0
878      */
879     static ColorType Teal();
880 
881     /**
882      * @brief Obtains the color data of blue.
883      *
884      * @return Returns the color data.
885      * @since 1.0
886      * @version 1.0
887      */
888     static ColorType Blue();
889 
890     /**
891      * @brief Obtains the color data of navy.
892      *
893      * @return Returns the color data.
894      * @since 1.0
895      * @version 1.0
896      */
897     static ColorType Navy();
898 
899     /**
900      * @brief Obtains the color data of magenta.
901      *
902      * @return Returns the color data.
903      * @since 1.0
904      * @version 1.0
905      */
906     static ColorType Magenta();
907 
908     /**
909      * @brief Obtains the color data of purple.
910      *
911      * @return Returns the color data.
912      * @since 1.0
913      * @version 1.0
914      */
915     static ColorType Purple();
916 
917     /**
918      * @brief Obtains the color data of orange.
919      *
920      * @return Returns the color data.
921      * @since 1.0
922      * @version 1.0
923      */
924     static ColorType Orange();
925 };
926 } // namespace OHOS
927 #endif
928