Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: include/core/SkColor.h

Issue 16410009: Add an option to create unpremultiplied bitmaps. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkColor_DEFINED 10 #ifndef SkColor_DEFINED
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 //////////////////////////////////////////////////////////////////////// 140 ////////////////////////////////////////////////////////////////////////
141 141
142 /** 32 bit ARGB color value, premultiplied. The byte order for this value is 142 /** 32 bit ARGB color value, premultiplied. The byte order for this value is
143 configuration dependent, matching the format of kARGB32 bitmaps. This is dif ferent 143 configuration dependent, matching the format of kARGB32 bitmaps. This is dif ferent
144 from SkColor, which is nonpremultiplied, and is always in the same byte orde r. 144 from SkColor, which is nonpremultiplied, and is always in the same byte orde r.
145 */ 145 */
146 typedef uint32_t SkPMColor; 146 typedef uint32_t SkPMColor;
147 147
148 /** Like SkPMColor, this is a 32 bit ARGB configuration dependent ordered color, but it is
reed1 2013/06/12 20:20:00 On conservative side, lets not make this public (y
149 nonpremultiplied, like SkColor.
150 */
151 typedef SkPMColor SkUnPMColor;
152
153 // Convert an unmultiplied color to a premultiplied color.
154 SkPMColor SkPreMultiplyUnPMColor(SkUnPMColor c);
155
148 /** Return a SkPMColor value from unpremultiplied 8 bit component values 156 /** Return a SkPMColor value from unpremultiplied 8 bit component values
149 */ 157 */
150 SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); 158 SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b);
151 /** Return a SkPMColor value from a SkColor value. This is done by multiplying t he color 159 /** Return a SkPMColor value from a SkColor value. This is done by multiplying t he color
152 components by the color's alpha, and by arranging the bytes in a configurati on 160 components by the color's alpha, and by arranging the bytes in a configurati on
153 dependent order, to match the format of kARGB32 bitmaps. 161 dependent order, to match the format of kARGB32 bitmaps.
154 */ 162 */
155 SK_API SkPMColor SkPreMultiplyColor(SkColor c); 163 SK_API SkPMColor SkPreMultiplyColor(SkColor c);
156 164
157 /** Define a function pointer type for combining two premultiplied colors 165 /** Define a function pointer type for combining two premultiplied colors
158 */ 166 */
159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); 167 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst);
160 168
161 /** Define a function pointer type for combining a premultiplied src color 169 /** Define a function pointer type for combining a premultiplied src color
162 and a 16bit device color. 170 and a 16bit device color.
163 */ 171 */
164 typedef uint16_t (*SkXfermodeProc16)(SkPMColor src, uint16_t dst); 172 typedef uint16_t (*SkXfermodeProc16)(SkPMColor src, uint16_t dst);
165 173
166 #endif 174 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698