blob: 7d174e7fec84eea7024bb1c45f942fadea65ec92 [file] [log] [blame]
Cary Clark2d4bf5f2018-04-16 08:37:38 -04001#Topic Color
2#Alias Color_Reference
3
4#Subtopic Overview
5 #Subtopic Subtopic
6 #Populate
7 ##
8##
9
10#Subtopic Define
11#Populate
12##
13
14#Subtopic Function
15#Populate
16##
17
18#Subtopic Typedef
19#Populate
20##
21
22 #Subtopic Alpha
23 #Alias Alpha
24 #Subtopic ##
25
26 #Subtopic RGB
27 #Substitute RGB
28 #Subtopic Red
29 #Alias Red
30 #Subtopic ##
31 #Subtopic Blue
32 #Alias Blue
33 #Subtopic ##
34 #Subtopic Green
35 #Alias Green
36 #Subtopic ##
37 #Subtopic ##
38
39 #Subtopic ARGB
40 #Substitute ARGB
41 #Subtopic ##
42
43 #Subtopic RBG
44 #Substitute RBG
45 #Subtopic ##
46
47 #Subtopic RGB-565
48 #Substitute RGB-565
49 #Alias Color_RGB-565 # quit changing - to _ !
50 #Subtopic ##
51
52 #Subtopic Gray
53 ##
54
55# ------------------------------------------------------------------------------
56
57#Typedef uint8_t SkAlpha
58
59Types and macros for colors
608-bit type for an alpha value. 0xFF is 100% opaque, 0x00 is 100% transparent.
61
62#Typedef ##
63
64# ------------------------------------------------------------------------------
65
66#Typedef uint32_t SkColor
67
6832 bit ARGB color value, not premultiplied. The color components are always in
69a known order. This is different from SkPMColor, which has its bytes in a configuration
70dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. SkColor
71is the type used to specify colors in SkPaint and in gradients.
72
73#Typedef ##
74
75# ------------------------------------------------------------------------------
76
77#Method static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
78#In Function
79#Line # incomplete ##
80
81Return a SkColor value from 8 bit component values
82
83#Param a incomplete ##
84#Param r incomplete ##
85#Param g incomplete ##
86#Param b incomplete ##
87
88#Return incomplete ##
89
90#Example
91// incomplete
92##
93
94#SeeAlso incomplete
95
96#Method ##
97
98# ------------------------------------------------------------------------------
99
100#Define SkColorSetARGBInline
101
102#Code
103###$
104 #define SkColorSetARGBInline SkColorSetARGB
105$$$#
106##
107
108Legacy aliases.
109
110#NoExample
111##
112
113#SeeAlso incomplete
114
115#Define ##
116
117# ------------------------------------------------------------------------------
118
119#Define SkColorSetARGBMacro
120
121#Code
122###$
123 #define SkColorSetARGBMacro SkColorSetARGB
124$$$#
125##
126
127#NoExample
128##
129
130#SeeAlso incomplete
131
132#Define ##
133
134# ------------------------------------------------------------------------------
135
136#Define SkColorSetRGB
137#Line # incomplete ##
138
139#Code
140###$
141 #define SkColorSetRGB(r, g, b) SkColorSetARGB(0xFF, r, g, b)
142$$$#
143##
144
145Return a SkColor value from 8 bit component values, with an implied value
146of 0xFF for alpha (fully opaque)
147
148#Param r incomplete ##
149#Param g incomplete ##
150#Param b incomplete ##
151
152#Example
153// incomplete
154##
155
156#SeeAlso incomplete
157
158#Define ##
159
160# ------------------------------------------------------------------------------
161
162#Define SkColorGetA
163#Line # incomplete ##
164
165#Code
166###$
167 #define SkColorGetA(color) (((color) >> 24) & 0xFF)
168$$$#
169##
170
171return the alpha byte from a SkColor value
172
173#Param color incomplete ##
174
175#Example
176// incomplete
177##
178
179#SeeAlso incomplete
180
181#Define ##
182
183# ------------------------------------------------------------------------------
184
185#Define SkColorGetR
186#Line # incomplete ##
187
188#Code
189###$
190 #define SkColorGetR(color) (((color) >> 16) & 0xFF)
191$$$#
192##
193
194return the red byte from a SkColor value
195
196#Param color incomplete ##
197
198#Example
199// incomplete
200##
201
202#SeeAlso incomplete
203
204#Define ##
205
206# ------------------------------------------------------------------------------
207
208#Define SkColorGetG
209#Line # incomplete ##
210
211#Code
212###$
213 #define SkColorGetG(color) (((color) >> 8) & 0xFF)
214$$$#
215##
216
217return the green byte from a SkColor value
218
219#Param color incomplete ##
220
221#Example
222// incomplete
223##
224
225#SeeAlso incomplete
226
227#Define ##
228
229# ------------------------------------------------------------------------------
230
231#Define SkColorGetB
232#Line # incomplete ##
233
234#Code
235###$
236 #define SkColorGetB(color) (((color) >> 0) & 0xFF)
237$$$#
238##
239
240return the blue byte from a SkColor value
241
242#Param color incomplete ##
243
244#Example
245// incomplete
246##
247
248#SeeAlso incomplete
249
250#Define ##
251
252# ------------------------------------------------------------------------------
253
254#Method static constexpr inline SkColor SkColorSetA(SkColor c, U8CPU a)
255#In Function
256#Line # incomplete ##
257
258#Param c incomplete ##
259#Param a incomplete ##
260
261#Return incomplete ##
262
263#Example
264// incomplete
265##
266
267#SeeAlso incomplete
268
269#Method ##
270
271# ------------------------------------------------------------------------------
272
273#Define SK_AlphaTRANSPARENT
274
275#Code
276###$
277 #define SK_AlphaTRANSPARENT static_cast<SkAlpha>(0x00)
278$$$#
279##
280
281common colors
282transparent SkAlpha value
283
284#Example
285// incomplete
286##
287
288#SeeAlso incomplete
289
290#Define ##
291
292# ------------------------------------------------------------------------------
293
294#Define SK_AlphaOPAQUE
295
296#Code
297###$
298 #define SK_AlphaOPAQUE static_cast<SkAlpha>(0xFF)
299$$$#
300##
301
302opaque SkAlpha value
303
304#Example
305// incomplete
306##
307
308#SeeAlso incomplete
309
310#Define ##
311
312# ------------------------------------------------------------------------------
313
314#Define SK_ColorTRANSPARENT
315
316#Code
317###$
318 #define SK_ColorTRANSPARENT static_cast<SkColor>(0x00000000)
319$$$#
320##
321
322transparent SkColor value
323
324#Example
325// incomplete
326##
327
328#SeeAlso incomplete
329
330#Define ##
331
332# ------------------------------------------------------------------------------
333
334#Define SK_ColorBLACK
335
336#Code
337###$
338 #define SK_ColorBLACK static_cast<SkColor>(0xFF000000)
339$$$#
340##
341
342black SkColor value
343
344#Example
345// incomplete
346##
347
348#SeeAlso incomplete
349
350#Define ##
351
352# ------------------------------------------------------------------------------
353
354#Define SK_ColorDKGRAY
355
356#Code
357###$
358 #define SK_ColorDKGRAY static_cast<SkColor>(0xFF444444)
359$$$#
360##
361
362dark gray SkColor value
363
364#Example
365// incomplete
366##
367
368#SeeAlso incomplete
369
370#Define ##
371
372# ------------------------------------------------------------------------------
373
374#Define SK_ColorGRAY
375
376#Code
377###$
378 #define SK_ColorGRAY static_cast<SkColor>(0xFF888888)
379$$$#
380##
381
382gray SkColor value
383
384#Example
385// incomplete
386##
387
388#SeeAlso incomplete
389
390#Define ##
391
392# ------------------------------------------------------------------------------
393
394#Define SK_ColorLTGRAY
395
396#Code
397###$
398 #define SK_ColorLTGRAY static_cast<SkColor>(0xFFCCCCCC)
399$$$#
400##
401
402light gray SkColor value
403
404#Example
405// incomplete
406##
407
408#SeeAlso incomplete
409
410#Define ##
411
412# ------------------------------------------------------------------------------
413
414#Define SK_ColorWHITE
415
416#Code
417###$
418 #define SK_ColorWHITE static_cast<SkColor>(0xFFFFFFFF)
419$$$#
420##
421
422white SkColor value
423
424#Example
425// incomplete
426##
427
428#SeeAlso incomplete
429
430#Define ##
431
432# ------------------------------------------------------------------------------
433
434#Define SK_ColorRED
435
436#Code
437###$
438 #define SK_ColorRED static_cast<SkColor>(0xFFFF0000)
439$$$#
440##
441
442red SkColor value
443
444#Example
445// incomplete
446##
447
448#SeeAlso incomplete
449
450#Define ##
451
452# ------------------------------------------------------------------------------
453
454#Define SK_ColorGREEN
455
456#Code
457###$
458 #define SK_ColorGREEN static_cast<SkColor>(0xFF00FF00)
459$$$#
460##
461
462green SkColor value
463
464#Example
465// incomplete
466##
467
468#SeeAlso incomplete
469
470#Define ##
471
472# ------------------------------------------------------------------------------
473
474#Define SK_ColorBLUE
475
476#Code
477###$
478 #define SK_ColorBLUE static_cast<SkColor>(0xFF0000FF)
479$$$#
480##
481
482blue SkColor value
483
484#Example
485// incomplete
486##
487
488#SeeAlso incomplete
489
490#Define ##
491
492# ------------------------------------------------------------------------------
493
494#Define SK_ColorYELLOW
495
496#Code
497###$
498 #define SK_ColorYELLOW static_cast<SkColor>(0xFFFFFF00)
499$$$#
500##
501
502yellow SkColor value
503
504#Example
505// incomplete
506##
507
508#SeeAlso incomplete
509
510#Define ##
511
512# ------------------------------------------------------------------------------
513
514#Define SK_ColorCYAN
515
516#Code
517###$
518 #define SK_ColorCYAN static_cast<SkColor>(0xFF00FFFF)
519$$$#
520##
521
522cyan SkColor value
523
524#Example
525// incomplete
526##
527
528#SeeAlso incomplete
529
530#Define ##
531
532# ------------------------------------------------------------------------------
533
534#Define SK_ColorMAGENTA
535
536#Code
537###$
538 #define SK_ColorMAGENTA static_cast<SkColor>(0xFFFF00FF)
539$$$#
540##
541
542magenta SkColor value
543
544#Example
545// incomplete
546##
547
548#SeeAlso incomplete
549
550#Define ##
551
552# ------------------------------------------------------------------------------
553
554#Subtopic HSV
555
556#Subtopic Hue
557Hue represents an angle, in degrees, on a color wheel. Hue has a positive value
558modulo 360, where zero degrees is red.
559##
560
561#Subtopic Saturation
562##
563
564#Subtopic Value
565##
566
567#Method SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3])
568#In Function
569#Line # incomplete ##
570
571Convert RGB components to HSV.
572hsv[0] is Hue [0 .. 360)
573hsv[1] is Saturation [0...1]
574hsv[2] is Value [0...1]
575
576#Param red red component value [0..255]
577##
578#Param green green component value [0..255]
579##
580#Param blue blue component value [0..255]
581##
582#Param hsv 3 element array which holds the resulting HSV components.
583##
584
585#Return incomplete ##
586
587#Example
588// incomplete
589##
590
591#SeeAlso incomplete
592
593#Method ##
594
595# ------------------------------------------------------------------------------
596
597#Method static inline void SkColorToHSV(SkColor color, SkScalar hsv[3])
598#In Function
599#Line # incomplete ##
600
601Convert the argb color to its HSV components.
602hsv[0] represents Hue, and is assigned a value from zero to less than 360.
603hsv[1] is Saturation [0...1]
604hsv[2] is Value [0...1]
605
606#Param color the argb color to convert. Note: the alpha component is ignored.
607##
608#Param hsv 3 element array which holds the resulting HSV components.
609##
610
611#Return incomplete ##
612
613#Example
614// incomplete
615##
616
617#SeeAlso incomplete
618
619#Method ##
620
621# ------------------------------------------------------------------------------
622
623#Method SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3])
624#In Function
625#Line # incomplete ##
626
627Convert HSV components to an ARGB color. The alpha component is passed through unchanged.
628hsv[0] represents Hue, an angle from zero to less than 360.
629hsv[1] represents Saturation, and varies from zero to one.
630hsv[2] represents Value, and varies from zero to one.
631
632If hsv values are out of range, they are pinned.
633
634#Param alpha the alpha component of the returned argb color.
635##
636#Param hsv 3 element array which holds the input HSV components.
637##
638
639#Return the resulting argb color
640##
641
642#Example
643// incomplete
644##
645
646#SeeAlso incomplete
647
648#Method ##
649
650# ------------------------------------------------------------------------------
651
652#Method static inline SkColor SkHSVToColor(const SkScalar hsv[3])
653#In Function
654#Line # incomplete ##
655
656Convert HSV components to an ARGB color. The alpha component set to 0xFF.
657hsv[0] represents Hue, an angle from zero to less than 360.
658hsv[1] represents Saturation, and varies from zero to one.
659hsv[2] represents Value, and varies from zero to one.
660
661If hsv values are out of range, they are pinned.
662
663#Param hsv 3 element array which holds the input HSV components.
664##
665
666#Return the resulting argb color
667##
668
669#Example
670// incomplete
671##
672
673#SeeAlso incomplete
674
675#Method ##
676
677#Subtopic HSV ##
678
679# ------------------------------------------------------------------------------
680
681#Typedef uint32_t SkPMColor
682
68332 bit ARGB color value, premultiplied. The byte order for this value is
684configuration dependent, matching the format of kBGRA_8888_SkColorType bitmaps.
685This is different from SkColor, which is nonpremultiplied, and is always in the
686same byte order.
687
688#Typedef ##
689
690# ------------------------------------------------------------------------------
691
692#Method SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
693#In Function
694#Line # incomplete ##
695
696Return a SkPMColor value from unpremultiplied 8 bit component values
697
698#Param a incomplete ##
699#Param r incomplete ##
700#Param g incomplete ##
701#Param b incomplete ##
702
703#Return incomplete ##
704
705#Example
706// incomplete
707##
708
709#SeeAlso incomplete
710
711#Method ##
712
713# ------------------------------------------------------------------------------
714
715#Method SK_API SkPMColor SkPreMultiplyColor(SkColor c)
716#In Function
717#Line # incomplete ##
718
719Return a SkPMColor value from a SkColor value. This is done by multiplying the color
720components by the color's alpha, and by arranging the bytes in a configuration
721dependent order, to match the format of kBGRA_8888_SkColorType bitmaps.
722
723#Param c incomplete ##
724
725#Return incomplete ##
726
727#Example
728// incomplete
729##
730
731#SeeAlso incomplete
732
733#Method ##
734
735#Topic Color ##