aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/SkBitmap_Reference.bmh130
-rw-r--r--docs/SkCanvas_Reference.bmh11
-rw-r--r--docs/SkIPoint_Reference.bmh2
-rw-r--r--docs/SkIRect_Reference.bmh7
-rw-r--r--docs/SkImageInfo_Reference.bmh738
-rw-r--r--docs/SkImage_Reference.bmh78
-rw-r--r--docs/SkMatrix_Reference.bmh54
-rw-r--r--docs/SkPaint_Reference.bmh8
-rw-r--r--docs/SkPath_Reference.bmh3
-rw-r--r--docs/SkPixmap_Reference.bmh42
-rw-r--r--docs/SkSurface_Reference.bmh4
-rw-r--r--docs/illustrations.bmh904
-rw-r--r--docs/status.json96
-rw-r--r--docs/undocumented.bmh5
-rw-r--r--site/user/api/SkBitmap_Reference.md40
-rw-r--r--site/user/api/SkCanvas_Reference.md9
-rw-r--r--site/user/api/SkIPoint_Reference.md2
-rw-r--r--site/user/api/SkIRect_Reference.md2
-rw-r--r--site/user/api/SkImageInfo_Reference.md577
-rw-r--r--site/user/api/SkImage_Reference.md184
-rw-r--r--site/user/api/SkMatrix_Reference.md14
-rw-r--r--site/user/api/SkPaint_Reference.md8
-rw-r--r--site/user/api/SkPath_Reference.md2
-rw-r--r--site/user/api/SkPixmap_Reference.md10
-rw-r--r--site/user/api/SkSurface_Reference.md4
-rw-r--r--site/user/api/catalog.htm388
-rw-r--r--site/user/api/undocumented.md11
27 files changed, 2067 insertions, 1266 deletions
diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh
index 78b527aa2b..0ffd16017a 100644
--- a/docs/SkBitmap_Reference.bmh
+++ b/docs/SkBitmap_Reference.bmh
@@ -201,11 +201,13 @@ allocated, so both bitmaps reference the same pixels.
#Example
void draw(SkCanvas* canvas) {
SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy(original);
- SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ if (original.tryAllocPixels(
+ SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {
+ SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy(original);
+ SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ }
}
#StdOut
original has pixels before copy: true
@@ -233,11 +235,13 @@ Bitmap.
#Example
void draw(SkCanvas* canvas) {
SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy(std::move(original));
- SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ if (original.tryAllocPixels(
+ SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {
+ SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy(std::move(original));
+ SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ }
}
#StdOut
original has pixels before move: true
@@ -279,11 +283,13 @@ allocated, so both bitmaps reference the same pixels.
#Example
void draw(SkCanvas* canvas) {
SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy = original;
- SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ if (original.tryAllocPixels(
+ SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {
+ SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy = original;
+ SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ }
}
#StdOut
original has pixels before copy: true
@@ -311,11 +317,13 @@ Bitmap.
#Example
void draw(SkCanvas* canvas) {
SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy = std::move(original);
- SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ if (original.tryAllocPixels(
+ SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {
+ SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
+ SkBitmap copy = std::move(original);
+ SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
+ SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+ }
}
#StdOut
original has pixels before move: true
@@ -347,8 +355,14 @@ void draw(SkCanvas* canvas) {
prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]);
};
SkBitmap one, two;
- one.tryAllocPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- two.tryAllocPixels(SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType));
+ if (!one.tryAllocPixels(
+ SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {
+ return;
+ }
+ if (!two.tryAllocPixels(
+ SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType))) {
+ return;
+ }
for (int index = 0; index < 2; ++index) {
debugster("one", one);
debugster("two", two);
@@ -533,8 +547,7 @@ color type: kAlpha_8_SkColorType
#Method SkAlphaType alphaType() const
#In Property
#Line # returns Image_Info Alpha_Type ##
-Returns Alpha_Type, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+Returns Alpha_Type, one of: #list_of_alpha_types#.
#Return Alpha_Type in Image_Info ##
@@ -589,7 +602,7 @@ gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
#Method sk_sp<SkColorSpace> refColorSpace() const
#In Property
#Line # returns Image_Info Color_Space ##
-Returns a smart pointer to Color_Space, the range of colors, associated with
+Returns smart pointer to Color_Space, the range of colors, associated with
Image_Info. The smart pointer tracks the number of objects sharing this
Color_Space reference so the memory is released when the owners destruct.
@@ -654,7 +667,7 @@ color: kRGBA_F16_SkColorType bytesPerPixel: 8
##
##
-#SeeAlso rowBytes rowBytesAsPixels width shiftPerPixel
+#SeeAlso rowBytes rowBytesAsPixels width shiftPerPixel SkImageInfo::bytesPerPixel
##
@@ -884,8 +897,7 @@ kUnpremul_SkAlphaType, it is treated as kPremul_SkAlphaType.
This changes Alpha_Type in Pixel_Ref; all bitmaps sharing Pixel_Ref
are affected.
-#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType
+#Param alphaType one of: #list_of_alpha_types#
##
#Return true if Alpha_Type is set ##
@@ -896,8 +908,8 @@ void draw(SkCanvas* canvas) {
"BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16" };
const char* alphas[] = {"Unknown ", "Opaque ", "Premul ", "Unpremul"};
SkBitmap bitmap;
- SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType };
+ SkAlphaType alphaTypes[] = { #list_of_alpha_types#
+ };
SkDebugf("%88s", "Canonical Unknown Opaque Premul Unpremul\n");
for (SkColorType colorType : { #list_of_color_types#
} ) {
@@ -1055,11 +1067,15 @@ Triggers assert if SK_DEBUG is true, runs fine otherwise.
#Method bool isOpaque() const
#In Property
#Line # returns true if Image_Info describes opaque pixels ##
-Returns true if Alpha_Type is kOpaque_SkAlphaType.
+
+Returns true if Alpha_Type is set to hint that all pixels are opaque; their
+Color_Alpha value is implicitly or explicitly 1.0. If true, and all pixels are
+not opaque, Skia may draw incorrectly.
+
Does not check if Color_Type allows Alpha, or if any pixel value has
transparency.
-#Return true if Image_Info describes opaque Alpha ##
+#Return true if Image_Info Alpha_Type is kOpaque_SkAlphaType ##
#Example
#Description
@@ -1292,7 +1308,7 @@ Returns IRect { 0, 0, width(), height() }.
#Return integral rectangle from origin to width() and height() ##
#Example
-#Height 128
+#Height 64
#Image 4
canvas->scale(.5f, .5f);
SkIRect bounds = source.bounds();
@@ -2544,7 +2560,8 @@ one of: getAddr8, getAddr16, or getAddr32.
#Image 3
char* row0 = (char* ) source.getAddr(0, 0);
char* row1 = (char* ) source.getAddr(0, 1);
- SkDebugf("addr interval %c= rowBytes\n", row1 - row0 == source.rowBytes() ? '=' : '!');
+ SkDebugf("addr interval %c= rowBytes\n",
+ (size_t) (row1 - row0) == source.rowBytes() ? '=' : '!');
#StdOut
addr interval == rowBytes
##
@@ -3287,28 +3304,27 @@ Pixel_Ref. Sets offset to top-left position for dst for alignment with Bitmap;
#Bug 7103
#Example
#Height 160
- auto radiusToSigma = [](SkScalar radius) -> SkScalar {
- static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;
- return radius > 0 ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f;
- };
- SkBitmap alpha, bitmap;
- bitmap.allocN32Pixels(100, 100);
- SkCanvas offscreen(bitmap);
- offscreen.clear(0);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(SK_ColorBLUE);
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(20);
- offscreen.drawCircle(50, 50, 39, paint);
- offscreen.flush();
- paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, radiusToSigma(25),
- SkBlurMaskFilter::kHighQuality_BlurFlag));
- SkIPoint offset;
- bitmap.extractAlpha(&alpha, &paint, &offset);
- paint.setColor(SK_ColorRED);
- canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
- canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
+ auto radiusToSigma = [](SkScalar radius) -> SkScalar {
+ static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;
+ return radius > 0 ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f;
+ };
+ SkBitmap alpha, bitmap;
+ bitmap.allocN32Pixels(100, 100);
+ SkCanvas offscreen(bitmap);
+ offscreen.clear(0);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setColor(SK_ColorBLUE);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(20);
+ offscreen.drawCircle(50, 50, 39, paint);
+ offscreen.flush();
+ paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, radiusToSigma(25)));
+ SkIPoint offset;
+ bitmap.extractAlpha(&alpha, &paint, &offset);
+ paint.setColor(SK_ColorRED);
+ canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
+ canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
##
#SeeAlso extractSubset
@@ -3350,7 +3366,7 @@ mask.
paint.setStrokeWidth(20);
offscreen.drawCircle(50, 50, 39, paint);
offscreen.flush();
- paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3));
+ paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));
SkIPoint offset;
bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);
paint.setColor(SK_ColorRED);
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index a43b5fc172..de33770122 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -4529,7 +4529,7 @@ void draw(SkCanvas* canvas) {
bitmap.installPixels(SkImageInfo::MakeA8(8, 8),
(void*) pixels, sizeof(pixels[0]));
SkPaint paint;
- paint.setMaskFilter(SkBlurMaskFilter::Make(kSolid_SkBlurStyle, 6));
+ paint.setMaskFilter(SkMaskFilter::MakeBlur(kSolid_SkBlurStyle, 6));
for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xFF007F00} ) {
paint.setColor(color);
canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(32, 32), &paint);
@@ -4972,14 +4972,6 @@ void draw(SkCanvas* canvas) {
}
left = right;
}
- const int xDivs[] = { center.fLeft, center.fRight };
- const int yDivs[] = { center.fTop, center.fBottom };
- SkCanvas::Lattice::RectType fillTypes[3][3];
- memset(fillTypes, 0, sizeof(fillTypes));
- fillTypes[1][1] = SkCanvas::Lattice::kTransparent;
- SkColor dummy[9]; // temporary pending bug fix
- SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),
- SK_ARRAY_COUNT(yDivs), nullptr, dummy };
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
SkImage* imagePtr = image.get();
for (auto dest: { 20, 30, 40, 60, 90 } ) {
@@ -5509,7 +5501,6 @@ void draw(SkCanvas* canvas) {
recordingCanvas->scale(1.2f, 1.4f);
}
sk_sp<SkPicture> playback = recorder.finishRecordingAsPicture();
- const SkPicture* playbackPtr = playback.get();
canvas->drawPicture(playback);
canvas->scale(2, 2);
canvas->translate(50, 0);
diff --git a/docs/SkIPoint_Reference.bmh b/docs/SkIPoint_Reference.bmh
index 11a6cdcd1d..66f04e5a5d 100644
--- a/docs/SkIPoint_Reference.bmh
+++ b/docs/SkIPoint_Reference.bmh
@@ -176,7 +176,7 @@ Returns IPoint changing the signs of fX and fY.
#Example
SkIPoint test[] = { {0, -0}, {-1, -2},
{ SK_MaxS32, SK_MinS32 },
- { SK_NaN32, -SK_NaN32 } };
+ { SK_NaN32, SK_NaN32 } };
for (const SkIPoint& pt : test) {
SkIPoint negPt = -pt;
SkDebugf("pt: %d, %d negate: %d, %d\n", pt.fX, pt.fY, negPt.fX, negPt.fY);
diff --git a/docs/SkIRect_Reference.bmh b/docs/SkIRect_Reference.bmh
index 0d7924ce07..7c79c552b1 100644
--- a/docs/SkIRect_Reference.bmh
+++ b/docs/SkIRect_Reference.bmh
@@ -1489,9 +1489,10 @@ Asserts if either a or b is empty, and if SK_DEBUG is defined.
#Example
SkIRect result;
- bool intersected = result.intersectNoEmptyCheck({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });
- SkDebugf("intersection: %d, %d, %d, %d\n",
- result.left(), result.top(), result.right(), result.bottom());
+ if (result.intersectNoEmptyCheck({ 10, 40, 50, 80 }, { 30, 60, 70, 90 })) {
+ SkDebugf("intersection: %d, %d, %d, %d\n",
+ result.left(), result.top(), result.right(), result.bottom());
+ }
#StdOut
intersection: 30, 60, 50, 80
##
diff --git a/docs/SkImageInfo_Reference.bmh b/docs/SkImageInfo_Reference.bmh
index e2dbc4ae1a..caa54b8731 100644
--- a/docs/SkImageInfo_Reference.bmh
+++ b/docs/SkImageInfo_Reference.bmh
@@ -27,6 +27,11 @@ but Image and Surface may not contain Image_Info.
#Alias Alpha_Type
#Alias Alpha_Types
+#PhraseDef list_of_alpha_types
+kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+kUnpremul_SkAlphaType
+##
+
#Enum SkAlphaType
#Line # encoding for pixel transparency ##
@@ -162,6 +167,7 @@ Some drawing destinations may not support Unpremul.
#Bug 7079
#Example
+#Height 64
#Description
SkColorSetARGB parameter a is set to 150, less than its maximum value, and is
interpreted as Color_Alpha of about 0.6. color is not premultiplied;
@@ -449,7 +455,7 @@ the platform at compile time.
#Subtopic RGB_888x
RGB_888x is a 32-bit word pixel encoding that contains eight bits of red,
-eight bits of green, eight bits of blue, and eight unused bits. RGB_888x is fully
+eight bits of green, eight bits of blue, and eight unused bits. RGB_888x is fully
opaque as if its Color_Alpha was set to one, and should always be paired with
kOpaque_SkAlphaType.
@@ -587,6 +593,11 @@ less than 3, the drawn result is undefined.
#Subtopic RGB_101010x
+RGB_101010x is a 32-bit word pixel encoding that contains ten bits of red,
+ten bits of green, ten bits of blue, and two unused bits. RGB_101010x is fully
+opaque as if its Color_Alpha was set to one, and should always be paired with
+kOpaque_SkAlphaType.
+
#Illustration
#Example
@@ -619,6 +630,11 @@ less than 3, the drawn result is undefined.
#Subtopic Gray_8
+Gray_8 is an 8-bit byte pixel encoding that represents equal values for red,
+blue, and green, reprsenting colors from black to white. Gray_8 is fully
+opaque as if its Color_Alpha was set to one, and should always be paired with
+kOpaque_SkAlphaType.
+
#Example
#Height 64
canvas->scale(16, 16);
@@ -638,8 +654,28 @@ less than 3, the drawn result is undefined.
#Subtopic RGBA_F16
+RGBA_F16 is a 64-bit word pixel encoding that contains sixteen bits of blue,
+sixteen bits of green, sixteen bits of red, and sixteen bits of alpha.
+
+Each component encodes a floating point value using
+#A Half floats # https://www.khronos.org/opengl/wiki/Small_Float_Formats ##
+. Meaningful colors are represented by the range 0.0 to 1.0, although smaller
+and larger values may be useful when used in combination with Transfer_Mode.
+
#Illustration
+If paired with kPremul_SkAlphaType: blue, green, and red components are
+premultiplied by the alpha value. If blue, green, or red is greater than alpha,
+the drawn result is undefined.
+
+If paired with kUnpremul_SkAlphaType: blue, green, red, and alpha components
+may have any value. There may be a performance penalty with unpremultipled
+pixels.
+
+If paired with kOpaque_SkAlphaType: all alpha component values are at the maximum;
+blue, green, and red components are fully opaque. If any alpha component is
+less than 255, the drawn result is undefined.
+
#ToDo
FloatToHalf should be replaced with SkFloatToHalf if/when that's made public
##
@@ -701,6 +737,136 @@ void draw(SkCanvas* canvas) {
#Subtopic Color_Type ##
# ------------------------------------------------------------------------------
+
+#Method int SkColorTypeBytesPerPixel(SkColorType ct)
+#In Property
+#Line # returns Color_Type byte size ##
+
+Returns the number of bytes required to store a pixel, including unused padding.
+Returns zero if ct is kUnknown_SkColorType or invalid.
+
+#Param ct one of: #list_of_color_types#
+##
+
+#Return bytes per pixel ##
+
+#Example
+#Height 192
+ const char* colors[] = { "Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
+ "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16" };
+ SkPaint paint;
+ paint.setTypeface(SkTypeface::MakeFromName("monospace", SkFontStyle()));
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ int y = 15;
+ canvas->drawString(" colorType bytes", 10, y, paint);
+ for (SkColorType colorType : { #list_of_color_types#
+ } ) {
+ int result = SkColorTypeBytesPerPixel(colorType);
+ SkString string;
+ string.printf("%13s %4d", colors[(int) colorType], result);
+ canvas->drawString(string, 10, y += 14, paint);
+ }
+##
+#SeeAlso SkImageInfo::bytesPerPixel
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
+#In Property
+#Line # returns if Color_Type includes Color_Alpha ##
+
+Returns true if Color_Type always decodes Color_Alpha to 1.0, making the pixel
+fully opaque. If true, Color_Type does not reserve bits to encode Color_Alpha.
+
+#Param ct one of: #list_of_color_types#
+##
+
+#Return true if Color_Alpha is always set to 1.0 ##
+
+#Example
+#Height 192
+ const char* colors[] = { "Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
+ "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16" };
+ SkPaint paint;
+ paint.setTypeface(SkTypeface::MakeFromName("monospace", SkFontStyle()));
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ int y = 15;
+ canvas->drawString(" colorType bytes", 10, y, paint);
+ for (SkColorType colorType : { #list_of_color_types#
+ } ) {
+ bool result = SkColorTypeIsAlwaysOpaque(colorType);
+ SkString string;
+ string.printf("%13s %6s", colors[(int) colorType], result ? "true" : "false");
+ canvas->drawString(string, 10, y += 14, paint);
+ }
+##
+#SeeAlso SkColorTypeValidateAlphaType
+##
+
+# ------------------------------------------------------------------------------
+
+#Method bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
+ SkAlphaType* canonical = nullptr)
+#In Property
+#Line # returns if Alpha_Type is valid ##
+
+Returns true if canonical can be set to a valid Alpha_Type for colorType. If
+there is more than one valid canonical Alpha_Type, set to alphaType, if valid.
+If true is returned and canonical is not nullptr, store valid Alpha_Type.
+
+Returns false only if alphaType is kUnknown_SkAlphaType, color type is not
+kUnknown_SkColorType, and Color_Type is not always opaque. If false is returned,
+canonical is ignored.
+
+For kUnknown_SkColorType: set canonical to kUnknown_SkAlphaType and return true.
+For kAlpha_8_SkColorType: set canonical to kPremul_SkAlphaType or
+kOpaque_SkAlphaType and return true if alphaType is not kUnknown_SkAlphaType.
+For kRGB_565_SkColorType, kRGB_888x_SkColorType, kRGB_101010x_SkColorType, and
+kGray_8_SkColorType: set canonical to kOpaque_SkAlphaType and return true.
+For kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+kRGBA_1010102_SkColorType, and kRGBA_F16_SkColorType: set canonical to alphaType
+and return true if alphaType is not kUnknown_SkAlphaType.
+
+#Param colorType one of: #list_of_color_types#
+##
+#Param alphaType one of: #list_of_alpha_types#
+##
+#Param canonical storage for Alpha_Type ##
+
+#Return true if valid Alpha_Type can be associated with colorType ##
+
+#Example
+#Height 640
+ const char* colors[] = { "Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
+ "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16" };
+ const char* alphas[] = {"Unknown ", "Opaque ", "Premul ", "Unpremul"};
+ SkAlphaType alphaTypes[] = { #list_of_alpha_types#
+ };
+ SkPaint paint;
+ paint.setTypeface(SkTypeface::MakeFromName("monospace", SkFontStyle()));
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ int y = 15;
+ canvas->drawString(" colorType alphaType canonical", 10, y, paint);
+ for (SkColorType colorType : { #list_of_color_types#
+ } ) {
+ for (SkAlphaType alphaType : alphaTypes) {
+ SkAlphaType canonicalAlphaType = kUnknown_SkAlphaType;
+ bool result = SkColorTypeValidateAlphaType(colorType, alphaType, &canonicalAlphaType);
+ SkString string;
+ string.printf("%13s %10s %10s", colors[(int) colorType], alphas[(int) alphaType],
+ result ? alphas[(int) canonicalAlphaType] : "------ ");
+ canvas->drawString(string, 10, y += 14, paint);
+ }
+ }
+##
+#SeeAlso SkColorTypeIsAlwaysOpaque
+##
+
+# ------------------------------------------------------------------------------
#Subtopic YUV_ColorSpace
#Alias YUV_ColorSpace
#Enum SkYUVColorSpace
@@ -739,30 +905,6 @@ range. See http://en.wikipedia.org/wiki/Rec._709 for details.
#Subtopic YUV_ColorSpace ##
# ------------------------------------------------------------------------------
-#EnumClass SkDestinationSurfaceColorMode
-#Line # incomplete ##
-
-#Code
- enum class SkDestinationSurfaceColorMode {
- kLegacy,
- kGammaAndColorSpaceAware,
- };
-##
-
-#Const kLegacy 0
-##
-#Const kGammaAndColorSpaceAware 1
-##
-
-#Example
-// incomplete
-##
-
-#SeeAlso incomplete
-
-#EnumClass SkDestinationSurfaceColorMode ##
-
-# ------------------------------------------------------------------------------
#Struct SkImageInfo
@@ -806,7 +948,7 @@ for the Canvas actual Image_Info.
SkImageInfo imageInfo;
size_t rowBytes;
SkIPoint origin;
- uint32_t* access = (uint32_t*) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);
+ (void) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);
const char* alphaType[] = { "Unknown", "Opaque", "Premul", "Unpremul" };
SkString string;
string.printf("k%s_SkAlphaType", alphaType[(int) imageInfo.alphaType()]);
@@ -837,8 +979,7 @@ combination is supported.
#Param height pixel row count; must be zero or greater ##
#Param ct one of: #list_of_color_types#
##
-#Param at one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
- kUnpremul_SkAlphaType
+#Param at one of: #list_of_alpha_types#
##
#Param cs range of colors; may be nullptr ##
@@ -881,8 +1022,7 @@ combination is supported.
#Param width pixel column count; must be zero or greater ##
#Param height pixel row count; must be zero or greater ##
-#Param at one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
- kUnpremul_SkAlphaType
+#Param at one of: #list_of_alpha_types#
##
#Param cs range of colors; may be nullptr ##
@@ -918,8 +1058,7 @@ combination is supported.
#Param width pixel column count; must be zero or greater ##
#Param height pixel row count; must be zero or greater ##
-#Param at one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
- kUnpremul_SkAlphaType
+#Param at one of: #list_of_alpha_types#
##
#Return created Image_Info ##
@@ -1049,7 +1188,25 @@ kPremul_SkAlphaType, with Color_Space set to nullptr.
#Return created Image_Info ##
#Example
-// incomplete
+#Height 64
+ uint8_t pixels[][8] = { { 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00},
+ { 0x00, 0x7f, 0xff, 0x3f, 0x3f, 0x7f, 0x3f, 0x00},
+ { 0x3f, 0xff, 0x7f, 0x00, 0x7f, 0xff, 0x7f, 0x00},
+ { 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x7f, 0x3f, 0x00},
+ { 0x3f, 0x7f, 0x7f, 0x3f, 0x00, 0x00, 0x00, 0x00},
+ { 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x3f, 0x7f, 0x3f},
+ { 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x7f, 0xff, 0x7f},
+ { 0x3f, 0x7f, 0x7f, 0x3f, 0x00, 0x3f, 0x7f, 0x3f} };
+ SkBitmap bitmap;
+ bitmap.installPixels(SkImageInfo::MakeA8(8, 8),
+ (void*) pixels, sizeof(pixels[0]));
+ SkPaint paint;
+ canvas->scale(4, 4);
+ for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xFF007F00} ) {
+ paint.setColor(color);
+ canvas->drawBitmap(bitmap, 0, 0, &paint);
+ canvas->translate(12, 0);
+ }
##
#SeeAlso MakeN32 MakeS32 Make
@@ -1177,16 +1334,22 @@ Returns pixel row count.
#Method SkColorType colorType() const
#In Property
-#Line # incomplete ##
+#Line # returns Color_Type ##
Returns Color_Type, one of: #list_of_color_types#.
#Return Color_Type ##
#Example
-// incomplete
+ const char* colors[] = {"Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
+ "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16"};
+ SkImageInfo info = SkImageInfo::MakeA8(16, 32);
+ SkDebugf("color type: k" "%s" "_SkColorType\n", colors[info.colorType()]);
+#StdOut
+color type: kAlpha_8_SkColorType
+##
##
-#SeeAlso incomplete
+#SeeAlso alphaType SkPixmap::colorType SkBitmap::colorType
#Method ##
@@ -1194,14 +1357,21 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method SkAlphaType alphaType() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # Returns Alpha_Type ##
+Returns Alpha_Type, one of: #list_of_alpha_types#.
+
+#Return Alpha_Type ##
#Example
-// incomplete
+ const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
+ SkImageInfo info = SkImageInfo::MakeA8(16, 32);
+ SkDebugf("alpha type: k" "%s" "_SkAlphaType\n", alphas[info.alphaType()]);
+#StdOut
+alpha type: kPremul_SkAlphaType
+##
##
-#SeeAlso incomplete
+#SeeAlso colorType SkPixmap::alphaType SkBitmap::alphaType
#Method ##
@@ -1209,14 +1379,30 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method SkColorSpace* colorSpace() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns Color_Space ##
+Returns Color_Space, the range of colors. The reference count of
+Color_Space is unchanged. The returned Color_Space is immutable.
+
+#Return Color_Space, or nullptr ##
#Example
-// incomplete
+#Description
+SkColorSpace::MakeSRGBLinear creates Color_Space with linear gamma
+and an sRGB gamut. This Color_Space gamma is not close to sRGB gamma.
+##
+ SkImageInfo info = SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ SkColorSpace::MakeSRGBLinear());
+ SkColorSpace* colorSpace = info.colorSpace();
+ SkDebugf("gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\n",
+ colorSpace->gammaCloseToSRGB() ? "true" : "false",
+ colorSpace->gammaIsLinear() ? "true" : "false",
+ colorSpace->isSRGB() ? "true" : "false");
+#StdOut
+gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
+##
##
-#SeeAlso incomplete
+#SeeAlso Color_Space SkPixmap::colorSpace SkBitmap::colorSpace
#Method ##
@@ -1224,14 +1410,28 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method sk_sp<SkColorSpace> refColorSpace() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns Color_Space ##
+Returns smart pointer to Color_Space, the range of colors. The smart pointer
+tracks the number of objects sharing this Color_Space reference so the memory
+is released when the owners destruct.
+
+The returned Color_Space is immutable.
+
+#Return Color_Space wrapped in a smart pointer ##
#Example
-// incomplete
+ SkImageInfo info1 = SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ SkColorSpace::MakeSRGBLinear());
+ SkImageInfo info2 = SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,
+ info1.refColorSpace());
+ SkColorSpace* colorSpace = info2.colorSpace();
+ SkDebugf("gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\n",
+ colorSpace->gammaCloseToSRGB() ? "true" : "false",
+ colorSpace->gammaIsLinear() ? "true" : "false",
+ colorSpace->isSRGB() ? "true" : "false");
##
-#SeeAlso incomplete
+#SeeAlso Color_Space SkBitmap::refColorSpace
#Method ##
@@ -1239,14 +1439,30 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method bool isEmpty() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns if dimensions contain pixels ##
+
+Returns if Image_Info describes an empty area of pixels by checking if either
+width or height is zero or smaller.
+
+#Return true if either dimension is zero or smaller ##
#Example
-// incomplete
+ for (int width : { 0, 2 } ) {
+ for (int height : { 0, 2 } ) {
+ SkImageInfo imageInfo= SkImageInfo::MakeA8(width, height);
+ SkDebugf("width: %d height: %d empty: %s\n", width, height,
+ imageInfo.isEmpty() ? "true" : "false");
+ }
+ }
+#StdOut
+width: 0 height: 0 empty: true
+width: 0 height: 2 empty: true
+width: 2 height: 0 empty: true
+width: 2 height: 2 empty: false
+##
##
-#SeeAlso incomplete
+#SeeAlso dimensions bounds SkBitmap::empty SkPixmap::bounds
#Method ##
@@ -1254,14 +1470,41 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method bool isOpaque() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns if Alpha_Type is kOpaque_SkAlphaType ##
+
+Returns true if Alpha_Type is set to hint that all pixels are opaque; their
+Color_Alpha value is implicitly or explicitly 1.0. If true, and all pixels are
+not opaque, Skia may draw incorrectly.
+
+Does not check if Color_Type allows Alpha, or if any pixel value has
+transparency.
+
+#Return true if Alpha_Type is kOpaque_SkAlphaType ##
#Example
-// incomplete
+ const int height = 2;
+ const int width = 2;
+ SkBitmap bitmap;
+ SkImageInfo imageInfo = SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);
+ bitmap.setInfo(imageInfo);
+ for (int index = 0; index < 2; ++index) {
+ bitmap.allocPixels();
+ bitmap.eraseColor(0x00000000);
+ SkDebugf("isOpaque: %s\n", imageInfo.isOpaque() ? "true" : "false");
+ bitmap.eraseColor(0xFFFFFFFF);
+ SkDebugf("isOpaque: %s\n", imageInfo.isOpaque() ? "true" : "false");
+ imageInfo = imageInfo.makeAlphaType(kOpaque_SkAlphaType);
+ bitmap.setInfo(imageInfo);
+ }
+#StdOut
+isOpaque: false
+isOpaque: false
+isOpaque: true
+isOpaque: true
+##
##
-#SeeAlso incomplete
+#SeeAlso Color_Alpha SkColorTypeValidateAlphaType SkBitmap::isOpaque SkImage::isOpaque SkPixmap::isOpaque
#Method ##
@@ -1269,14 +1512,26 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method SkISize dimensions() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns width() and height() ##
+
+Returns ISize { width(), height() }.
+
+#Return integral size of width() and height() ##
#Example
-// incomplete
+ const int height = 2;
+ const int width = 2;
+ SkImageInfo imageInfo = SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);
+ SkISize dimensions = imageInfo.dimensions();
+ SkIRect bounds = imageInfo.bounds();
+ SkIRect dimensionsAsBounds = SkIRect::MakeSize(dimensions);
+ SkDebugf("dimensionsAsBounds %c= bounds\n", dimensionsAsBounds == bounds ? '=' : '!');
+#StdOut
+dimensionsAsBounds == bounds
+##
##
-#SeeAlso incomplete
+#SeeAlso width height bounds SkBitmap::dimensions
#Method ##
@@ -1284,14 +1539,25 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method SkIRect bounds() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns width() and height() as Rectangle ##
+Returns IRect { 0, 0, width(), height() }.
+
+#Return integral rectangle from origin to width() and height() ##
#Example
-// incomplete
+#Height 64
+#Image 4
+ canvas->scale(.5f, .5f);
+ SkImageInfo imageInfo = source.info();
+ SkIRect bounds = imageInfo.bounds();
+ for (int x : { 0, bounds.width() } ) {
+ for (int y : { 0, bounds.height() } ) {
+ canvas->drawBitmap(source, x, y);
+ }
+ }
##
-#SeeAlso incomplete
+#SeeAlso width height dimensions
#Method ##
@@ -1299,14 +1565,48 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method bool gammaCloseToSRGB() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # Returns if Color_Space gamma is approximately the same as sRGB ##
+
+Returns true if associated Color_Space is not nullptr, and Color_Space gamma
+is approximately the same as sRGB.
+This includes the
+###$
+$A sRGB transfer function $ https://en.wikipedia.org/wiki/SRGB#The_sRGB_transfer_function_(%22gamma%22) $$
+$$$#
+as well as a gamma curve described by a 2.2 exponent.
+
+#Return true if Color_Space gamma is approximately the same as sRGB ##
#Example
-// incomplete
+#Height 144
+ const int width = 256;
+ const int height = 64;
+ auto drawLabel = [=](const char* what, bool closeToSRGB) -> void {
+ SkString string;
+ string.printf("%s gamma is %s" "close to sRGB", what, closeToSRGB ? "" : "not ");
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString(string, width / 2, 56, paint);
+ };
+ SkColor gradColors[] = { 0xFFFF7F00, 0xFF00FF7F, 0xFF0000FF, 0xFF7F7FFF };
+ SkPoint gradPoints[] = { { 0, 0 }, { width, 0 }, { width * 2, 0 }, { width * 3, 0 } };
+ SkPaint gradPaint;
+ gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
+ SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
+ canvas->drawRect(SkRect::MakeWH(width, height), gradPaint);
+ drawLabel("canvas", canvas->imageInfo().gammaCloseToSRGB());
+ SkBitmap bitmap;
+ SkImageInfo offscreenInfo = SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType);
+ bitmap.allocPixels(offscreenInfo);
+ SkCanvas sRGBOffscreen(bitmap);
+ sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
+ canvas->translate(0, 80);
+ canvas->drawBitmap(bitmap, 0, 0);
+ drawLabel("offscreen", offscreenInfo.gammaCloseToSRGB());
##
-#SeeAlso incomplete
+#SeeAlso SkColorSpace::gammaCloseToSRGB
#Method ##
@@ -1315,19 +1615,30 @@ Returns Color_Type, one of: #list_of_color_types#.
#Method SkImageInfo makeWH(int newWidth, int newHeight) const
#In Constructor
#Line # creates Image_Info with changed dimensions ##
-Creates Image_Info with the same Color_Type and Alpha_Type as this info,
-but with the specified width and height.
+Creates Image_Info with the same Color_Type, Color_Space, and Alpha_Type,
+with dimensions set to width and height.
-#Param newWidth incomplete ##
-#Param newHeight incomplete ##
+#Param newWidth pixel column count; must be zero or greater ##
+#Param newHeight pixel row count; must be zero or greater ##
-#Return incomplete ##
+#Return created Image_Info ##
#Example
-// incomplete
-##
-
-#SeeAlso incomplete
+#Height 144
+#Image 3
+ SkImageInfo canvasImageInfo = canvas->imageInfo();
+ SkRect canvasBounds = SkRect::Make(canvasImageInfo.bounds());
+ canvas->drawBitmapRect(source, source.bounds(), canvasBounds, nullptr);
+ SkImageInfo insetImageInfo =
+ canvasImageInfo.makeWH(canvasBounds.width() / 2, canvasBounds.height() / 2);
+ SkBitmap inset;
+ inset.allocPixels(insetImageInfo);
+ SkCanvas offscreen(inset);
+ offscreen.drawBitmapRect(source, source.bounds(), SkRect::Make(inset.bounds()), nullptr);
+ canvas->drawBitmap(inset, canvasBounds.width() / 4, canvasBounds.height() / 4);
+##
+
+#SeeAlso Make makeAlphaType makeColorSpace makeColorType
#Method ##
@@ -1336,15 +1647,43 @@ but with the specified width and height.
#Method SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
#In Constructor
#Line # creates Image_Info with changed Alpha_Type ##
-#Param newAlphaType incomplete ##
+Creates Image_Info with same Color_Type, Color_Space, width, and height,
+with Alpha_Type set to newAlphaType.
-#Return incomplete ##
+Created Image_Info contains newAlphaType even if it is incompatible with
+Color_Type, in which case Alpha_Type in Image_Info is ignored.
+
+#Param newAlphaType one of: #list_of_alpha_types#
+##
+
+#Return created Image_Info ##
#Example
-// incomplete
+#Image 3
+ const int width = 256;
+ const int height = 128;
+ SkColor pixels[height][width];
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ int red = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 4 + y) * 0.03f)));
+ int blue = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 3 + y) * 0.04f)));
+ int green = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 2 + y) * 0.05f)));
+ int alpha = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 1 + y) * 0.006f)));
+ pixels[y][x] =
+ SkColorSetARGB(alpha, red * alpha / 255, green * alpha / 255, blue * alpha / 255);
+ }
+ }
+ SkBitmap bitmap;
+ SkImageInfo info = SkImageInfo::Make(width, height, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
+ bitmap.installPixels(info, (void*) pixels, sizeof(SkColor) * width);
+ canvas->drawBitmap(source, 0, 0);
+ canvas->drawBitmap(bitmap, 0, 0);
+ SkImageInfo unpremulInfo = info.makeAlphaType(kUnpremul_SkAlphaType);
+ bitmap.installPixels(unpremulInfo, (void*) pixels, sizeof(SkColor) * width);
+ canvas->drawBitmap(bitmap, 0, 128);
##
-#SeeAlso incomplete
+#SeeAlso Make MakeA8 makeColorType makeColorSpace
#Method ##
@@ -1353,15 +1692,39 @@ but with the specified width and height.
#Method SkImageInfo makeColorType(SkColorType newColorType) const
#In Constructor
#Line # creates Image_Info with changed Color_Type ##
-#Param newColorType incomplete ##
+Creates Image_Info with same Alpha_Type, Color_Space, width, and height,
+with Color_Type set to newColorType.
-#Return incomplete ##
+#Param newColorType one of: #list_of_color_types#
+##
+
+#Return created Image_Info ##
#Example
-// incomplete
+ const int width = 256;
+ const int height = 128;
+ SkColor pixels[height][width];
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ int red = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 4 + y) * 0.03f)));
+ int blue = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 3 + y) * 0.04f)));
+ int green = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 2 + y) * 0.05f)));
+ int alpha = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 1 + y) * 0.006f)));
+ pixels[y][x] =
+ SkColorSetARGB(alpha, red * alpha / 255, green * alpha / 255, blue * alpha / 255);
+ }
+ }
+ SkBitmap bitmap;
+ SkImageInfo info = SkImageInfo::Make(width, height, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
+ bitmap.installPixels(info, (void*) pixels, sizeof(SkColor) * width);
+ canvas->drawBitmap(source, 0, 0);
+ canvas->drawBitmap(bitmap, 0, 0);
+ SkImageInfo rgbaInfo = info.makeColorType(kRGBA_8888_SkColorType);
+ bitmap.installPixels(rgbaInfo, (void*) pixels, sizeof(SkColor) * width);
+ canvas->drawBitmap(bitmap, 0, 128);
##
-#SeeAlso incomplete
+#SeeAlso Make makeAlphaType makeColorSpace
#Method ##
@@ -1370,15 +1733,51 @@ but with the specified width and height.
#Method SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const
#In Constructor
#Line # creates Image_Info with changed Color_Space ##
-#Param cs incomplete ##
+Creates Image_Info with same Alpha_Type, Color_Type, width, and height,
+with Color_Space set to cs.
-#Return incomplete ##
+#Param cs range of colors; may be nullptr ##
+
+#Return created Image_Info ##
#Example
-// incomplete
+#Height 224
+ const int width = 256;
+ const int height = 64;
+ auto drawLabel = [=](const char* what, bool closeToSRGB) -> void {
+ SkString string;
+ string.printf("%s gamma is %s" "close to sRGB", what, closeToSRGB ? "" : "not ");
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString(string, width / 2, 56, paint);
+ };
+ SkColor gradColors[] = { 0xFFFF7F00, 0xFF00FF7F, 0xFF0000FF, 0xFF7F7FFF };
+ SkPoint gradPoints[] = { { 0, 0 }, { width, 0 }, { width * 2, 0 }, { width * 3, 0 } };
+ SkPaint gradPaint;
+ gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
+ SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
+ canvas->drawRect(SkRect::MakeWH(width, height), gradPaint);
+ drawLabel("canvas", canvas->imageInfo().gammaCloseToSRGB());
+ SkBitmap bitmap;
+ SkImageInfo offscreenInfo = SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType);
+ bitmap.allocPixels(offscreenInfo);
+ SkCanvas sRGBOffscreen(bitmap);
+ sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
+ canvas->translate(0, 80);
+ canvas->drawBitmap(bitmap, 0, 0);
+ drawLabel("offscreen", offscreenInfo.gammaCloseToSRGB());
+ SkImageInfo linearGamma =
+ offscreenInfo.makeColorSpace(offscreenInfo.colorSpace()->makeLinearGamma());
+ bitmap.allocPixels(linearGamma);
+ SkCanvas lgOffscreen(bitmap);
+ lgOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
+ canvas->translate(0, 80);
+ canvas->drawBitmap(bitmap, 0, 0);
+ drawLabel("linear", linearGamma.gammaCloseToSRGB());
##
-#SeeAlso incomplete
+#SeeAlso Make MakeS32 makeAlphaType makeColorType
#Method ##
@@ -1386,14 +1785,38 @@ but with the specified width and height.
#Method int bytesPerPixel() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns number of bytes in pixel based on Color_Type ##
+Returns number of bytes per pixel required by Color_Type.
+Returns zero if colorType( is kUnknown_SkColorType.
+
+#Return bytes in pixel ##
#Example
-// incomplete
+ const char* colors[] = {"Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
+ "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16"};
+ for (SkColorType colorType : { #list_of_color_types#
+ } ) {
+ SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);
+ SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
+ colors[colorType], 13 - strlen(colors[colorType]), " ",
+ info.bytesPerPixel());
+ }
+#StdOut
+color: kUnknown_SkColorType bytesPerPixel: 0
+color: kAlpha_8_SkColorType bytesPerPixel: 1
+color: kRGB_565_SkColorType bytesPerPixel: 2
+color: kARGB_4444_SkColorType bytesPerPixel: 2
+color: kRGBA_8888_SkColorType bytesPerPixel: 4
+color: kRGB_888x_SkColorType bytesPerPixel: 4
+color: kBGRA_8888_SkColorType bytesPerPixel: 4
+color: kRGBA_1010102_SkColorType bytesPerPixel: 4
+color: kRGB_101010x_SkColorType bytesPerPixel: 4
+color: kGray_8_SkColorType bytesPerPixel: 1
+color: kRGBA_F16_SkColorType bytesPerPixel: 8
+##
##
-#SeeAlso incomplete
+#SeeAlso width shiftPerPixel SkBitmap::bytesPerPixel
#Method ##
@@ -1401,11 +1824,35 @@ but with the specified width and height.
#Method int shiftPerPixel() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns bit shift from pixels to bytes ##
+Returns bit shift converting row bytes to row pixels.
+Returns zero for kUnknown_SkColorType.
+
+#Return one of: 0, 1, 2, 3; left shift to convert pixels to bytes ##
#Example
-// incomplete
+ const char* colors[] = {"Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
+ "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16"};
+ for (SkColorType colorType : { #list_of_color_types#
+ } ) {
+ SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);
+ SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
+ colors[colorType], 14 - strlen(colors[colorType]), " ",
+ info.shiftPerPixel());
+ }
+#StdOut
+color: kUnknown_SkColorType shiftPerPixel: 0
+color: kAlpha_8_SkColorType shiftPerPixel: 0
+color: kRGB_565_SkColorType shiftPerPixel: 1
+color: kARGB_4444_SkColorType shiftPerPixel: 1
+color: kRGBA_8888_SkColorType shiftPerPixel: 2
+color: kRGB_888x_SkColorType shiftPerPixel: 2
+color: kBGRA_8888_SkColorType shiftPerPixel: 2
+color: kRGBA_1010102_SkColorType shiftPerPixel: 2
+color: kRGB_101010x_SkColorType shiftPerPixel: 2
+color: kGray_8_SkColorType shiftPerPixel: 0
+color: kRGBA_F16_SkColorType shiftPerPixel: 3
+##
##
#SeeAlso incomplete
@@ -1416,14 +1863,37 @@ but with the specified width and height.
#Method uint64_t minRowBytes64() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns width() times bytesPerPixel in 64 bits ##
+
+Returns minimum bytes per row, computed from pixel width() and Color_Type, which
+specifies bytesPerPixel(). Bitmap maximum value for row bytes must be representable
+as a positive value in a 32-bit signed integer.
+
+#Return width() times bytesPerPixel as unsigned 64-bit integer ##
#Example
-// incomplete
+ for (int shift = 24; shift < 32; ++shift) {
+ int width = 1 << shift;
+ SkImageInfo imageInfo =
+ SkImageInfo::Make(width, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
+ uint64_t minRowBytes = imageInfo.minRowBytes64();
+ bool widthTooLarge = (uint64_t) (int32_t) minRowBytes != minRowBytes;
+ SkDebugf("RGBA_F16 width %d (0x%08x) %s\n",
+ width, width, widthTooLarge ? "too large" : "OK");
+ }
+#StdOut
+RGBA_F16 width 16777216 (0x01000000) OK
+RGBA_F16 width 33554432 (0x02000000) OK
+RGBA_F16 width 67108864 (0x04000000) OK
+RGBA_F16 width 134217728 (0x08000000) OK
+RGBA_F16 width 268435456 (0x10000000) too large
+RGBA_F16 width 536870912 (0x20000000) too large
+RGBA_F16 width 1073741824 (0x40000000) too large
+RGBA_F16 width -2147483648 (0x80000000) too large
+##
##
-#SeeAlso incomplete
+#SeeAlso minRowBytes computeByteSize computeMinByteSize validRowBytes
#Method ##
@@ -1431,14 +1901,37 @@ but with the specified width and height.
#Method size_t minRowBytes() const
#In Property
-#Line # incomplete ##
-#Return incomplete ##
+#Line # returns width() times bytesPerPixel in 32 bits ##
+
+Returns minimum bytes per row, computed from pixel width() and Color_Type, which
+specifies bytesPerPixel(). Bitmap maximum value for row bytes must be representable
+as a positive value in a 32-bit signed integer.
+
+#Return width() times bytesPerPixel as signed 32-bit integer ##
#Example
-// incomplete
+ for (int shift = 24; shift < 32; ++shift) {
+ int width = 1 << shift;
+ SkImageInfo imageInfo =
+ SkImageInfo::Make(width, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
+ size_t minRowBytes = imageInfo.minRowBytes();
+ bool widthTooLarge = !minRowBytes;
+ SkDebugf("RGBA_F16 width %d (0x%08x) %s\n",
+ width, width, widthTooLarge ? "too large" : "OK");
+ }
+#StdOut
+RGBA_F16 width 16777216 (0x01000000) OK
+RGBA_F16 width 33554432 (0x02000000) OK
+RGBA_F16 width 67108864 (0x04000000) OK
+RGBA_F16 width 134217728 (0x08000000) OK
+RGBA_F16 width 268435456 (0x10000000) too large
+RGBA_F16 width 536870912 (0x20000000) too large
+RGBA_F16 width 1073741824 (0x40000000) too large
+RGBA_F16 width -2147483648 (0x80000000) too large
+##
##
-#SeeAlso incomplete
+#SeeAlso minRowBytes64 computeByteSize computeMinByteSize validRowBytes
#Method ##
@@ -1446,15 +1939,40 @@ but with the specified width and height.
#Method size_t computeOffset(int x, int y, size_t rowBytes) const
#In Utility
-#Line # incomplete ##
-#Param x incomplete ##
-#Param y incomplete ##
-#Param rowBytes incomplete ##
+#Line # returns byte offset within pixel array ##
-#Return incomplete ##
+Returns byte offset of pixel from pixel base address.
+
+Asserts in debug build if x or y is outside of bounds. Does not assert if
+rowBytes is smaller than minRowBytes, even though result may be incorrect.
+
+#Param x column index, zero or greater, and less than width() ##
+#Param y row index, zero or greater, and less than height() ##
+#Param rowBytes size of pixel row or larger ##
+
+#Return offset within pixel array ##
#Example
-// incomplete
+ uint8_t pixels[][12] = { { 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00},
+ { 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},
+ { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00},
+ { 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF},
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
+ { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00},
+ { 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00},
+ { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00} };
+ SkImageInfo imageInfo = SkImageInfo::MakeA8(8, 8);
+ SkBitmap bitmap;
+ bitmap.installPixels(imageInfo, (void*) pixels, sizeof(pixels[0]));
+ SkPaint paint;
+ paint.setColor(SK_ColorRED);
+ canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(32, 32), &paint);
+ size_t offset = imageInfo.computeOffset(2, 3, sizeof(pixels[0]));
+ pixels[0][offset] = 0x7F;
+ offset = imageInfo.computeOffset(5, 3, sizeof(pixels[0]));
+ pixels[0][offset] = 0x7F;
+ bitmap.installPixels(imageInfo, (void*) pixels, sizeof(pixels[0]));
+ canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(128, 128), &paint);
##
#SeeAlso incomplete
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh
index b94e4331b3..e5e16af1f1 100644
--- a/docs/SkImage_Reference.bmh
+++ b/docs/SkImage_Reference.bmh
@@ -394,8 +394,7 @@ Recognized formats vary by GPU back-end.
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
#Param colorType one of: #list_of_color_types#
##
-#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType
+#Param alphaType one of: #list_of_alpha_types#
##
#Param colorSpace range of colors; may be nullptr ##
@@ -449,8 +448,7 @@ Recognized formats vary by GPU back-end.
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
#Param colorType one of: #list_of_color_types#
##
-#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType
+#Param alphaType one of: #list_of_alpha_types#
##
#Param colorSpace range of colors; may be nullptr ##
#Param textureReleaseProc function called when texture can be released ##
@@ -613,8 +611,7 @@ Recognized formats vary by GPU back-end.
#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
#Param colorType one of: #list_of_color_types#
##
-#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType
+#Param alphaType one of: #list_of_alpha_types#
##
#Param colorSpace range of colors; may be nullptr ##
@@ -688,29 +685,7 @@ should this be moved to chrome only?
const SkISize yuvSizes[3],
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr)
-This version of MakeFromYUVTexturesCopy is over specified and should not be used.
-
-#Param context GPU_Context ##
-#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
- kRec709_SkYUVColorSpace
-##
-#Param yuvTextures array of YUV textures on GPU ##
-#Param yuvSizes dimensions of YUV textures ##
-#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
-#Param colorSpace range of colors; may be nullptr ##
-
-#Return created Image, or nullptr ##
-
-# seems too complicated to create an example for this
-#ToDo
-should this be moved to chrome only?
-##
-
-#NoExample
-##
-
-#SeeAlso MakeFromNV12TexturesCopy
-
+#Deprecated
#Method ##
# ------------------------------------------------------------------------------
@@ -723,12 +698,12 @@ should this be moved to chrome only?
#In Constructor
#Line # creates Image from YUV_ColorSpace data in three planes ##
-Creates Image from copy of nv12TextureHandles, an array of textures on GPU.
+Creates Image from copy of nv12Textures, an array of textures on GPU.
nv12Textures[0] contains pixels for YUV_Component_Y plane.
nv12Textures[1] contains pixels for YUV_Component_U plane,
followed by pixels for YUV_Component_V plane.
-Returned Image has the dimensions
-nv12Textures[2]. yuvColorSpace describes how YUV colors convert to RGB colors.
+Returned Image has the dimensions nv12Textures[2].
+yuvColorSpace describes how YUV colors convert to RGB colors.
#Param context GPU_Context ##
#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
@@ -760,30 +735,7 @@ should this be moved to chrome only?
const SkISize nv12Sizes[2],
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr)
-
-This version of MakeFromYUVTexturesCopy is over specified and should not be used.
-
-#Param context GPU_Context ##
-#Param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
- kRec709_SkYUVColorSpace
-##
-#Param nv12Textures array of YUV textures on GPU ##
-#Param nv12Sizes dimensions of YUV textures ##
-#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
-#Param colorSpace range of colors; may be nullptr ##
-
-#Return created Image, or nullptr ##
-
-# seems too complicated to create an example for this
-#ToDo
-should this be moved to chrome only?
-##
-
-#NoExample
-##
-
-#SeeAlso MakeFromYUVTexturesCopy
-
+#Deprecated
#Method ##
# ------------------------------------------------------------------------------
@@ -880,8 +832,7 @@ Returned Image takes a reference on the buffer.
Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
#Param hardwareBuffer AHardwareBuffer Android hardware buffer ##
-#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType
+#Param alphaType one of: #list_of_alpha_types#
##
#Param colorSpace range of colors; may be nullptr ##
@@ -954,6 +905,7 @@ Returns pixel row count.
#Method SkISize dimensions() const
#In Property
#Line # returns width() and height() ##
+
Returns ISize { width(), height() }.
#Return integral size of width() and height() ##
@@ -964,6 +916,9 @@ Returns ISize { width(), height() }.
SkIRect bounds = image->bounds();
SkIRect dimensionsAsBounds = SkIRect::MakeSize(dimensions);
SkDebugf("dimensionsAsBounds %c= bounds\n", dimensionsAsBounds == bounds ? '=' : '!');
+#StdOut
+dimensionsAsBounds == bounds
+##
##
#SeeAlso height() width() bounds()
@@ -1028,8 +983,7 @@ unique number.
#Method SkAlphaType alphaType() const
#In Property
#Line # returns Alpha_Type ##
-Returns Alpha_Type, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+Returns Alpha_Type, one of: #list_of_alpha_types#.
Alpha_Type returned was a parameter to an Image constructor,
or was parsed from encoded data.
@@ -1449,7 +1403,7 @@ for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {
backEndTexture, origin, kPremul_SkAlphaType, nullptr));
GrSurfaceOrigin readBackOrigin;
GrBackendObject readBackHandle = srcImage->getTextureHandle(false, &readBackOrigin);
- str.printf("readBackHandle: 0x%x", readBackHandle);
+ str.printf("readBackHandle: 0x%lx", readBackHandle);
canvas->drawString(str, 5, y += 30, paint);
canvas->drawImage(srcImage, 80, y += 10);
str.printf("origin: k%s_GrSurfaceOrigin", readBackOrigin ? "BottomLeft" : "TopLeft");
@@ -2096,7 +2050,7 @@ By translating canvas by returned offset, Image appears stationary.
canvas->drawLine(0, 0, offset.fX, offset.fY, paint);
canvas->translate(offset.fX, offset.fY);
canvas->drawImage(filtered, 0, 0);
- canvas->drawRect(SkRect::MakeFromIRect(outSubset), paint);
+ canvas->drawRect(SkRect::Make(outSubset), paint);
##
#SeeAlso makeShader SkPaint::setImageFilter
diff --git a/docs/SkMatrix_Reference.bmh b/docs/SkMatrix_Reference.bmh
index 57648ad805..63040e8a21 100644
--- a/docs/SkMatrix_Reference.bmh
+++ b/docs/SkMatrix_Reference.bmh
@@ -2491,7 +2491,7 @@ I(divx, divy) * Matrix = | 0 sy 0 | | M N O | = | sy*M sy*N sy*O |
#Example
#Image 3
-SkMatrix matrix, matrix2;
+SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
@@ -2748,7 +2748,7 @@ other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
#Example
#Image 3
#Height 64
-SkMatrix matrix, matrix2;
+SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
@@ -3015,9 +3015,10 @@ unchanged.
paint.setStrokeWidth(3);
paint.setStrokeCap(SkPaint::kRound_Cap);
canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);
- matrix.invert(&matrix);
- canvas->concat(matrix);
- canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);
+ if (matrix.invert(&matrix)) {
+ canvas->concat(matrix);
+ canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);
+ }
##
#SeeAlso Concat
@@ -3082,12 +3083,13 @@ If Matrix contains perspective, returns false and leaves affine unchanged.
SkMatrix matrix;
matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);
SkScalar affine[6];
-matrix.asAffine(affine);
-const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
-for (int i = 0; i < 6; ++i) {
- SkDebugf("%s: %g ", names[i], affine[i]);
+if (matrix.asAffine(affine)) {
+ const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
+ for (int i = 0; i < 6; ++i) {
+ SkDebugf("%s: %g ", names[i], affine[i]);
+ }
+ SkDebugf("\n");
}
-SkDebugf("\n");
#StdOut
ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7
##
@@ -3127,15 +3129,16 @@ Matrix is set, row, then column, to:
SkMatrix matrix;
matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);
SkScalar affine[6];
-matrix.asAffine(affine);
-const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
-for (int i = 0; i < 6; ++i) {
- SkDebugf("%s: %g ", names[i], affine[i]);
+if (matrix.asAffine(affine)) {
+ const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
+ for (int i = 0; i < 6; ++i) {
+ SkDebugf("%s: %g ", names[i], affine[i]);
+ }
+ SkDebugf("\n");
+ matrix.reset();
+ matrix.setAffine(affine);
+ matrix.dump();
}
-SkDebugf("\n");
-matrix.reset();
-matrix.setAffine(affine);
-matrix.dump();
#StdOut
ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7
[ 2.0000 3.0000 4.0000][ 5.0000 6.0000 7.0000][ 0.0000 0.0000 1.0000]
@@ -4030,8 +4033,9 @@ contains NaN, even if the other Matrix also contains NaN.
};
SkMatrix a, b;
a.setAll(1, 0, 0, 0, 1, 0, 1, 0, 1);
- a.invert(&b);
- debugster("identity", a, b);
+ if (a.invert(&b)) {
+ debugster("identity", a, b);
+ }
##
#SeeAlso cheapEqualTo operator==(const SkMatrix& a, const SkMatrix& b)
@@ -4172,10 +4176,12 @@ scaleFactors to undefined values.
#Example
SkMatrix matrix;
matrix.setAll(1, 0, 0, 0, 1, 0, 0, 0, 0);
- matrix.invert(&matrix);
- SkScalar factor[2] = {2, 2};
- bool result = matrix.getMinMaxScales(factor);
- SkDebugf("matrix.getMinMaxScales() %s %g %g\n", result ? "true" : "false", factor[0], factor[1]);
+ if (matrix.invert(&matrix)) {
+ SkScalar factor[2] = {2, 2};
+ bool result = matrix.getMinMaxScales(factor);
+ SkDebugf("matrix.getMinMaxScales() %s %g %g\n",
+ result ? "true" : "false", factor[0], factor[1]);
+ }
#StdOut
matrix.getMinMaxScales() false 2 2
##
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 1e564ee505..1d2202ca77 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -3066,7 +3066,7 @@ modifying the draw.
#Example
void draw(SkCanvas* canvas) {
SkPaint paint;
- paint.setMaskFilter(SkBlurMaskFilter::Make(kSolid_SkBlurStyle, 3));
+ paint.setMaskFilter(SkMaskFilter::MakeBlur(kSolid_SkBlurStyle, 3));
canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);
}
##
@@ -3084,7 +3084,7 @@ modifying the draw.
void draw(SkCanvas* canvas) {
SkPaint paint;
SkDebugf("nullptr %c= mask filter\n", paint.getMaskFilter() ? '!' : '=');
- paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3));
+ paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));
SkDebugf("nullptr %c= mask filter\n", paint.getMaskFilter() ? '!' : '=');
}
@@ -3109,7 +3109,7 @@ modifying the draw.
#Example
void draw(SkCanvas* canvas) {
SkPaint paint1, paint2;
- paint1.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 1));
+ paint1.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 1));
SkDebugf("mask filter unique: %s\n", paint1.getMaskFilter()->unique() ? "true" : "false");
paint2.setMaskFilter(paint1.refMaskFilter());
SkDebugf("mask filter unique: %s\n", paint1.getMaskFilter()->unique() ? "true" : "false");
@@ -3140,7 +3140,7 @@ Increments maskFilter Reference_Count by one.
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(10);
- paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 10));
+ paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 10));
canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);
}
##
diff --git a/docs/SkPath_Reference.bmh b/docs/SkPath_Reference.bmh
index 03a51d6428..790dd5a6bd 100644
--- a/docs/SkPath_Reference.bmh
+++ b/docs/SkPath_Reference.bmh
@@ -1740,9 +1740,6 @@ Returns (0, 0) if index is out of range.
#Example
void draw(SkCanvas* canvas) {
- auto debugster = [](const char* prefix, const SkPath& path) -> void {
- SkDebugf("%s point count: %d\n", prefix, path.countPoints());
- };
SkPath path;
path.lineTo(20, 20);
path.offset(-10, -10);
diff --git a/docs/SkPixmap_Reference.bmh b/docs/SkPixmap_Reference.bmh
index 86d89e53d1..9ad87f0acc 100644
--- a/docs/SkPixmap_Reference.bmh
+++ b/docs/SkPixmap_Reference.bmh
@@ -467,8 +467,7 @@ color type: kAlpha_8_SkColorType
#In Image_Info_Access
#Line # returns Image_Info Alpha_Type ##
-Returns Alpha_Type, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+Returns Alpha_Type, one of: #list_of_alpha_types#.
#Return Alpha_Type in Image_Info ##
@@ -491,11 +490,11 @@ alpha type: kPremul_SkAlphaType
#In Image_Info_Access
#Line # returns Image_Info Color_Space ##
-Returns Color_Space associated with Image_Info. The
+Returns Color_Space, the range of colors, associated with Image_Info. The
reference count of Color_Space is unchanged. The returned Color_Space is
immutable.
-#Return Color_Space, the range of colors, in Image_Info ##
+#Return Color_Space in Image_Info, or nullptr ##
#Example
#Description
@@ -1546,29 +1545,30 @@ pixels are treated as if they are linear, regardless of how they are encoded.
#Return true if pixels are copied to dstPixels ##
#Example
-#ToDo example doesn't do anything interesting since info colorSpace is nullptr ##
+#ToDo example doesn't do anything interesting since image doesn't have alpha ##
#Image 3
void draw(SkCanvas* canvas) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height(),
- canvas->imageInfo().colorSpace() ? SkColorSpace::MakeSRGB() : nullptr);
+ SkImageInfo srgb = SkImageInfo::MakeS32(image->width(), image->height(),
+ kPremul_SkAlphaType);
+ SkImageInfo linear = srgb.makeColorSpace(srgb.colorSpace()->makeLinearGamma());
std::vector<int32_t> srcPixels;
- srcPixels.resize(image->height() * image->width() * 4);
- SkPixmap pixmap(info, (const void*) &srcPixels.front(), image->width() * 4);
+ size_t rowBytes = image->width() * 4;
+ srcPixels.resize(image->height() * rowBytes);
+ SkPixmap pixmap(srgb, (const void*) &srcPixels.front(), rowBytes);
image->readPixels(pixmap, 0, 0);
- SkTransferFunctionBehavior behavior = canvas->imageInfo().colorSpace() ?
- SkTransferFunctionBehavior::kRespect : SkTransferFunctionBehavior::kIgnore;
+ int offset = -64;
std::vector<int32_t> dstPixels;
- dstPixels.resize(image->height() * image->width() * 4);
- int offset = 0;
- for (auto behavior : { SkTransferFunctionBehavior::kRespect,
- SkTransferFunctionBehavior::kIgnore} ) {
- pixmap.readPixels(info, &dstPixels.front(), image->width() * 4, offset, 0, behavior);
- offset += 128;
+ dstPixels.resize(image->height() * rowBytes);
+ for (const auto& info : { srgb, linear } ) {
+ for (auto behavior : { SkTransferFunctionBehavior::kRespect,
+ SkTransferFunctionBehavior::kIgnore} ) {
+ pixmap.readPixels(info, &dstPixels.front(), rowBytes, 0, 0, behavior);
+ SkBitmap bitmap;
+ SkPixmap dstmap(info, &dstPixels.front(), rowBytes);
+ bitmap.installPixels(dstmap);
+ canvas->drawBitmap(bitmap, 0, offset += 64);
+ }
}
- SkBitmap bitmap;
- SkPixmap dstmap(info, &dstPixels.front(), image->width() * 4);
- bitmap.installPixels(dstmap);
- canvas->drawBitmap(bitmap, 0, 0);
}
##
diff --git a/docs/SkSurface_Reference.bmh b/docs/SkSurface_Reference.bmh
index fb25e9eaa6..32562c61e2 100644
--- a/docs/SkSurface_Reference.bmh
+++ b/docs/SkSurface_Reference.bmh
@@ -1156,7 +1156,7 @@ or when Surface is deleted.
SkSurface::kFlushRead_BackendHandleAccess);
if (backendObject) {
SkString str;
- str.printf("backendObject=%08x", backendObject);
+ str.printf("backendObject=%08lx", backendObject);
paint.setTextSize(16);
canvas->drawString(str, 20, 40, paint);
}
@@ -1207,7 +1207,7 @@ In OpenGL this returns the frame buffer object ID.
if (gpuSurface->getRenderTargetHandle(&backendObject,
SkSurface::kFlushRead_BackendHandleAccess)) {
SkString str;
- str.printf("backendObject=%d", backendObject);
+ str.printf("backendObject=%ld", backendObject);
paint.setTextSize(16);
canvas->drawString(str, 20, 40, paint);
}
diff --git a/docs/illustrations.bmh b/docs/illustrations.bmh
index a7b5068cc4..48b844ac78 100644
--- a/docs/illustrations.bmh
+++ b/docs/illustrations.bmh
@@ -1,452 +1,452 @@
-#Topic Illustrations
-
-#Subtopic Image_Info_Color_Type_BGR_565
-#Example
-#Width 415
-#Height 250
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("16-bit word", 5 + 20 * 8, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- canvas->drawString("(low bits)", 5 + 20 * 1.5f, 137, paint);
- canvas->drawString("(high bits)", 5 + 20 * 6.5f, 187, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 5, 11, 16,
- 0, 3, 8,
- 0, 5, 8 };
- const char* labels[] = { "red", "green", "blue" };
- drawBoxText(&edges[0], &labels[0], 3, 15, 45);
- drawBoxText(&edges[4], &labels[1], 2, 7, 110);
- drawBoxText(&edges[7], &labels[0], 2, 7, 160);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_ABGR_4444
-#Example
-#Width 415
-#Height 250
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("16-bit word", 5 + 20 * 8, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 4, 8, 12, 16 };
- const char* labels[] = { "red", "green", "blue", "alpha" };
- drawBoxText(&edges[0], &labels[0], 4, 15, 45);
- drawBoxText(&edges[0], &labels[2], 2, 7, 110);
- drawBoxText(&edges[0], &labels[0], 2, 7, 160);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_RGBA_8888
-#Example
-#Width 812
-#Height 365
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 8, 16, 24, 32 };
- const char* labels[] = { "alpha", "blue", "green", "red" };
- drawBoxText(edges, &labels[0], 4, 31, 45);
- drawBoxText(edges, &labels[3], 1, 7, 110);
- drawBoxText(edges, &labels[2], 1, 7, 160);
- drawBoxText(edges, &labels[1], 1, 7, 210);
- drawBoxText(edges, &labels[0], 1, 7, 260);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_RGB_888x
-#Example
-#Width 812
-#Height 365
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 8, 16, 24, 32 };
- const char* labels[] = { "(unused)", "blue", "green", "red" };
- drawBoxText(edges, &labels[0], 4, 31, 45);
- drawBoxText(edges, &labels[3], 1, 7, 110);
- drawBoxText(edges, &labels[2], 1, 7, 160);
- drawBoxText(edges, &labels[1], 1, 7, 210);
- drawBoxText(edges, &labels[0], 1, 7, 260);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_BGRA_8888
-#Example
-#Width 812
-#Height 365
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 8, 16, 24, 32 };
- const char* labels[] = { "alpha", "red", "green", "blue" };
- drawBoxText(edges, &labels[0], 4, 31, 45);
- drawBoxText(edges, &labels[3], 1, 7, 110);
- drawBoxText(edges, &labels[2], 1, 7, 160);
- drawBoxText(edges, &labels[1], 1, 7, 210);
- drawBoxText(edges, &labels[0], 1, 7, 260);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_RGBA_1010102
-#Example
-#Width 812
-#Height 380
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- canvas->drawString("(low bits)", 5 + 20 * 4, 137, paint);
- canvas->drawString("(low bits)", 5 + 20 * 3, 187, paint);
- canvas->drawString("(high bits)", 5 + 20 * 7, 187, paint);
- canvas->drawString("(low bits)", 5 + 20 * 2, 237, paint);
- canvas->drawString("(high bits)", 5 + 20 * 6, 237, paint);
- canvas->drawString("(high bits)", 5 + 20 * 5, 287, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 2, 12, 22, 32,
- 0, 8,
- 0, 6, 8,
- 0, 4, 8,
- 0, 2, 8
- };
- const char* labels[] = { "alpha", "blue", "green", "red" };
- drawBoxText(&edges[0], &labels[0], 4, 31, 45);
- drawBoxText(&edges[5], &labels[3], 1, 7, 110);
- drawBoxText(&edges[7], &labels[2], 2, 7, 160);
- drawBoxText(&edges[10], &labels[1], 2, 7, 210);
- drawBoxText(&edges[13], &labels[0], 2, 7, 260);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_RGB_101010x
-#Example
-#Width 812
-#Height 380
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
- canvas->drawString("(low bits)", 5 + 20 * 4, 137, paint);
- canvas->drawString("(low bits)", 5 + 20 * 3, 187, paint);
- canvas->drawString("(high bits)", 5 + 20 * 7, 187, paint);
- canvas->drawString("(low bits)", 5 + 20 * 2, 237, paint);
- canvas->drawString("(high bits)", 5 + 20 * 6, 237, paint);
- canvas->drawString("(high bits)", 5 + 20 * 5, 287, paint);
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 2, 12, 22, 32,
- 0, 8,
- 0, 6, 8,
- 0, 4, 8,
- 0, 2, 8
- };
- const char* labels[] = { "unused", "blue", "green", "red" };
- drawBoxText(&edges[0], &labels[0], 4, 31, 45);
- drawBoxText(&edges[5], &labels[3], 1, 7, 110);
- drawBoxText(&edges[7], &labels[2], 2, 7, 160);
- drawBoxText(&edges[10], &labels[1], 2, 7, 210);
- drawBoxText(&edges[13], &labels[0], 2, 7, 260);
-}
-##
-##
-
-#Subtopic Image_Info_Color_Type_RGBA_F16
-#Example
-#Width 812
-#Height 685
-void draw(SkCanvas* canvas) {
- canvas->scale(1.25f, 1.25f);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(10);
- paint.setTextAlign(SkPaint::kCenter_Align);
- canvas->drawString("64-bit word", 5 + 20 * 16, 20, paint);
- canvas->drawString("little endian byte order", 5 + 20 * 4, 135, paint);
- for (int i = 0; i < 4; ++i) {
- canvas->drawString("(low bits)", 5 + 20 * 4, 187 + i * 100, paint);
- canvas->drawString("(high bits)", 5 + 20 * 4, 237 + i * 100, paint);
- }
- auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
- SkPaint p(paint);
- p.setColor(SK_ColorRED);
- SkScalar xPos = 15;
- int width = n % 32 + 1;
- int lastN = n > 32 ? 32 : 0;
- for (; n >= lastN; --n) {
- for (int i = 0; i <= count; ++i) {
- int a = width - e[i];
- if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
- char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
- canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
- break;
- }
- }
- xPos += 20;
- }
- p.setColor(SK_ColorBLACK);
- for (int i = 0; i < count; ++i) {
- canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
- }
- p.setStyle(SkPaint::kStroke_Style);
- for (int i = 0; i <= count; ++i) {
- canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
- }
- for (int i = 0; i < 2; ++i) {
- canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
- }
- };
- SkScalar edges[] = { 0, 16, 32,
- 0, 8
- };
- const char* labels[] = { "alpha", "blue", "green", "red" };
- drawBoxText(&edges[0], &labels[0], 2, 63, 45);
- drawBoxText(&edges[0], &labels[2], 2, 31, 95);
- drawBoxText(&edges[3], &labels[3], 1, 7, 160);
- drawBoxText(&edges[3], &labels[3], 1, 7, 210);
- drawBoxText(&edges[3], &labels[2], 1, 7, 260);
- drawBoxText(&edges[3], &labels[2], 1, 7, 310);
- drawBoxText(&edges[3], &labels[1], 1, 7, 360);
- drawBoxText(&edges[3], &labels[1], 1, 7, 410);
- drawBoxText(&edges[3], &labels[0], 1, 7, 460);
- drawBoxText(&edges[3], &labels[0], 1, 7, 510);
-}
-##
-##
-
-#Topic Illustrations ##
+#Topic Illustrations
+
+#Subtopic Image_Info_Color_Type_BGR_565
+#Example
+#Width 415
+#Height 250
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("16-bit word", 5 + 20 * 8, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 1.5f, 137, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 6.5f, 187, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 5, 11, 16,
+ 0, 3, 8,
+ 0, 5, 8 };
+ const char* labels[] = { "red", "green", "blue" };
+ drawBoxText(&edges[0], &labels[0], 3, 15, 45);
+ drawBoxText(&edges[4], &labels[1], 2, 7, 110);
+ drawBoxText(&edges[7], &labels[0], 2, 7, 160);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_ABGR_4444
+#Example
+#Width 415
+#Height 250
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("16-bit word", 5 + 20 * 8, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 4, 8, 12, 16 };
+ const char* labels[] = { "red", "green", "blue", "alpha" };
+ drawBoxText(&edges[0], &labels[0], 4, 15, 45);
+ drawBoxText(&edges[0], &labels[2], 2, 7, 110);
+ drawBoxText(&edges[0], &labels[0], 2, 7, 160);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_RGBA_8888
+#Example
+#Width 812
+#Height 365
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 8, 16, 24, 32 };
+ const char* labels[] = { "alpha", "blue", "green", "red" };
+ drawBoxText(edges, &labels[0], 4, 31, 45);
+ drawBoxText(edges, &labels[3], 1, 7, 110);
+ drawBoxText(edges, &labels[2], 1, 7, 160);
+ drawBoxText(edges, &labels[1], 1, 7, 210);
+ drawBoxText(edges, &labels[0], 1, 7, 260);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_RGB_888x
+#Example
+#Width 812
+#Height 365
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 8, 16, 24, 32 };
+ const char* labels[] = { "(unused)", "blue", "green", "red" };
+ drawBoxText(edges, &labels[0], 4, 31, 45);
+ drawBoxText(edges, &labels[3], 1, 7, 110);
+ drawBoxText(edges, &labels[2], 1, 7, 160);
+ drawBoxText(edges, &labels[1], 1, 7, 210);
+ drawBoxText(edges, &labels[0], 1, 7, 260);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_BGRA_8888
+#Example
+#Width 812
+#Height 365
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 8, 16, 24, 32 };
+ const char* labels[] = { "alpha", "red", "green", "blue" };
+ drawBoxText(edges, &labels[0], 4, 31, 45);
+ drawBoxText(edges, &labels[3], 1, 7, 110);
+ drawBoxText(edges, &labels[2], 1, 7, 160);
+ drawBoxText(edges, &labels[1], 1, 7, 210);
+ drawBoxText(edges, &labels[0], 1, 7, 260);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_RGBA_1010102
+#Example
+#Width 812
+#Height 380
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 4, 137, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 3, 187, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 7, 187, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 2, 237, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 6, 237, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 5, 287, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 2, 12, 22, 32,
+ 0, 8,
+ 0, 6, 8,
+ 0, 4, 8,
+ 0, 2, 8
+ };
+ const char* labels[] = { "alpha", "blue", "green", "red" };
+ drawBoxText(&edges[0], &labels[0], 4, 31, 45);
+ drawBoxText(&edges[5], &labels[3], 1, 7, 110);
+ drawBoxText(&edges[7], &labels[2], 2, 7, 160);
+ drawBoxText(&edges[10], &labels[1], 2, 7, 210);
+ drawBoxText(&edges[13], &labels[0], 2, 7, 260);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_RGB_101010x
+#Example
+#Width 812
+#Height 380
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("32-bit word", 5 + 20 * 16, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 85, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 4, 137, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 3, 187, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 7, 187, paint);
+ canvas->drawString("(low bits)", 5 + 20 * 2, 237, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 6, 237, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 5, 287, paint);
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 2, 12, 22, 32,
+ 0, 8,
+ 0, 6, 8,
+ 0, 4, 8,
+ 0, 2, 8
+ };
+ const char* labels[] = { "unused", "blue", "green", "red" };
+ drawBoxText(&edges[0], &labels[0], 4, 31, 45);
+ drawBoxText(&edges[5], &labels[3], 1, 7, 110);
+ drawBoxText(&edges[7], &labels[2], 2, 7, 160);
+ drawBoxText(&edges[10], &labels[1], 2, 7, 210);
+ drawBoxText(&edges[13], &labels[0], 2, 7, 260);
+}
+##
+##
+
+#Subtopic Image_Info_Color_Type_RGBA_F16
+#Example
+#Width 812
+#Height 685
+void draw(SkCanvas* canvas) {
+ canvas->scale(1.25f, 1.25f);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(10);
+ paint.setTextAlign(SkPaint::kCenter_Align);
+ canvas->drawString("64-bit word", 5 + 20 * 16, 20, paint);
+ canvas->drawString("little endian byte order", 5 + 20 * 4, 135, paint);
+ for (int i = 0; i < 4; ++i) {
+ canvas->drawString("(low bits)", 5 + 20 * 4, 187 + i * 100, paint);
+ canvas->drawString("(high bits)", 5 + 20 * 4, 237 + i * 100, paint);
+ }
+ auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
+ SkPaint p(paint);
+ p.setColor(SK_ColorRED);
+ SkScalar xPos = 15;
+ int width = n % 32 + 1;
+ int lastN = n > 32 ? 32 : 0;
+ for (; n >= lastN; --n) {
+ for (int i = 0; i <= count; ++i) {
+ int a = width - e[i];
+ if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {
+ char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\0'};
+ canvas->drawString(n >= 10 ? num : &num[1], xPos, yPos - 5, p);
+ break;
+ }
+ }
+ xPos += 20;
+ }
+ p.setColor(SK_ColorBLACK);
+ for (int i = 0; i < count; ++i) {
+ canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p);
+ }
+ p.setStyle(SkPaint::kStroke_Style);
+ for (int i = 0; i <= count; ++i) {
+ canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);
+ }
+ for (int i = 0; i < 2; ++i) {
+ canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);
+ }
+ };
+ SkScalar edges[] = { 0, 16, 32,
+ 0, 8
+ };
+ const char* labels[] = { "alpha", "blue", "green", "red" };
+ drawBoxText(&edges[0], &labels[0], 2, 63, 45);
+ drawBoxText(&edges[0], &labels[2], 2, 31, 95);
+ drawBoxText(&edges[3], &labels[3], 1, 7, 160);
+ drawBoxText(&edges[3], &labels[3], 1, 7, 210);
+ drawBoxText(&edges[3], &labels[2], 1, 7, 260);
+ drawBoxText(&edges[3], &labels[2], 1, 7, 310);
+ drawBoxText(&edges[3], &labels[1], 1, 7, 360);
+ drawBoxText(&edges[3], &labels[1], 1, 7, 410);
+ drawBoxText(&edges[3], &labels[0], 1, 7, 460);
+ drawBoxText(&edges[3], &labels[0], 1, 7, 510);
+}
+##
+##
+
+#Topic Illustrations ##
diff --git a/docs/status.json b/docs/status.json
index a8888020dd..eaa80b4189 100644
--- a/docs/status.json
+++ b/docs/status.json
@@ -1,48 +1,48 @@
-{
- "Completed": {
- "include": {
- "core": [
- "SkBitmap.h",
- "SkCanvas.h",
- "SkImage.h",
- "SkMatrix.h",
- "SkPaint.h",
- "SkPath.h",
- "SkPixmap.h",
- "SkPoint.h",
- "SkRect.h",
- "SkSurface.h"
- ]
- },
- "docs": [
- "SkAutoCanvasRestore_Reference.bmh",
- "SkCanvas_Reference.bmh",
- "SkIPoint16_Reference.bmh",
- "SkPaint_Reference.bmh",
- "SkPoint_Reference.bmh",
- "SkIRect_Reference.bmh",
- "SkImage_Reference.bmh",
- "SkPath_Reference.bmh",
- "SkRect_Reference.bmh",
- "SkBitmap_Reference.bmh",
- "SkIPoint_Reference.bmh",
- "SkMatrix_Reference.bmh",
- "SkPixmap_Reference.bmh",
- "SkSurface_Reference.bmh",
- "illustrations.bmh",
- "undocumented.bmh"
- ]
- },
- "InProgress": {
- "include": {
- "core": [
- "SkImageInfo.h"
- ]
- },
- "docs": [
- "SkImageInfo_Reference.bmh",
- "overview.bmh",
- "usingBookmaker.bmh"
- ]
- }
-}
+{
+ "Completed": {
+ "include": {
+ "core": [
+ "SkBitmap.h",
+ "SkCanvas.h",
+ "SkImage.h",
+ "SkMatrix.h",
+ "SkPaint.h",
+ "SkPath.h",
+ "SkPixmap.h",
+ "SkPoint.h",
+ "SkRect.h",
+ "SkSurface.h"
+ ]
+ },
+ "docs": [
+ "SkAutoCanvasRestore_Reference.bmh",
+ "SkCanvas_Reference.bmh",
+ "SkIPoint16_Reference.bmh",
+ "SkPaint_Reference.bmh",
+ "SkPoint_Reference.bmh",
+ "SkIRect_Reference.bmh",
+ "SkImage_Reference.bmh",
+ "SkPath_Reference.bmh",
+ "SkRect_Reference.bmh",
+ "SkBitmap_Reference.bmh",
+ "SkIPoint_Reference.bmh",
+ "SkMatrix_Reference.bmh",
+ "SkPixmap_Reference.bmh",
+ "SkSurface_Reference.bmh",
+ "illustrations.bmh",
+ "undocumented.bmh"
+ ]
+ },
+ "InProgress": {
+ "include": {
+ "core": [
+ "SkImageInfo.h"
+ ]
+ },
+ "docs": [
+ "SkImageInfo_Reference.bmh",
+ "overview.bmh",
+ "usingBookmaker.bmh"
+ ]
+ }
+}
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index 4bc37130ca..094b5c2b27 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -167,6 +167,8 @@ FT_Load_Glyph
#Class SkColorSpace
#Method static sk_sp<SkColorSpace> MakeSRGBLinear()
##
+ #Method bool gammaCloseToSRGB() const
+ ##
##
#EnumClass SkTransferFunctionBehavior
#Const kRespect 0
@@ -704,6 +706,9 @@ FT_Load_Glyph
##
##
+#Topic Transfer_Mode
+##
+
#Topic Typeface
#Class SkTypeface
#Class ##
diff --git a/site/user/api/SkBitmap_Reference.md b/site/user/api/SkBitmap_Reference.md
index 999460ca52..f5498c917c 100644
--- a/site/user/api/SkBitmap_Reference.md
+++ b/site/user/api/SkBitmap_Reference.md
@@ -314,7 +314,7 @@ copy of <a href="#SkBitmap_copy_const_SkBitmap_src">src</a>
### Example
-<div><fiddle-embed name="dbf46a0b60324ec611cc18d86772e7b9">
+<div><fiddle-embed name="f12c2af14b0fffd094d632b5f766aa1d">
#### Example Output
@@ -355,7 +355,7 @@ copy of <a href="#SkBitmap_move_SkBitmap_src">src</a>
### Example
-<div><fiddle-embed name="8172a14e66cb763b7133f70dc4ff601e">
+<div><fiddle-embed name="a137b2027d2ac098a21d68d93391f5bb">
#### Example Output
@@ -411,7 +411,7 @@ copy of <a href="#SkBitmap_copy_operator_src">src</a>
### Example
-<div><fiddle-embed name="6366fa1b1b3df1bebbfa3ed1c5a43457">
+<div><fiddle-embed name="98d5866308756c21c8f8b639bc4e033a">
#### Example Output
@@ -452,7 +452,7 @@ copy of <a href="#SkBitmap_move_operator_src">src</a>
### Example
-<div><fiddle-embed name="5066583054077df5098bb1d2aa402149">
+<div><fiddle-embed name="02836d36fa714d553c32f0d8ea11da73">
#### Example Output
@@ -488,7 +488,7 @@ Swaps the fields of the two bitmaps.
### Example
-<div><fiddle-embed name="274d02e5f33866b1a9a78423c5569e22">
+<div><fiddle-embed name="de9be45255e48fae445c916a41063abc">
#### Example Output
@@ -729,8 +729,8 @@ color type: kAlpha_8_SkColorType
SkAlphaType alphaType() const
</pre>
-Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.
+Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.
### Return Value
@@ -796,7 +796,7 @@ gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
sk_sp&lt;SkColorSpace&gt; refColorSpace() const
</pre>
-Returns a smart pointer to <a href="undocumented#Color_Space">Color Space</a>, the range of colors, associated with
+Returns smart pointer to <a href="undocumented#Color_Space">Color Space</a>, the range of colors, associated with
<a href="SkImageInfo_Reference#Image_Info">Image Info</a>. The smart pointer tracks the number of objects sharing this
<a href="undocumented#Color_Space">Color Space</a> reference so the memory is released when the owners destruct.
@@ -865,7 +865,7 @@ color: kRGBA_F16_SkColorType bytesPerPixel: 8
### See Also
-<a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> <a href="#SkBitmap_width">width</a> <a href="#SkBitmap_shiftPerPixel">shiftPerPixel</a>
+<a href="#SkBitmap_rowBytes">rowBytes</a> <a href="#SkBitmap_rowBytesAsPixels">rowBytesAsPixels</a> <a href="#SkBitmap_width">width</a> <a href="#SkBitmap_shiftPerPixel">shiftPerPixel</a> <a href="SkImageInfo_Reference#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a>
---
@@ -1127,8 +1127,8 @@ are affected.
### Parameters
<table> <tr> <td><a name="SkBitmap_setAlphaType_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr>
</table>
@@ -1138,7 +1138,8 @@ true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is set
### Example
-<div><fiddle-embed name="38cec6acbba80274232a85539ab34af1"><a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<div><fiddle-embed name="be21305f5654a1d8ed765710813a1f14"><a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </fiddle-embed></div>
@@ -1289,13 +1290,16 @@ Writing to immutable <a href="#Bitmap">Bitmap</a> pixels triggers an assert on d
bool isOpaque() const
</pre>
-Returns true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>.
+Returns true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is set to hint that all pixels are opaque; their
+<a href="undocumented#Alpha">Color Alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are
+not opaque, Skia may draw incorrectly.
+
Does not check if <a href="SkImageInfo_Reference#Color_Type">Color Type</a> allows <a href="undocumented#Alpha">Alpha</a>, or if any pixel value has
transparency.
### Return Value
-true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> describes opaque <a href="undocumented#Alpha">Alpha</a>
+true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>
### Example
@@ -1539,7 +1543,7 @@ integral rectangle from origin to <a href="#SkBitmap_width">width</a> and <a hre
### Example
-<div><fiddle-embed name="41a60435d6eb76cb400fe9be635e3762"></fiddle-embed></div>
+<div><fiddle-embed name="3e9126152ff1cc592aef6facbcb5fc96"></fiddle-embed></div>
### See Also
@@ -2792,7 +2796,7 @@ generic pointer to pixel
### Example
-<div><fiddle-embed name="bd0e0adb48b16d75129092649eab1617">
+<div><fiddle-embed name="ffcefb2344cd38c3b99f69cfe6d64a17">
#### Example Output
@@ -3518,7 +3522,7 @@ true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href=
### Example
-<div><fiddle-embed name="c102065eea5c3f109fdcad3f0e269ce5"></fiddle-embed></div>
+<div><fiddle-embed name="092739b4cd5d732a27c07ced8ef45f01"></fiddle-embed></div>
### See Also
@@ -3560,7 +3564,7 @@ true if <a href="undocumented#Alpha">Alpha</a> layer was constructed in <a href=
### Example
-<div><fiddle-embed name="3563cb608791d55bb584f38e842f3003"></fiddle-embed></div>
+<div><fiddle-embed name="cd7543fa8c9f3cede46dc2d72eb8c4bd"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md
index 908fbaf524..f318040a8a 100644
--- a/site/user/api/SkCanvas_Reference.md
+++ b/site/user/api/SkCanvas_Reference.md
@@ -4386,7 +4386,7 @@ filter strictly within <a href="#SkCanvas_drawBitmapRect_src">src</a> or draw fa
### Example
-<div><fiddle-embed name="de449106e78ec558d9921b9f076de164"></fiddle-embed></div>
+<div><fiddle-embed name="4be3c8406a350bc3429a69e5c1daa8cd"></fiddle-embed></div>
### See Also
@@ -4753,7 +4753,7 @@ and so on; or nullptr</td>
### Example
-<div><fiddle-embed name="75f43f11c6bd58175071b8b54ebec676"><div>The leftmost <a href="#SkCanvas_drawImageLattice_image">image</a> is smaller than center; only corners are drawn, all scaled to fit.
+<div><fiddle-embed name="47f78f3f70ccd9e6c40ee3203a5c71dd"><div>The leftmost <a href="#SkCanvas_drawImageLattice_image">image</a> is smaller than center; only corners are drawn, all scaled to fit.
The second <a href="#SkCanvas_drawImageLattice_image">image</a> equals the size of center; only corners are drawn without scaling.
The remaining images are larger than center. All corners draw without scaling. The sides
are scaled if needed to take up the remaining space; the center is transparent.
@@ -4837,7 +4837,8 @@ void drawString(const char* string, SkScalar x, SkScalar y, const SkPaint& paint
</pre>
<a href="#Draw">Draw</a> null terminated <a href="#SkCanvas_drawString_string">string</a>, with origin at (<a href="#SkCanvas_drawString_x">x</a>, <a href="#SkCanvas_drawString_y">y</a>), using <a href="#Clip">Clip</a>, <a href="#Matrix">Matrix</a>, and
-<a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawString_paint">paint</a>.
+<a href="SkPaint_Reference#Paint">Paint</a> <a href="#SkCanvas_drawString_paint">paint</a>. Note that this per-glyph xform does not affect the shader (if present)
+on the <a href="#SkCanvas_drawString_paint">paint</a>, just the glyph's geometry.
<a href="#SkCanvas_drawString_string">string</a> meaning depends on <a href="SkPaint_Reference#Text_Encoding">Paint Text Encoding</a>; by default, strings are encoded
as UTF-8. Other values of <a href="SkPaint_Reference#Text_Encoding">Paint Text Encoding</a> are unlikely to produce the desired
@@ -5276,7 +5277,7 @@ recorded drawing commands to play</td>
### Example
-<div><fiddle-embed name="fde216281ff93d612768a49f2cf309ae"></fiddle-embed></div>
+<div><fiddle-embed name="a7373b01354dda73dafe8718f4fd0cfc"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/SkIPoint_Reference.md b/site/user/api/SkIPoint_Reference.md
index 1edeaeed5f..d07b7acd64 100644
--- a/site/user/api/SkIPoint_Reference.md
+++ b/site/user/api/SkIPoint_Reference.md
@@ -268,7 +268,7 @@ Returns <a href="#IPoint">IPoint</a> changing the signs of <a href="#SkIPoint_fX
### Example
-<div><fiddle-embed name="d283e8876366349aedd85b65cadb3706">
+<div><fiddle-embed name="b30d4780475d113a7fed3637af7f0db1">
#### Example Output
diff --git a/site/user/api/SkIRect_Reference.md b/site/user/api/SkIRect_Reference.md
index f58c3c1cb6..ecbd43eeea 100644
--- a/site/user/api/SkIRect_Reference.md
+++ b/site/user/api/SkIRect_Reference.md
@@ -1961,7 +1961,7 @@ true if <a href="#SkIRect_intersectNoEmptyCheck_a">a</a> and <a href="#SkIRect_i
### Example
-<div><fiddle-embed name="2b3e26ccba1cba3d961645f0824621ac">
+<div><fiddle-embed name="d35fbc9fdea71df8b8a12fd3da50d11c">
#### Example Output
diff --git a/site/user/api/SkImageInfo_Reference.md b/site/user/api/SkImageInfo_Reference.md
index 67a2ac8972..464fed988e 100644
--- a/site/user/api/SkImageInfo_Reference.md
+++ b/site/user/api/SkImageInfo_Reference.md
@@ -30,6 +30,9 @@ but <a href="SkImage_Reference#Image">Image</a> and <a href="SkSurface_Reference
## <a name="Alpha_Type"></a> Alpha Type
+<a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>
+
## <a name="SkAlphaType"></a> Enum SkAlphaType
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
@@ -130,7 +133,7 @@ Some drawing destinations may not support <a href="#Alpha_Type_Unpremul">Unpremu
### Example
-<div><fiddle-embed name="46e528e0c6b3f3e296d0d0930d638629"><div><a href="undocumented#SkColorSetARGB">SkColorSetARGB</a> parameter a is set to 150, less than its maximum value, and is
+<div><fiddle-embed name="b8216a9e5ff5bc61a0e46eba7d36307b"><div><a href="undocumented#SkColorSetARGB">SkColorSetARGB</a> parameter a is set to 150, less than its maximum value, and is
interpreted as <a href="undocumented#Alpha">Color Alpha</a> of about 0.6. color is not premultiplied;
color components may have values greater than color alpha.
The four displayed values are the original component values, though not necessarily
@@ -381,6 +384,11 @@ less than 3, the drawn result is undefined.
## <a name="Color_Type_RGB_101010x"></a> Color Type RGB 101010x
+<a href="#Color_Type_RGB_101010x">RGB 101010x</a> is a 32-bit word pixel encoding that contains ten bits of red,
+ten bits of green, ten bits of blue, and two unused bits. <a href="#Color_Type_RGB_101010x">RGB 101010x</a> is fully
+opaque as if its <a href="undocumented#Alpha">Color Alpha</a> was set to one, and should always be paired with
+<a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>.
+
![Color_Type_RGB_101010x](https://fiddle.skia.org/i/c22477b11dabaa3e3a0b5bb33a7733cd_raster.png "")
### Example
@@ -389,18 +397,174 @@ less than 3, the drawn result is undefined.
## <a name="Color_Type_Gray_8"></a> Color Type Gray 8
+<a href="#Color_Type_Gray_8">Gray 8</a> is an 8-bit byte pixel encoding that represents equal values for red,
+blue, and green, reprsenting colors from black to white. <a href="#Color_Type_Gray_8">Gray 8</a> is fully
+opaque as if its <a href="undocumented#Alpha">Color Alpha</a> was set to one, and should always be paired with
+<a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>.
+
### Example
<div><fiddle-embed name="93da0eb0b6722a4f33dc7dae094abf0b"></fiddle-embed></div>
## <a name="Color_Type_RGBA_F16"></a> Color Type RGBA F16
+<a href="#Color_Type_RGBA_F16">RGBA F16</a> is a 64-bit word pixel encoding that contains sixteen bits of blue,
+sixteen bits of green, sixteen bits of red, and sixteen bits of alpha.
+
+Each component encodes a floating point value using <a href="https://www.khronos.org/opengl/wiki/Small_Float_Formats">Half floats</a> .
+Meaningful colors are represented by the range 0.0 to 1.0, although smaller
+and larger values may be useful when used in combination with <a href="undocumented#Transfer_Mode">Transfer Mode</a>.
+
![Color_Type_RGBA_F16](https://fiddle.skia.org/i/9344796c059ff5e4f057595e781905b3_raster.png "")
+If paired with <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>: blue, green, and red components are
+premultiplied by the alpha value. If blue, green, or red is greater than alpha,
+the drawn result is undefined.
+
+If paired with <a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>: blue, green, red, and alpha components
+may have any value. There may be a performance penalty with unpremultipled
+pixels.
+
+If paired with <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>: all alpha component values are at the maximum;
+blue, green, and red components are fully opaque. If any alpha component is
+less than 255, the drawn result is undefined.
+
### Example
<div><fiddle-embed name="1795410dffea303b08ba98ee78dc1556"></fiddle-embed></div>
+<a name="SkColorTypeBytesPerPixel"></a>
+## SkColorTypeBytesPerPixel
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+int SkColorTypeBytesPerPixel(SkColorType ct)
+</pre>
+
+Returns the number of bytes required to store a pixel, including unused padding.
+Returns zero if <a href="#SkColorTypeBytesPerPixel_ct">ct</a> is <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a> or invalid.
+
+### Parameters
+
+<table> <tr> <td><a name="SkColorTypeBytesPerPixel_ct"> <code><strong>ct </strong></code> </a></td> <td>
+one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
+ </tr>
+</table>
+
+### Return Value
+
+bytes per pixel
+
+### Example
+
+<div><fiddle-embed name="09ef49d07cb7005ba3e34d5ea53896f5"><a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </fiddle-embed></div>
+
+### See Also
+
+<a href="#SkImageInfo_bytesPerPixel">SkImageInfo::bytesPerPixel</a>
+
+---
+
+<a name="SkColorTypeIsAlwaysOpaque"></a>
+## SkColorTypeIsAlwaysOpaque
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
+</pre>
+
+Returns true if <a href="#Color_Type">Color Type</a> always decodes <a href="undocumented#Alpha">Color Alpha</a> to 1.0, making the pixel
+fully opaque. If true, <a href="#Color_Type">Color Type</a> does not reserve bits to encode <a href="undocumented#Alpha">Color Alpha</a>.
+
+### Parameters
+
+<table> <tr> <td><a name="SkColorTypeIsAlwaysOpaque_ct"> <code><strong>ct </strong></code> </a></td> <td>
+one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
+ </tr>
+</table>
+
+### Return Value
+
+true if <a href="undocumented#Alpha">Color Alpha</a> is always set to 1.0
+
+### Example
+
+<div><fiddle-embed name="9b3eb5aaa0dfea9feee54e7650fa5446"><a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </fiddle-embed></div>
+
+### See Also
+
+<a href="#SkColorTypeValidateAlphaType">SkColorTypeValidateAlphaType</a>
+
+---
+
+<a name="SkColorTypeValidateAlphaType"></a>
+## SkColorTypeValidateAlphaType
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
+ SkAlphaType* canonical = nullptr)
+</pre>
+
+Returns true if <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> can be set to a valid <a href="#Alpha_Type">Alpha Type</a> for <a href="#SkColorTypeValidateAlphaType_colorType">colorType</a>. If
+there is more than one valid <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> <a href="#Alpha_Type">Alpha Type</a>, set to <a href="#SkColorTypeValidateAlphaType_alphaType">alphaType</a>, if valid.
+If true is returned and <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> is not nullptr, store valid <a href="#Alpha_Type">Alpha Type</a>.
+
+Returns false only if <a href="#SkColorTypeValidateAlphaType_alphaType">alphaType</a> is <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, color type is not
+<a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, and <a href="#Color_Type">Color Type</a> is not always opaque. If false is returned,
+<a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> is ignored.
+
+For <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>: set <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> to <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a> and return true.
+For <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>: set <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> to <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a> or
+<a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> and return true if <a href="#SkColorTypeValidateAlphaType_alphaType">alphaType</a> is not <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>.
+For <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>, and
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>: set <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> to <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> and return true.
+For <a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
+<a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, and <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>: set <a href="#SkColorTypeValidateAlphaType_canonical">canonical</a> to <a href="#SkColorTypeValidateAlphaType_alphaType">alphaType</a>
+and return true if <a href="#SkColorTypeValidateAlphaType_alphaType">alphaType</a> is not <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>.
+
+### Parameters
+
+<table> <tr> <td><a name="SkColorTypeValidateAlphaType_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
+one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
+ </tr> <tr> <td><a name="SkColorTypeValidateAlphaType_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
+one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
+ </tr> <tr> <td><a name="SkColorTypeValidateAlphaType_canonical"> <code><strong>canonical </strong></code> </a></td> <td>
+storage for <a href="#Alpha_Type">Alpha Type</a></td>
+ </tr>
+</table>
+
+### Return Value
+
+true if valid <a href="#Alpha_Type">Alpha Type</a> can be associated with <a href="#SkColorTypeValidateAlphaType_colorType">colorType</a>
+
+### Example
+
+<div><fiddle-embed name="befac1c29ed21507d367e4d824383a04"><a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </fiddle-embed></div>
+
+### See Also
+
+<a href="#SkColorTypeIsAlwaysOpaque">SkColorTypeIsAlwaysOpaque</a>
+
+---
+
## <a name="YUV_ColorSpace"></a> YUV ColorSpace
## <a name="SkYUVColorSpace"></a> Enum SkYUVColorSpace
@@ -445,36 +609,6 @@ incomplete
-## <a name="SkDestinationSurfaceColorMode"></a> Enum SkDestinationSurfaceColorMode
-
-<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
-enum class <a href="#SkDestinationSurfaceColorMode">SkDestinationSurfaceColorMode</a> {
-<a href="#SkDestinationSurfaceColorMode_kLegacy">kLegacy</a>,
-<a href="#SkDestinationSurfaceColorMode_kGammaAndColorSpaceAware">kGammaAndColorSpaceAware</a>,
-};
-</pre>
-
-### Constants
-
-<table>
- <tr>
- <td><a name="SkDestinationSurfaceColorMode_kLegacy"> <code><strong>SkDestinationSurfaceColorMode::kLegacy </strong></code> </a></td><td>0</td><td></td>
- </tr>
- <tr>
- <td><a name="SkDestinationSurfaceColorMode_kGammaAndColorSpaceAware"> <code><strong>SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware </strong></code> </a></td><td>1</td><td></td>
- </tr>
-</table>
-
-### Example
-
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
-
-### See Also
-
-incomplete
-
-
-
# <a name="SkImageInfo"></a> Struct SkImageInfo
Describes pixel dimensions and encoding. <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, <a href="SkImage_Reference#Image">Image</a>, PixMap, and <a href="SkSurface_Reference#Surface">Surface</a>
can be created from <a href="#Image_Info">Image Info</a>. <a href="#Image_Info">Image Info</a> can be retrieved from <a href="SkBitmap_Reference#Bitmap">Bitmap</a> and
@@ -496,29 +630,29 @@ and green; and <a href="undocumented#Color_Space">Color Space</a>, the range and
| <a href="#SkImageInfo_MakeN32Premul">MakeN32Premul</a> | creates <a href="#Image_Info">Image Info</a> with <a href="#Color_Type_Native">Native Color Type</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a> |
| <a href="#SkImageInfo_MakeS32">MakeS32</a> | creates <a href="#Image_Info">Image Info</a> with <a href="#Color_Type_Native">Native Color Type</a>, sRGB <a href="undocumented#Color_Space">Color Space</a> |
| <a href="#SkImageInfo_MakeUnknown">MakeUnknown</a> | creates <a href="#Image_Info">Image Info</a> with <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a> |
-| <a href="#SkImageInfo_alphaType">alphaType</a> | incomplete |
-| <a href="#SkImageInfo_bounds">bounds</a> | incomplete |
-| <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> | incomplete |
-| <a href="#SkImageInfo_colorSpace">colorSpace</a> | incomplete |
-| <a href="#SkImageInfo_colorType">colorType</a> | incomplete |
+| <a href="#SkImageInfo_alphaType">alphaType</a> | Returns <a href="#Alpha_Type">Alpha Type</a> |
+| <a href="#SkImageInfo_bounds">bounds</a> | returns <a href="#SkImageInfo_width">width</a> and <a href="#SkImageInfo_height">height</a> as Rectangle |
+| <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> | returns number of bytes in pixel based on <a href="#Color_Type">Color Type</a> |
+| <a href="#SkImageInfo_colorSpace">colorSpace</a> | returns <a href="undocumented#Color_Space">Color Space</a> |
+| <a href="#SkImageInfo_colorType">colorType</a> | returns <a href="#Color_Type">Color Type</a> |
| <a href="#SkImageInfo_computeByteSize">computeByteSize</a> | incomplete |
| <a href="#SkImageInfo_computeMinByteSize">computeMinByteSize</a> | incomplete |
-| <a href="#SkImageInfo_computeOffset">computeOffset</a> | incomplete |
-| <a href="#SkImageInfo_dimensions">dimensions</a> | incomplete |
+| <a href="#SkImageInfo_computeOffset">computeOffset</a> | returns byte offset within pixel array |
+| <a href="#SkImageInfo_dimensions">dimensions</a> | returns <a href="#SkImageInfo_width">width</a> and <a href="#SkImageInfo_height">height</a> |
| <a href="#SkImageInfo_flatten">flatten</a> | incomplete |
-| <a href="#SkImageInfo_gammaCloseToSRGB">gammaCloseToSRGB</a> | incomplete |
+| <a href="#SkImageInfo_gammaCloseToSRGB">gammaCloseToSRGB</a> | Returns if <a href="undocumented#Color_Space">Color Space</a> gamma is approximately the same as sRGB |
| <a href="#SkImageInfo_height">height</a> | returns pixel row count |
-| <a href="#SkImageInfo_isEmpty">isEmpty</a> | incomplete |
-| <a href="#SkImageInfo_isOpaque">isOpaque</a> | incomplete |
+| <a href="#SkImageInfo_isEmpty">isEmpty</a> | returns if dimensions contain pixels |
+| <a href="#SkImageInfo_isOpaque">isOpaque</a> | returns if <a href="#Alpha_Type">Alpha Type</a> is <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> |
| <a href="#SkImageInfo_makeAlphaType">makeAlphaType</a> | creates <a href="#Image_Info">Image Info</a> with changed <a href="#Alpha_Type">Alpha Type</a> |
| <a href="#SkImageInfo_makeColorSpace">makeColorSpace</a> | creates <a href="#Image_Info">Image Info</a> with changed <a href="undocumented#Color_Space">Color Space</a> |
| <a href="#SkImageInfo_makeColorType">makeColorType</a> | creates <a href="#Image_Info">Image Info</a> with changed <a href="#Color_Type">Color Type</a> |
| <a href="#SkImageInfo_makeWH">makeWH</a> | creates <a href="#Image_Info">Image Info</a> with changed dimensions |
-| <a href="#SkImageInfo_minRowBytes">minRowBytes</a> | incomplete |
-| <a href="#SkImageInfo_minRowBytes64">minRowBytes64</a> | incomplete |
-| <a href="#SkImageInfo_refColorSpace">refColorSpace</a> | incomplete |
+| <a href="#SkImageInfo_minRowBytes">minRowBytes</a> | returns <a href="#SkImageInfo_width">width</a> times <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> in 32 bits |
+| <a href="#SkImageInfo_minRowBytes64">minRowBytes64</a> | returns <a href="#SkImageInfo_width">width</a> times <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> in 64 bits |
+| <a href="#SkImageInfo_refColorSpace">refColorSpace</a> | returns <a href="undocumented#Color_Space">Color Space</a> |
| <a href="#SkImageInfo_reset">reset</a> | incomplete |
-| <a href="#SkImageInfo_shiftPerPixel">shiftPerPixel</a> | incomplete |
+| <a href="#SkImageInfo_shiftPerPixel">shiftPerPixel</a> | returns bit shift from pixels to bytes |
| <a href="#SkImageInfo_unflatten">unflatten</a> | incomplete |
| <a href="#SkImageInfo_validRowBytes">validRowBytes</a> | incomplete |
| <a href="#SkImageInfo_validate">validate</a> | incomplete |
@@ -568,7 +702,7 @@ empty <a href="#Image_Info">Image Info</a>
### Example
-<div><fiddle-embed name="20a156a9ca80ec081426b7e975383443"><div>An empty <a href="#Image_Info">Image Info</a> may be passed to <a href="SkCanvas_Reference#SkCanvas_accessTopLayerPixels">SkCanvas::accessTopLayerPixels</a> as storage
+<div><fiddle-embed name="f206f698e7a8db3d84334c26b1a702dc"><div>An empty <a href="#Image_Info">Image Info</a> may be passed to <a href="SkCanvas_Reference#SkCanvas_accessTopLayerPixels">SkCanvas::accessTopLayerPixels</a> as storage
for the <a href="SkCanvas_Reference#Canvas">Canvas</a> actual <a href="#Image_Info">Image Info</a>.
</div></fiddle-embed></div>
@@ -608,7 +742,7 @@ one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlp
<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
</tr> <tr> <td><a name="SkImageInfo_Make_at"> <code><strong>at </strong></code> </a></td> <td>
one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
-<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr> <tr> <td><a name="SkImageInfo_Make_cs"> <code><strong>cs </strong></code> </a></td> <td>
range of colors; may be nullptr</td>
</tr>
@@ -653,7 +787,7 @@ pixel column count; must be zero or greater</td>
pixel row count; must be zero or greater</td>
</tr> <tr> <td><a name="SkImageInfo_MakeN32_at"> <code><strong>at </strong></code> </a></td> <td>
one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
-<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr> <tr> <td><a name="SkImageInfo_MakeN32_cs"> <code><strong>cs </strong></code> </a></td> <td>
range of colors; may be nullptr</td>
</tr>
@@ -694,7 +828,7 @@ pixel column count; must be zero or greater</td>
pixel row count; must be zero or greater</td>
</tr> <tr> <td><a name="SkImageInfo_MakeS32_at"> <code><strong>at </strong></code> </a></td> <td>
one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
-<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr>
</table>
@@ -819,7 +953,7 @@ created <a href="#Image_Info">Image Info</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="547388991687b8e10d482d8b1c82777d"></fiddle-embed></div>
### See Also
@@ -893,20 +1027,20 @@ created <a href="#Image_Info">Image Info</a>
| name | description |
| --- | --- |
-| <a href="#SkImageInfo_alphaType">alphaType</a> | incomplete |
-| <a href="#SkImageInfo_bounds">bounds</a> | incomplete |
-| <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> | incomplete |
-| <a href="#SkImageInfo_colorSpace">colorSpace</a> | incomplete |
-| <a href="#SkImageInfo_colorType">colorType</a> | incomplete |
-| <a href="#SkImageInfo_dimensions">dimensions</a> | incomplete |
-| <a href="#SkImageInfo_gammaCloseToSRGB">gammaCloseToSRGB</a> | incomplete |
+| <a href="#SkImageInfo_alphaType">alphaType</a> | Returns <a href="#Alpha_Type">Alpha Type</a> |
+| <a href="#SkImageInfo_bounds">bounds</a> | returns <a href="#SkImageInfo_width">width</a> and <a href="#SkImageInfo_height">height</a> as Rectangle |
+| <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> | returns number of bytes in pixel based on <a href="#Color_Type">Color Type</a> |
+| <a href="#SkImageInfo_colorSpace">colorSpace</a> | returns <a href="undocumented#Color_Space">Color Space</a> |
+| <a href="#SkImageInfo_colorType">colorType</a> | returns <a href="#Color_Type">Color Type</a> |
+| <a href="#SkImageInfo_dimensions">dimensions</a> | returns <a href="#SkImageInfo_width">width</a> and <a href="#SkImageInfo_height">height</a> |
+| <a href="#SkImageInfo_gammaCloseToSRGB">gammaCloseToSRGB</a> | Returns if <a href="undocumented#Color_Space">Color Space</a> gamma is approximately the same as sRGB |
| <a href="#SkImageInfo_height">height</a> | returns pixel row count |
-| <a href="#SkImageInfo_isEmpty">isEmpty</a> | incomplete |
-| <a href="#SkImageInfo_isOpaque">isOpaque</a> | incomplete |
-| <a href="#SkImageInfo_minRowBytes">minRowBytes</a> | incomplete |
-| <a href="#SkImageInfo_minRowBytes64">minRowBytes64</a> | incomplete |
-| <a href="#SkImageInfo_refColorSpace">refColorSpace</a> | incomplete |
-| <a href="#SkImageInfo_shiftPerPixel">shiftPerPixel</a> | incomplete |
+| <a href="#SkImageInfo_isEmpty">isEmpty</a> | returns if dimensions contain pixels |
+| <a href="#SkImageInfo_isOpaque">isOpaque</a> | returns if <a href="#Alpha_Type">Alpha Type</a> is <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> |
+| <a href="#SkImageInfo_minRowBytes">minRowBytes</a> | returns <a href="#SkImageInfo_width">width</a> times <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> in 32 bits |
+| <a href="#SkImageInfo_minRowBytes64">minRowBytes64</a> | returns <a href="#SkImageInfo_width">width</a> times <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> in 64 bits |
+| <a href="#SkImageInfo_refColorSpace">refColorSpace</a> | returns <a href="undocumented#Color_Space">Color Space</a> |
+| <a href="#SkImageInfo_shiftPerPixel">shiftPerPixel</a> | returns bit shift from pixels to bytes |
| <a href="#SkImageInfo_width">width</a> | returns pixel column count |
<a name="SkImageInfo_width"></a>
@@ -973,11 +1107,19 @@ Returns <a href="#Color_Type">Color Type</a>, one of: <a href="#kUnknown_SkColor
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="06ecc3ce7f35cc7f930cbc2a662e3105">
+
+#### Example Output
+
+~~~~
+color type: kAlpha_8_SkColorType
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_alphaType">alphaType</a> <a href="SkPixmap_Reference#SkPixmap_colorType">SkPixmap::colorType</a> <a href="SkBitmap_Reference#SkBitmap_colorType">SkBitmap::colorType</a>
---
@@ -988,17 +1130,28 @@ incomplete
SkAlphaType alphaType() const
</pre>
+Returns <a href="#Alpha_Type">Alpha Type</a>, one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.
+
### Return Value
-incomplete
+<a href="#Alpha_Type">Alpha Type</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="5c1d2499a4056b6cff38c1cf924158a1">
+
+#### Example Output
+
+~~~~
+alpha type: kPremul_SkAlphaType
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_colorType">colorType</a> <a href="SkPixmap_Reference#SkPixmap_alphaType">SkPixmap::alphaType</a> <a href="SkBitmap_Reference#SkBitmap_alphaType">SkBitmap::alphaType</a>
---
@@ -1009,17 +1162,30 @@ incomplete
SkColorSpace* colorSpace() const
</pre>
+Returns <a href="undocumented#Color_Space">Color Space</a>, the range of colors. The reference count of
+<a href="undocumented#Color_Space">Color Space</a> is unchanged. The returned <a href="undocumented#Color_Space">Color Space</a> is immutable.
+
### Return Value
-incomplete
+<a href="undocumented#Color_Space">Color Space</a>, or nullptr
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="2952a6c863bd504484c9f66cc727f968"><div><a href="undocumented#SkColorSpace_MakeSRGBLinear">SkColorSpace::MakeSRGBLinear</a> creates <a href="undocumented#Color_Space">Color Space</a> with linear gamma
+and an sRGB gamut. This <a href="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.
+</div>
+
+#### Example Output
+
+~~~~
+gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="undocumented#Color_Space">Color Space</a> <a href="SkPixmap_Reference#SkPixmap_colorSpace">SkPixmap::colorSpace</a> <a href="SkBitmap_Reference#SkBitmap_colorSpace">SkBitmap::colorSpace</a>
---
@@ -1030,17 +1196,23 @@ incomplete
sk_sp&lt;SkColorSpace&gt; refColorSpace() const
</pre>
+Returns smart pointer to <a href="undocumented#Color_Space">Color Space</a>, the range of colors. The smart pointer
+tracks the number of objects sharing this <a href="undocumented#Color_Space">Color Space</a> reference so the memory
+is released when the owners destruct.
+
+The returned <a href="undocumented#Color_Space">Color Space</a> is immutable.
+
### Return Value
-incomplete
+<a href="undocumented#Color_Space">Color Space</a> wrapped in a smart pointer
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="f36afcc295602f5c8c4c2c2025c25884"></fiddle-embed></div>
### See Also
-incomplete
+<a href="undocumented#Color_Space">Color Space</a> <a href="SkBitmap_Reference#SkBitmap_refColorSpace">SkBitmap::refColorSpace</a>
---
@@ -1051,17 +1223,31 @@ incomplete
bool isEmpty() const
</pre>
+Returns if <a href="#Image_Info">Image Info</a> describes an empty area of pixels by checking if either
+width or height is zero or smaller.
+
### Return Value
-incomplete
+true if either dimension is zero or smaller
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="b8757200da5be0b43763cf79feb681a7">
+
+#### Example Output
+
+~~~~
+width: 0 height: 0 empty: true
+width: 0 height: 2 empty: true
+width: 2 height: 0 empty: true
+width: 2 height: 2 empty: false
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_dimensions">dimensions</a> <a href="#SkImageInfo_bounds">bounds</a> <a href="SkBitmap_Reference#SkBitmap_empty">SkBitmap::empty</a> <a href="SkPixmap_Reference#SkPixmap_bounds">SkPixmap::bounds</a>
---
@@ -1072,17 +1258,35 @@ incomplete
bool isOpaque() const
</pre>
+Returns true if <a href="#Alpha_Type">Alpha Type</a> is set to hint that all pixels are opaque; their
+<a href="undocumented#Alpha">Color Alpha</a> value is implicitly or explicitly 1.0. If true, and all pixels are
+not opaque, Skia may draw incorrectly.
+
+Does not check if <a href="#Color_Type">Color Type</a> allows <a href="undocumented#Alpha">Alpha</a>, or if any pixel value has
+transparency.
+
### Return Value
-incomplete
+true if <a href="#Alpha_Type">Alpha Type</a> is <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="e9bd4f02b6cfb3ac864cb7fee7d7299c">
+
+#### Example Output
+
+~~~~
+isOpaque: false
+isOpaque: false
+isOpaque: true
+isOpaque: true
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="undocumented#Alpha">Color Alpha</a> <a href="#SkColorTypeValidateAlphaType">SkColorTypeValidateAlphaType</a> <a href="SkBitmap_Reference#SkBitmap_isOpaque">SkBitmap::isOpaque</a> <a href="SkImage_Reference#SkImage_isOpaque">SkImage::isOpaque</a> <a href="SkPixmap_Reference#SkPixmap_isOpaque">SkPixmap::isOpaque</a>
---
@@ -1093,17 +1297,27 @@ incomplete
SkISize dimensions() const
</pre>
+Returns <a href="undocumented#ISize">ISize</a> { <a href="#SkImageInfo_width">width</a>, <a href="#SkImageInfo_height">height</a> }.
+
### Return Value
-incomplete
+integral size of <a href="#SkImageInfo_width">width</a> and <a href="#SkImageInfo_height">height</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="d5547cd2b302822aa85b7b0ae3f48458">
+
+#### Example Output
+
+~~~~
+dimensionsAsBounds == bounds
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_width">width</a> <a href="#SkImageInfo_height">height</a> <a href="#SkImageInfo_bounds">bounds</a> <a href="SkBitmap_Reference#SkBitmap_dimensions">SkBitmap::dimensions</a>
---
@@ -1114,17 +1328,19 @@ incomplete
SkIRect bounds() const
</pre>
+Returns <a href="SkIRect_Reference#IRect">IRect</a> { 0, 0, <a href="#SkImageInfo_width">width</a>, <a href="#SkImageInfo_height">height</a> }.
+
### Return Value
-incomplete
+integral rectangle from origin to <a href="#SkImageInfo_width">width</a> and <a href="#SkImageInfo_height">height</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="a818be8945cd0c18f99ffe53e90afa48"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_width">width</a> <a href="#SkImageInfo_height">height</a> <a href="#SkImageInfo_dimensions">dimensions</a>
---
@@ -1135,17 +1351,21 @@ incomplete
bool gammaCloseToSRGB() const
</pre>
+Returns true if associated <a href="undocumented#Color_Space">Color Space</a> is not nullptr, and <a href="undocumented#Color_Space">Color Space</a> gamma
+is approximately the same as sRGB.
+This includes the <a href="">sRGB transfer function $ https://en.wikipedia.org/wiki/SRGB#The_sRGB_transfer_function_(%22gamma%22)</a> as well as a gamma curve described by a 2.2 exponent.
+
### Return Value
-incomplete
+true if <a href="undocumented#Color_Space">Color Space</a> gamma is approximately the same as sRGB
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="dcdc308a1a2089db47b8375178491832"></fiddle-embed></div>
### See Also
-incomplete
+<a href="undocumented#SkColorSpace_gammaCloseToSRGB">SkColorSpace::gammaCloseToSRGB</a>
---
@@ -1156,29 +1376,29 @@ incomplete
SkImageInfo makeWH(int newWidth, int newHeight) const
</pre>
-Creates <a href="#Image_Info">Image Info</a> with the same <a href="#Color_Type">Color Type</a> and <a href="#Alpha_Type">Alpha Type</a> as this info,
-but with the specified width and height.
+Creates <a href="#Image_Info">Image Info</a> with the same <a href="#Color_Type">Color Type</a>, <a href="undocumented#Color_Space">Color Space</a>, and <a href="#Alpha_Type">Alpha Type</a>,
+with dimensions set to width and height.
### Parameters
<table> <tr> <td><a name="SkImageInfo_makeWH_newWidth"> <code><strong>newWidth </strong></code> </a></td> <td>
-incomplete</td>
+pixel column count; must be zero or greater</td>
</tr> <tr> <td><a name="SkImageInfo_makeWH_newHeight"> <code><strong>newHeight </strong></code> </a></td> <td>
-incomplete</td>
+pixel row count; must be zero or greater</td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image_Info">Image Info</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="26827898b6b199d6c4b5e4d2c6e6bac8"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_makeAlphaType">makeAlphaType</a> <a href="#SkImageInfo_makeColorSpace">makeColorSpace</a> <a href="#SkImageInfo_makeColorType">makeColorType</a>
---
@@ -1189,24 +1409,31 @@ incomplete
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
</pre>
+Creates <a href="#Image_Info">Image Info</a> with same <a href="#Color_Type">Color Type</a>, <a href="undocumented#Color_Space">Color Space</a>, width, and height,
+with <a href="#Alpha_Type">Alpha Type</a> set to <a href="#SkImageInfo_makeAlphaType_newAlphaType">newAlphaType</a>.
+
+Created <a href="#Image_Info">Image Info</a> contains <a href="#SkImageInfo_makeAlphaType_newAlphaType">newAlphaType</a> even if it is incompatible with
+<a href="#Color_Type">Color Type</a>, in which case <a href="#Alpha_Type">Alpha Type</a> in <a href="#Image_Info">Image Info</a> is ignored.
+
### Parameters
<table> <tr> <td><a name="SkImageInfo_makeAlphaType_newAlphaType"> <code><strong>newAlphaType </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image_Info">Image Info</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="5166f1a04d53443ed8aed519d0faa3db"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_MakeA8">MakeA8</a> <a href="#SkImageInfo_makeColorType">makeColorType</a> <a href="#SkImageInfo_makeColorSpace">makeColorSpace</a>
---
@@ -1217,24 +1444,30 @@ incomplete
SkImageInfo makeColorType(SkColorType newColorType) const
</pre>
+Creates <a href="#Image_Info">Image Info</a> with same <a href="#Alpha_Type">Alpha Type</a>, <a href="undocumented#Color_Space">Color Space</a>, width, and height,
+with <a href="#Color_Type">Color Type</a> set to <a href="#SkImageInfo_makeColorType_newColorType">newColorType</a>.
+
### Parameters
<table> <tr> <td><a name="SkImageInfo_makeColorType_newColorType"> <code><strong>newColorType </strong></code> </a></td> <td>
-incomplete</td>
+one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image_Info">Image Info</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="0d67609fbf0988bfaf9ca5e2460af3d3"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_makeAlphaType">makeAlphaType</a> <a href="#SkImageInfo_makeColorSpace">makeColorSpace</a>
---
@@ -1245,24 +1478,27 @@ incomplete
SkImageInfo makeColorSpace(sk_sp&lt;SkColorSpace&gt; cs) const
</pre>
+Creates <a href="#Image_Info">Image Info</a> with same <a href="#Alpha_Type">Alpha Type</a>, <a href="#Color_Type">Color Type</a>, width, and height,
+with <a href="undocumented#Color_Space">Color Space</a> set to <a href="#SkImageInfo_makeColorSpace_cs">cs</a>.
+
### Parameters
<table> <tr> <td><a name="SkImageInfo_makeColorSpace_cs"> <code><strong>cs </strong></code> </a></td> <td>
-incomplete</td>
+range of colors; may be nullptr</td>
</tr>
</table>
### Return Value
-incomplete
+created <a href="#Image_Info">Image Info</a>
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="454add968099811053e2b372238472e3"></fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_makeAlphaType">makeAlphaType</a> <a href="#SkImageInfo_makeColorType">makeColorType</a>
---
@@ -1273,17 +1509,41 @@ incomplete
int bytesPerPixel() const
</pre>
+Returns number of bytes per pixel required by <a href="#Color_Type">Color Type</a>.
+Returns zero if <a href="#SkImageInfo_colorType">colorType</a>( is <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>.
+
### Return Value
-incomplete
+bytes in pixel
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="9b6de4a07b2316228e9340e5a3b82134"><a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>
+
+#### Example Output
+
+~~~~
+color: kUnknown_SkColorType bytesPerPixel: 0
+color: kAlpha_8_SkColorType bytesPerPixel: 1
+color: kRGB_565_SkColorType bytesPerPixel: 2
+color: kARGB_4444_SkColorType bytesPerPixel: 2
+color: kRGBA_8888_SkColorType bytesPerPixel: 4
+color: kRGB_888x_SkColorType bytesPerPixel: 4
+color: kBGRA_8888_SkColorType bytesPerPixel: 4
+color: kRGBA_1010102_SkColorType bytesPerPixel: 4
+color: kRGB_101010x_SkColorType bytesPerPixel: 4
+color: kGray_8_SkColorType bytesPerPixel: 1
+color: kRGBA_F16_SkColorType bytesPerPixel: 8
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_width">width</a> <a href="#SkImageInfo_shiftPerPixel">shiftPerPixel</a> <a href="SkBitmap_Reference#SkBitmap_bytesPerPixel">SkBitmap::bytesPerPixel</a>
---
@@ -1294,13 +1554,37 @@ incomplete
int shiftPerPixel() const
</pre>
+Returns bit shift converting row bytes to row pixels.
+Returns zero for <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>.
+
### Return Value
-incomplete
+one of: 0, 1, 2, 3; left shift to convert pixels to bytes
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="e47b911f94fc629f756a829e523a2a89"><a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
+<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
+<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
+<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>
+
+#### Example Output
+
+~~~~
+color: kUnknown_SkColorType shiftPerPixel: 0
+color: kAlpha_8_SkColorType shiftPerPixel: 0
+color: kRGB_565_SkColorType shiftPerPixel: 1
+color: kARGB_4444_SkColorType shiftPerPixel: 1
+color: kRGBA_8888_SkColorType shiftPerPixel: 2
+color: kRGB_888x_SkColorType shiftPerPixel: 2
+color: kBGRA_8888_SkColorType shiftPerPixel: 2
+color: kRGBA_1010102_SkColorType shiftPerPixel: 2
+color: kRGB_101010x_SkColorType shiftPerPixel: 2
+color: kGray_8_SkColorType shiftPerPixel: 0
+color: kRGBA_F16_SkColorType shiftPerPixel: 3
+~~~~
+
+</fiddle-embed></div>
### See Also
@@ -1315,17 +1599,36 @@ incomplete
uint64_t minRowBytes64() const
</pre>
+Returns minimum bytes per row, computed from pixel <a href="#SkImageInfo_width">width</a> and <a href="#Color_Type">Color Type</a>, which
+specifies <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a>. <a href="SkBitmap_Reference#Bitmap">Bitmap</a> maximum value for row bytes must be representable
+as a positive value in a 32-bit signed integer.
+
### Return Value
-incomplete
+<a href="#SkImageInfo_width">width</a> times <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> as unsigned 64-bit integer
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="3004125e67431bd7a5c0ff3863aad8a0">
+
+#### Example Output
+
+~~~~
+RGBA_F16 width 16777216 (0x01000000) OK
+RGBA_F16 width 33554432 (0x02000000) OK
+RGBA_F16 width 67108864 (0x04000000) OK
+RGBA_F16 width 134217728 (0x08000000) OK
+RGBA_F16 width 268435456 (0x10000000) too large
+RGBA_F16 width 536870912 (0x20000000) too large
+RGBA_F16 width 1073741824 (0x40000000) too large
+RGBA_F16 width -2147483648 (0x80000000) too large
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_minRowBytes">minRowBytes</a> <a href="#SkImageInfo_computeByteSize">computeByteSize</a> <a href="#SkImageInfo_computeMinByteSize">computeMinByteSize</a> <a href="#SkImageInfo_validRowBytes">validRowBytes</a>
---
@@ -1336,17 +1639,36 @@ incomplete
size_t minRowBytes() const
</pre>
+Returns minimum bytes per row, computed from pixel <a href="#SkImageInfo_width">width</a> and <a href="#Color_Type">Color Type</a>, which
+specifies <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a>. <a href="SkBitmap_Reference#Bitmap">Bitmap</a> maximum value for row bytes must be representable
+as a positive value in a 32-bit signed integer.
+
### Return Value
-incomplete
+<a href="#SkImageInfo_width">width</a> times <a href="#SkImageInfo_bytesPerPixel">bytesPerPixel</a> as signed 32-bit integer
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="4cb6975732a7ffab2c9ebac31af1432e">
+
+#### Example Output
+
+~~~~
+RGBA_F16 width 16777216 (0x01000000) OK
+RGBA_F16 width 33554432 (0x02000000) OK
+RGBA_F16 width 67108864 (0x04000000) OK
+RGBA_F16 width 134217728 (0x08000000) OK
+RGBA_F16 width 268435456 (0x10000000) too large
+RGBA_F16 width 536870912 (0x20000000) too large
+RGBA_F16 width 1073741824 (0x40000000) too large
+RGBA_F16 width -2147483648 (0x80000000) too large
+~~~~
+
+</fiddle-embed></div>
### See Also
-incomplete
+<a href="#SkImageInfo_minRowBytes64">minRowBytes64</a> <a href="#SkImageInfo_computeByteSize">computeByteSize</a> <a href="#SkImageInfo_computeMinByteSize">computeMinByteSize</a> <a href="#SkImageInfo_validRowBytes">validRowBytes</a>
---
@@ -1357,24 +1679,29 @@ incomplete
size_t computeOffset(int x, int y, size_t rowBytes) const
</pre>
+Returns byte offset of pixel from pixel base address.
+
+Asserts in debug build if <a href="#SkImageInfo_computeOffset_x">x</a> or <a href="#SkImageInfo_computeOffset_y">y</a> is outside of bounds. Does not assert if
+<a href="#SkImageInfo_computeOffset_rowBytes">rowBytes</a> is smaller than <a href="#SkImageInfo_minRowBytes">minRowBytes</a>, even though result may be incorrect.
+
### Parameters
<table> <tr> <td><a name="SkImageInfo_computeOffset_x"> <code><strong>x </strong></code> </a></td> <td>
-incomplete</td>
+column index, zero or greater, and less than <a href="#SkImageInfo_width">width</a></td>
</tr> <tr> <td><a name="SkImageInfo_computeOffset_y"> <code><strong>y </strong></code> </a></td> <td>
-incomplete</td>
+row index, zero or greater, and less than <a href="#SkImageInfo_height">height</a></td>
</tr> <tr> <td><a name="SkImageInfo_computeOffset_rowBytes"> <code><strong>rowBytes </strong></code> </a></td> <td>
-incomplete</td>
+size of pixel row or larger</td>
</tr>
</table>
### Return Value
-incomplete
+offset within pixel array
### Example
-<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+<div><fiddle-embed name="0a1ddddfe4f01c025e893ae826cb4ece"></fiddle-embed></div>
### See Also
@@ -1636,7 +1963,7 @@ incomplete
| <a href="#SkImageInfo_ByteSizeOverflowed">ByteSizeOverflowed</a> | incomplete |
| <a href="#SkImageInfo_computeByteSize">computeByteSize</a> | incomplete |
| <a href="#SkImageInfo_computeMinByteSize">computeMinByteSize</a> | incomplete |
-| <a href="#SkImageInfo_computeOffset">computeOffset</a> | incomplete |
+| <a href="#SkImageInfo_computeOffset">computeOffset</a> | returns byte offset within pixel array |
| <a href="#SkImageInfo_flatten">flatten</a> | incomplete |
| <a href="#SkImageInfo_unflatten">unflatten</a> | incomplete |
| <a href="#SkImageInfo_validRowBytes">validRowBytes</a> | incomplete |
diff --git a/site/user/api/SkImage_Reference.md b/site/user/api/SkImage_Reference.md
index 34bc2ee418..c40598f150 100644
--- a/site/user/api/SkImage_Reference.md
+++ b/site/user/api/SkImage_Reference.md
@@ -77,16 +77,16 @@ drawing.
| <a href="#SkImage_MakeFromBitmap">MakeFromBitmap</a> | creates <a href="#Image">Image</a> from <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, sharing or copying pixels |
| <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> | creates <a href="#Image">Image</a> from encoded data |
| <a href="#SkImage_MakeFromGenerator">MakeFromGenerator</a> | creates <a href="#Image">Image</a> from a stream of data |
-| <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a> | creates <a href="#Image">Image</a> from <a href="SkImageInfo_Reference#YUV_ColorSpace">YUV ColorSpace</a> data in two planes |
-| | <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendObject nv12TextureHandles[2], const SkISize nv12Sizes[2], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
-| | <a href="#SkImage_MakeFromNV12TexturesCopy_2">MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendTexture nv12TextureHandles[2], const SkISize nv12Sizes[2], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
+| <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a> | creates <a href="#Image">Image</a> from <a href="SkImageInfo_Reference#YUV_ColorSpace">YUV ColorSpace</a> data in three planes |
+| | <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendTexture nv12Textures[2], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
+| | <a href="#SkImage_MakeFromNV12TexturesCopy_2">MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendTexture nv12Textures[2], const SkISize nv12Sizes[2], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
| <a href="#SkImage_MakeFromPicture">MakeFromPicture</a> | creates <a href="#Image">Image</a> from <a href="undocumented#Picture">Picture</a> |
| <a href="#SkImage_MakeFromRaster">MakeFromRaster</a> | creates <a href="#Image">Image</a> from <a href="SkPixmap_Reference#Pixmap">Pixmap</a>, with release |
| <a href="#SkImage_MakeFromTexture_3">MakeFromTexture 3</a> | creates <a href="#Image">Image</a> from <a href="undocumented#GPU_Texture">GPU Texture</a> |
| | static <a href="undocumented#sk_sp">sk sp</a>&lt;<a href="#SkImage">SkImage</a>&gt; <a href="#SkImage_MakeFromTexture_3">MakeFromTexture(GrContext* context, const GrBackendTexture& backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk sp&lt;SkColorSpace&gt; colorSpace)</a> |
| <a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a> | creates <a href="#Image">Image</a> from <a href="SkImageInfo_Reference#YUV_ColorSpace">YUV ColorSpace</a> data in three planes |
-| | <a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendObject yuvTextureHandles[3], const SkISize yuvSizes[3], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
-| | <a href="#SkImage_MakeFromYUVTexturesCopy_2">MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendTexture yuvTextureHandles[3], const SkISize yuvSizes[3], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
+| | <a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendTexture yuvTextures[3], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
+| | <a href="#SkImage_MakeFromYUVTexturesCopy_2">MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace, const GrBackendTexture yuvTextures[3], const SkISize yuvSizes[3], GrSurfaceOrigin surfaceOrigin, sk sp&lt;SkColorSpace&gt; colorSpace = nullptr)</a> |
| <a href="#SkImage_MakeRasterCopy">MakeRasterCopy</a> | creates <a href="#Image">Image</a> from <a href="SkPixmap_Reference#Pixmap">Pixmap</a> and copied pixels |
| <a href="#SkImage_MakeRasterData">MakeRasterData</a> | creates <a href="#Image">Image</a> from <a href="SkImageInfo_Reference#Image_Info">Image Info</a> and shared pixels |
| <a href="#SkImage_asLegacyBitmap">asLegacyBitmap</a> | returns as <a href="undocumented#Raster_Bitmap">Raster Bitmap</a> |
@@ -112,7 +112,7 @@ drawing.
| <a href="#SkImage_MakeFromBitmap">MakeFromBitmap</a> | creates <a href="#Image">Image</a> from <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, sharing or copying pixels |
| <a href="#SkImage_MakeFromEncoded">MakeFromEncoded</a> | creates <a href="#Image">Image</a> from encoded data |
| <a href="#SkImage_MakeFromGenerator">MakeFromGenerator</a> | creates <a href="#Image">Image</a> from a stream of data |
-| <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a> | creates <a href="#Image">Image</a> from <a href="SkImageInfo_Reference#YUV_ColorSpace">YUV ColorSpace</a> data in two planes |
+| <a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a> | creates <a href="#Image">Image</a> from <a href="SkImageInfo_Reference#YUV_ColorSpace">YUV ColorSpace</a> data in three planes |
| <a href="#SkImage_MakeFromPicture">MakeFromPicture</a> | creates <a href="#Image">Image</a> from <a href="undocumented#Picture">Picture</a> |
| <a href="#SkImage_MakeFromRaster">MakeFromRaster</a> | creates <a href="#Image">Image</a> from <a href="SkPixmap_Reference#Pixmap">Pixmap</a>, with release |
| <a href="#SkImage_MakeFromTexture_3">MakeFromTexture 3</a> | creates <a href="#Image">Image</a> from <a href="undocumented#GPU_Texture">GPU Texture</a> |
@@ -123,6 +123,7 @@ drawing.
| <a href="#SkImage_asLegacyBitmap">asLegacyBitmap</a> | returns as <a href="undocumented#Raster_Bitmap">Raster Bitmap</a> |
| <a href="#SkImage_bounds">bounds</a> | returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> as Rectangle |
| <a href="#SkImage_colorSpace">colorSpace</a> | returns <a href="undocumented#Color_Space">Color Space</a> |
+| <a href="#SkImage_colorType">colorType</a> | returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a> |
| <a href="#SkImage_dimensions">dimensions</a> | returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> |
| <a href="#SkImage_encodeToData">encodeToData</a> | returns encoded <a href="#Image">Image</a> as <a href="undocumented#SkData">SkData</a> |
| <a href="#SkImage_getTextureHandle">getTextureHandle</a> | returns GPU reference to <a href="#Image">Image</a> as texture |
@@ -474,8 +475,8 @@ one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorTyp
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_3_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_3_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
range of colors; may be nullptr</td>
</tr>
@@ -527,8 +528,8 @@ one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorTyp
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_4_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_4_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
range of colors; may be nullptr</td>
</tr> <tr> <td><a name="SkImage_MakeFromTexture_4_textureReleaseProc"> <code><strong>textureReleaseProc </strong></code> </a></td> <td>
@@ -701,8 +702,8 @@ one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorTyp
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
range of colors; may be nullptr</td>
</tr>
@@ -727,17 +728,14 @@ created <a href="#Image">Image</a>, or nullptr
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
static sk_sp&lt;SkImage&gt; MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendObject yuvTextureHandles[3],
- const SkISize yuvSizes[3],
+ const GrBackendTexture yuvTextures[3],
GrSurfaceOrigin surfaceOrigin,
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextureHandles">yuvTextureHandles</a>, an array of textures on GPU.
-<a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextureHandles">yuvTextureHandles</a> contain pixels for YUV planes of <a href="#Image">Image</a>.
-<a href="#SkImage_MakeFromYUVTexturesCopy_yuvSizes">yuvSizes</a> contain dimensions for each pixel plane. Dimensions must be greater than
-zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the dimensions
-<a href="#SkImage_MakeFromYUVTexturesCopy_yuvSizes">yuvSizes</a>[0]. <a href="#SkImage_MakeFromYUVTexturesCopy_yuvColorSpace">yuvColorSpace</a> describes how YUV colors convert to RGB colors.
+Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextures">yuvTextures</a>, an array of textures on GPU.
+<a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextures">yuvTextures</a> contain pixels for YUV planes of <a href="#Image">Image</a>. Returned <a href="#Image">Image</a> has the dimensions
+<a href="#SkImage_MakeFromYUVTexturesCopy_yuvTextures">yuvTextures</a>[0]. <a href="#SkImage_MakeFromYUVTexturesCopy_yuvColorSpace">yuvColorSpace</a> describes how YUV colors convert to RGB colors.
### Parameters
@@ -746,10 +744,8 @@ zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
one of: <a href="SkImageInfo_Reference#kJPEG_SkYUVColorSpace">kJPEG_SkYUVColorSpace</a>, <a href="SkImageInfo_Reference#kRec601_SkYUVColorSpace">kRec601_SkYUVColorSpace</a>,
<a href="SkImageInfo_Reference#kRec709_SkYUVColorSpace">kRec709_SkYUVColorSpace</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvTextureHandles"> <code><strong>yuvTextureHandles </strong></code> </a></td> <td>
+ </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvTextures"> <code><strong>yuvTextures </strong></code> </a></td> <td>
array of YUV textures on GPU</td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_yuvSizes"> <code><strong>yuvSizes </strong></code> </a></td> <td>
-dimensions of YUV textures</td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
@@ -771,44 +767,12 @@ created <a href="#Image">Image</a>, or nullptr
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
static sk_sp&lt;SkImage&gt; MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendTexture yuvTextureHandles[3],
+ const GrBackendTexture yuvTextures[3],
const SkISize yuvSizes[3],
GrSurfaceOrigin surfaceOrigin,
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvTextureHandles">yuvTextureHandles</a>, an array of textures on GPU.
-<a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvTextureHandles">yuvTextureHandles</a> contain pixels for YUV planes of <a href="#Image">Image</a>.
-<a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvSizes">yuvSizes</a> contain dimensions for each pixel plane. Dimensions must be greater than
-zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the dimensions
-<a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvSizes">yuvSizes</a>[0]. <a href="#SkImage_MakeFromYUVTexturesCopy_2_yuvColorSpace">yuvColorSpace</a> describes how YUV colors convert to RGB colors.
-
-### Parameters
-
-<table> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_context"> <code><strong>context </strong></code> </a></td> <td>
-<a href="undocumented#GPU_Context">GPU Context</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kJPEG_SkYUVColorSpace">kJPEG_SkYUVColorSpace</a>, <a href="SkImageInfo_Reference#kRec601_SkYUVColorSpace">kRec601_SkYUVColorSpace</a>,
-<a href="SkImageInfo_Reference#kRec709_SkYUVColorSpace">kRec709_SkYUVColorSpace</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_yuvTextureHandles"> <code><strong>yuvTextureHandles </strong></code> </a></td> <td>
-array of YUV textures on GPU</td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_yuvSizes"> <code><strong>yuvSizes </strong></code> </a></td> <td>
-dimensions of YUV textures</td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
-one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromYUVTexturesCopy_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-range of colors; may be nullptr</td>
- </tr>
-</table>
-
-### Return Value
-
-created <a href="#Image">Image</a>, or nullptr
-
-### See Also
-
-<a href="#SkImage_MakeFromNV12TexturesCopy">MakeFromNV12TexturesCopy</a><sup><a href="#SkImage_MakeFromNV12TexturesCopy_2">[2]</a></sup>
-
---
<a name="SkImage_MakeFromNV12TexturesCopy"></a>
@@ -816,19 +780,17 @@ created <a href="#Image">Image</a>, or nullptr
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
static sk_sp&lt;SkImage&gt; MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendObject nv12TextureHandles[2],
- const SkISize nv12Sizes[2],
+ const GrBackendTexture nv12Textures[2],
GrSurfaceOrigin surfaceOrigin,
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles">nv12TextureHandles</a>, an array of textures on GPU.
-<a href="#SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles">nv12TextureHandles</a>[0] contains pixels for YUV_Component_Y plane.
-<a href="#SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles">nv12TextureHandles</a>[1] contains pixels for YUV_Component_U plane,
+Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromNV12TexturesCopy_nv12Textures">nv12Textures</a>, an array of textures on GPU.
+<a href="#SkImage_MakeFromNV12TexturesCopy_nv12Textures">nv12Textures</a>[0] contains pixels for YUV_Component_Y plane.
+<a href="#SkImage_MakeFromNV12TexturesCopy_nv12Textures">nv12Textures</a>[1] contains pixels for YUV_Component_U plane,
followed by pixels for YUV_Component_V plane.
-<a href="#SkImage_MakeFromNV12TexturesCopy_nv12Sizes">nv12Sizes</a> contain dimensions for each pixel plane. Dimensions must be greater than
-zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the dimensions
-<a href="#SkImage_MakeFromNV12TexturesCopy_nv12Sizes">nv12Sizes</a>[0]. <a href="#SkImage_MakeFromNV12TexturesCopy_yuvColorSpace">yuvColorSpace</a> describes how YUV colors convert to RGB colors.
+Returned <a href="#Image">Image</a> has the dimensions <a href="#SkImage_MakeFromNV12TexturesCopy_nv12Textures">nv12Textures</a>[2].
+<a href="#SkImage_MakeFromNV12TexturesCopy_yuvColorSpace">yuvColorSpace</a> describes how YUV colors convert to RGB colors.
### Parameters
@@ -837,10 +799,8 @@ zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
one of: <a href="SkImageInfo_Reference#kJPEG_SkYUVColorSpace">kJPEG_SkYUVColorSpace</a>, <a href="SkImageInfo_Reference#kRec601_SkYUVColorSpace">kRec601_SkYUVColorSpace</a>,
<a href="SkImageInfo_Reference#kRec709_SkYUVColorSpace">kRec709_SkYUVColorSpace</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_nv12TextureHandles"> <code><strong>nv12TextureHandles </strong></code> </a></td> <td>
+ </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_nv12Textures"> <code><strong>nv12Textures </strong></code> </a></td> <td>
array of YUV textures on GPU</td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_nv12Sizes"> <code><strong>nv12Sizes </strong></code> </a></td> <td>
-dimensions of YUV textures</td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
</tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
@@ -862,46 +822,12 @@ created <a href="#Image">Image</a>, or nullptr
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
static sk_sp&lt;SkImage&gt; MakeFromNV12TexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendTexture nv12TextureHandles[2],
+ const GrBackendTexture nv12Textures[2],
const SkISize nv12Sizes[2],
GrSurfaceOrigin surfaceOrigin,
sk_sp&lt;SkColorSpace&gt; colorSpace = nullptr)
</pre>
-Creates <a href="#Image">Image</a> from copy of <a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles">nv12TextureHandles</a>, an array of textures on GPU.
-<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles">nv12TextureHandles</a>[0] contains pixels for YUV_Component_Y plane.
-<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles">nv12TextureHandles</a>[1] contains pixels for YUV_Component_U plane,
-followed by pixels for YUV_Component_V plane.
-<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12Sizes">nv12Sizes</a> contain dimensions for each pixel plane. Dimensions must be greater than
-zero but may differ from plane to plane. Returned <a href="#Image">Image</a> has the dimensions
-<a href="#SkImage_MakeFromNV12TexturesCopy_2_nv12Sizes">nv12Sizes</a>[0]. <a href="#SkImage_MakeFromNV12TexturesCopy_2_yuvColorSpace">yuvColorSpace</a> describes how YUV colors convert to RGB colors.
-
-### Parameters
-
-<table> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_context"> <code><strong>context </strong></code> </a></td> <td>
-<a href="undocumented#GPU_Context">GPU Context</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_yuvColorSpace"> <code><strong>yuvColorSpace </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kJPEG_SkYUVColorSpace">kJPEG_SkYUVColorSpace</a>, <a href="SkImageInfo_Reference#kRec601_SkYUVColorSpace">kRec601_SkYUVColorSpace</a>,
-<a href="SkImageInfo_Reference#kRec709_SkYUVColorSpace">kRec709_SkYUVColorSpace</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_nv12TextureHandles"> <code><strong>nv12TextureHandles </strong></code> </a></td> <td>
-array of YUV textures on GPU</td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_nv12Sizes"> <code><strong>nv12Sizes </strong></code> </a></td> <td>
-dimensions of YUV textures</td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
-one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
- </tr> <tr> <td><a name="SkImage_MakeFromNV12TexturesCopy_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
-range of colors; may be nullptr</td>
- </tr>
-</table>
-
-### Return Value
-
-created <a href="#Image">Image</a>, or nullptr
-
-### See Also
-
-<a href="#SkImage_MakeFromYUVTexturesCopy">MakeFromYUVTexturesCopy</a><sup><a href="#SkImage_MakeFromYUVTexturesCopy_2">[2]</a></sup>
-
---
## <a name="SkImage_BitDepth"></a> Enum SkImage::BitDepth
@@ -997,8 +923,8 @@ Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
<table> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_hardwareBuffer"> <code><strong>hardwareBuffer </strong></code> </a></td> <td>
AHardwareBuffer Android hardware buffer</td>
</tr> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
-one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
+one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> </td>
</tr> <tr> <td><a name="SkImage_MakeFromAHardwareBuffer_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
range of colors; may be nullptr</td>
</tr>
@@ -1021,6 +947,7 @@ created <a href="#Image">Image</a>, or nullptr
| <a href="#SkImage_alphaType">alphaType</a> | returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> |
| <a href="#SkImage_bounds">bounds</a> | returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> as Rectangle |
| <a href="#SkImage_colorSpace">colorSpace</a> | returns <a href="undocumented#Color_Space">Color Space</a> |
+| <a href="#SkImage_colorType">colorType</a> | returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a> |
| <a href="#SkImage_dimensions">dimensions</a> | returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> |
| <a href="#SkImage_getTextureHandle">getTextureHandle</a> | returns GPU reference to <a href="#Image">Image</a> as texture |
| <a href="#SkImage_height">height</a> | returns pixel row count |
@@ -1094,7 +1021,15 @@ integral size of <a href="#SkImage_width">width</a> and <a href="#SkImage_height
### Example
-<div><fiddle-embed name="96b4bc43b3667df9ba9e2dafb770d33c"></fiddle-embed></div>
+<div><fiddle-embed name="96b4bc43b3667df9ba9e2dafb770d33c">
+
+#### Example Output
+
+~~~~
+dimensionsAsBounds == bounds
+~~~~
+
+</fiddle-embed></div>
### See Also
@@ -1157,10 +1092,8 @@ unique identifier
SkAlphaType alphaType() const
</pre>
-Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.
-
-<a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> returned was a parameter to an <a href="#Image">Image</a> constructor,
+Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.<a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> returned was a parameter to an <a href="#Image">Image</a> constructor,
or was parsed from encoded data.
### Return Value
@@ -1177,6 +1110,29 @@ or was parsed from encoded data.
---
+<a name="SkImage_colorType"></a>
+## colorType
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+SkColorType colorType() const
+</pre>
+
+Returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a> if known; otherwise, returns <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>.
+
+### Return Value
+
+<a href="SkImageInfo_Reference#Color_Type">Color Type</a> of <a href="#Image">Image</a>
+
+### Example
+
+<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
+
+### See Also
+
+<a href="SkImageInfo_Reference#SkImageInfo_colorType">SkImageInfo::colorType</a>
+
+---
+
<a name="SkImage_colorSpace"></a>
## colorSpace
@@ -1528,7 +1484,7 @@ back-end API texture handle, or nullptr
### Example
-<div><fiddle-embed name="f8943191063bfcc69f29f2b149df5c6d" gpu="true"></fiddle-embed></div>
+<div><fiddle-embed name="1de691e4159745d7ee5e82158acdb349" gpu="true"></fiddle-embed></div>
### Example
@@ -1601,7 +1557,7 @@ Returns true if pixels are copied. Returns false if:
</table>
<a href="#Pixels">Pixels</a> are copied only if pixel conversion is possible. If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is
-<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, or <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>; <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="SkImageInfo_Reference#SkImageInfo">colorType</a> must match.
+<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, or <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>; <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_colorType">colorType</a> must match.
If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match.
If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_alphaType">alphaType</a> must
match. If <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is nullptr, <a href="#SkImage_readPixels_dstInfo">dstInfo</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. Returns
@@ -1666,7 +1622,7 @@ row to the next. Returns true if pixels are copied. Returns false if:
</table>
<a href="#Pixels">Pixels</a> are copied only if pixel conversion is possible. If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is
-<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, or <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>; <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">colorType</a> must match.
+<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, or <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>; <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_colorType">colorType</a> must match.
If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match.
If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a> must
match. If <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is nullptr, <a href="#SkImage_readPixels_2_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. Returns
@@ -1715,12 +1671,12 @@ bool scalePixels(const SkPixmap& dst, SkFilterQuality filterQuality,
</pre>
Copies <a href="#Image">Image</a> to <a href="#SkImage_scalePixels_dst">dst</a>, scaling pixels to fit <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_width">width</a> and <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_height">height</a>, and
-converting pixels to match <a href="#SkImage_scalePixels_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">colorType</a> and <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a>. Returns true if
+converting pixels to match <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_colorType">colorType</a> and <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a>. Returns true if
pixels are copied. Returns false if <a href="#SkImage_scalePixels_dst">dst</a>.addr() is nullptr, or <a href="#SkImage_scalePixels_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">rowBytes</a> is
less than <a href="#SkImage_scalePixels_dst">dst</a> <a href="SkImageInfo_Reference#SkImageInfo_minRowBytes">SkImageInfo::minRowBytes</a>.
<a href="#Pixels">Pixels</a> are copied only if pixel conversion is possible. If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is
-<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, or <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>; <a href="#SkImage_scalePixels_dst">dst</a>.<a href="SkPixmap_Reference#SkPixmap">colorType</a> must match.
+<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, or <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>; <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_colorType">colorType</a> must match.
If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Color_Type">Color Type</a> is <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match.
If <a href="#Image">Image</a> <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_alphaType">alphaType</a> must
match. If <a href="#Image">Image</a> <a href="undocumented#Color_Space">Color Space</a> is nullptr, <a href="#SkImage_scalePixels_dst">dst</a>.<a href="#SkImage_colorSpace">colorSpace</a> must match. Returns
@@ -2073,7 +2029,7 @@ filtered <a href="#Image">Image</a>, or nullptr
### Example
-<div><fiddle-embed name="eabb12543886ace5e1212af220a19c6d" gpu="true"><div>In each frame of the animation, filtered <a href="#Image">Image</a> is drawn in a different location.
+<div><fiddle-embed name="17547129251dd9607c381a3cc30cff15" gpu="true"><div>In each frame of the animation, filtered <a href="#Image">Image</a> is drawn in a different location.
By translating canvas by returned <a href="#SkImage_makeWithFilter_offset">offset</a>, <a href="#Image">Image</a> appears stationary.
</div></fiddle-embed></div>
diff --git a/site/user/api/SkMatrix_Reference.md b/site/user/api/SkMatrix_Reference.md
index eb67eb0b09..d7dbe08802 100644
--- a/site/user/api/SkMatrix_Reference.md
+++ b/site/user/api/SkMatrix_Reference.md
@@ -2751,7 +2751,7 @@ true on successful scale
### Example
-<div><fiddle-embed name="58c844b8f0c36acdbc8211e8c929c253"></fiddle-embed></div>
+<div><fiddle-embed name="e6ad0bd2999613d9e4758b661d45070c"></fiddle-embed></div>
### See Also
@@ -3007,7 +3007,7 @@ other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
### Example
-<div><fiddle-embed name="0a4214289249c77f48d59227c4ac4d9e"></fiddle-embed></div>
+<div><fiddle-embed name="e4226c55d9bdbc119264bd372b2b9835"></fiddle-embed></div>
### See Also
@@ -3253,7 +3253,7 @@ true if <a href="#Matrix">Matrix</a> can be inverted
### Example
-<div><fiddle-embed name="10a10c5bf2ac7ec88e84204441fc83b6"></fiddle-embed></div>
+<div><fiddle-embed name="0e03cd9f154603ed4b21ca56d69dae44"></fiddle-embed></div>
### See Also
@@ -3332,7 +3332,7 @@ true if <a href="#Matrix">Matrix</a> does not contain perspective
### Example
-<div><fiddle-embed name="752e4a48ed1dae05765a2499c390f277">
+<div><fiddle-embed name="3325bdf82bd86d9fbc4199f248afa82c">
#### Example Output
@@ -3380,7 +3380,7 @@ column, then row, as:
### Example
-<div><fiddle-embed name="403370bd53526f59020a7141955d70b0">
+<div><fiddle-embed name="f5b6d371c4d65e5b5ac6eebdd4b237d8">
#### Example Output
@@ -4244,7 +4244,7 @@ true if <a href="#Matrix">Matrix</a> <a href="#SkMatrix_notequal_operator_a">a</
### Example
-<div><fiddle-embed name="8a8fadf5fd294daa4ee152833cc0dc0e"></fiddle-embed></div>
+<div><fiddle-embed name="088ab41f877599f980a99523749b0afd"></fiddle-embed></div>
### See Also
@@ -4422,7 +4422,7 @@ true if scale factors were computed correctly
### Example
-<div><fiddle-embed name="cd4dc63d3e04226f0b5861ba8925e223">
+<div><fiddle-embed name="13adba0ecf5f82247cf051b4fa4d8a9c">
#### Example Output
diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md
index 587eeb2e05..97652b1705 100644
--- a/site/user/api/SkPaint_Reference.md
+++ b/site/user/api/SkPaint_Reference.md
@@ -3177,7 +3177,7 @@ modifying the draw.
### Example
-<div><fiddle-embed name="320b04ea1e1291d49f1e61994a0410fe"></fiddle-embed></div>
+<div><fiddle-embed name="55d7b9d482ac8e17a6153f555a8adb8d"></fiddle-embed></div>
<a name="SkPaint_getMaskFilter"></a>
## getMaskFilter
@@ -3195,7 +3195,7 @@ Does not alter <a href="undocumented#Mask_Filter">Mask Filter</a> <a href="undoc
### Example
-<div><fiddle-embed name="8cd53ece8fc83e4560599ace094b0f16">
+<div><fiddle-embed name="5ac4b31371726da87bb7390b385e9fee">
#### Example Output
@@ -3225,7 +3225,7 @@ Increases <a href="undocumented#Mask_Filter">Mask Filter</a> <a href="undocument
### Example
-<div><fiddle-embed name="35a397dce5d44658ee4e9e9dfb9fee22">
+<div><fiddle-embed name="084b0dc3cebd78718c651d58f257f799">
#### Example Output
@@ -3260,7 +3260,7 @@ modifies clipping mask generated from drawn geometry</td>
### Example
-<div><fiddle-embed name="62c5a826692f85c3de3bab65e9e97aa9"></fiddle-embed></div>
+<div><fiddle-embed name="a993831c40f3e134f809134e3b74e4a6"></fiddle-embed></div>
---
diff --git a/site/user/api/SkPath_Reference.md b/site/user/api/SkPath_Reference.md
index 515dd63274..240bea423c 100644
--- a/site/user/api/SkPath_Reference.md
+++ b/site/user/api/SkPath_Reference.md
@@ -1698,7 +1698,7 @@ Returns (0, 0) if <a href="#SkPath_getPoint_index">index</a> is out of range.
### Example
-<div><fiddle-embed name="1cf6b8dd2994c4ca9a2d6887ff888017">
+<div><fiddle-embed name="abd6796f0e15bc7b4fe6f52f6cd2d1a5">
#### Example Output
diff --git a/site/user/api/SkPixmap_Reference.md b/site/user/api/SkPixmap_Reference.md
index b71f6e0da1..c0a760e5cd 100644
--- a/site/user/api/SkPixmap_Reference.md
+++ b/site/user/api/SkPixmap_Reference.md
@@ -536,8 +536,8 @@ color type: kAlpha_8_SkColorType
SkAlphaType alphaType() const
</pre>
-Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
-<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.
+Returns <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
+<a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>.
### Return Value
@@ -568,13 +568,13 @@ alpha type: kPremul_SkAlphaType
SkColorSpace* colorSpace() const
</pre>
-Returns <a href="undocumented#Color_Space">Color Space</a> associated with <a href="SkImageInfo_Reference#Image_Info">Image Info</a>. The
+Returns <a href="undocumented#Color_Space">Color Space</a>, the range of colors, associated with <a href="SkImageInfo_Reference#Image_Info">Image Info</a>. The
reference count of <a href="undocumented#Color_Space">Color Space</a> is unchanged. The returned <a href="undocumented#Color_Space">Color Space</a> is
immutable.
### Return Value
-<a href="undocumented#Color_Space">Color Space</a>, the range of colors, in <a href="SkImageInfo_Reference#Image_Info">Image Info</a>
+<a href="undocumented#Color_Space">Color Space</a> in <a href="SkImageInfo_Reference#Image_Info">Image Info</a>, or nullptr
### Example
@@ -1684,7 +1684,7 @@ true if pixels are copied to <a href="#SkPixmap_readPixels_dstPixels">dstPixels<
### Example
-<div><fiddle-embed name="2b7f6cc59ea2d5ebceddccbc2f232bcf"></fiddle-embed></div>
+<div><fiddle-embed name="48ccfadec48f987c81a1e218e49cca68"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/SkSurface_Reference.md b/site/user/api/SkSurface_Reference.md
index 34e18013fe..dda2c3c80e 100644
--- a/site/user/api/SkSurface_Reference.md
+++ b/site/user/api/SkSurface_Reference.md
@@ -1257,7 +1257,7 @@ GPU texture reference
### Example
-<div><fiddle-embed name="4b5720038daaf65ba1ba546e678ddd6e" gpu="true"></fiddle-embed></div>
+<div><fiddle-embed name="f7558a62985f70f2286307993db4b3bc" gpu="true"></fiddle-embed></div>
### See Also
@@ -1299,7 +1299,7 @@ true if <a href="#Surface">Surface</a> is backed by GPU texture
### Example
-<div><fiddle-embed name="16e848a4405ce08f8393bba13cc3b8bf" gpu="true"></fiddle-embed></div>
+<div><fiddle-embed name="dbc6c0e01a177ba03c87c00c32a43148" gpu="true"></fiddle-embed></div>
### See Also
diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm
index 261f7d855c..4584e136e0 100644
--- a/site/user/api/catalog.htm
+++ b/site/user/api/catalog.htm
@@ -85,15 +85,15 @@
"stdout": "width: 1 height: 1 computeByteSize: 4\\nwidth: 1 height: 1000 computeByteSize: 4999\\nwidth: 1 height: 1000000 computeByteSize: 4999999\\nwidth: 1000 height: 1 computeByteSize: 4000\\nwidth: 1000 height: 1000 computeByteSize: 4999000\\nwidth: 1000 height: 1000000 computeByteSize: 4999999000\\nwidth: 1000000 height: 1 computeByteSize: 4000000\\nwidth: 1000000 height: 1000 computeByteSize: 4999000000\\nwidth: 1000000 height: 1000000 computeByteSize: 4999999000000\\n"
},
"SkBitmap_copy_const_SkBitmap": {
- "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));\n SkDebugf(\"original has pixels before copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy(original); \n SkDebugf(\"original has pixels after copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n}\n",
- "hash": "dbf46a0b60324ec611cc18d86772e7b9",
+ "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n if (original.tryAllocPixels(\n SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {\n SkDebugf(\"original has pixels before copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy(original); \n SkDebugf(\"original has pixels after copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n }\n}\n",
+ "hash": "f12c2af14b0fffd094d632b5f766aa1d",
"file": "SkBitmap_Reference",
"name": "SkBitmap::SkBitmap(const SkBitmap& src)",
"stdout": "original has pixels before copy: true\\noriginal has pixels after copy: true\\ncopy has pixels: true\\n"
},
"SkBitmap_copy_operator": {
- "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));\n SkDebugf(\"original has pixels before copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy = original; \n SkDebugf(\"original has pixels after copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n}\n",
- "hash": "6366fa1b1b3df1bebbfa3ed1c5a43457",
+ "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n if (original.tryAllocPixels(\n SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {\n SkDebugf(\"original has pixels before copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy = original; \n SkDebugf(\"original has pixels after copy: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n }\n}\n",
+ "hash": "98d5866308756c21c8f8b639bc4e033a",
"file": "SkBitmap_Reference",
"name": "SkBitmap::operator=(const SkBitmap& src)",
"stdout": "original has pixels before copy: true\\noriginal has pixels after copy: true\\ncopy has pixels: true\\n"
@@ -134,8 +134,8 @@
"stdout": "bounds: 0, 0, 512, 512\\nsubset: -100, 100, 0, 200 success; false\\nsubset: -100, 100, 100, 200 success; true subset: 0, 0, 100, 100\\nsubset: -100, 100, 1000, 200 success; true subset: 0, 0, 512, 100\\nsubset: 0, 100, 0, 200 success; false\\nsubset: 0, 100, 100, 200 success; true subset: 0, 0, 100, 100\\nsubset: 0, 100, 1000, 200 success; true subset: 0, 0, 512, 100\\nsubset: 100, 100, 0, 200 success; false\\nsubset: 100, 100, 100, 200 success; false\\nsubset: 100, 100, 1000, 200 success; true subset: 0, 0, 412, 100\\nsubset: 1000, 100, 0, 200 success; false\\nsubset: 1000, 100, 100, 200 success; false\\nsubset: 1000, 100, 1000, 200 success; false\\n"
},
"SkBitmap_getAddr": {
- "code": "void draw(SkCanvas* canvas) {\n char* row0 = (char* ) source.getAddr(0, 0);\n char* row1 = (char* ) source.getAddr(0, 1);\n SkDebugf(\"addr interval %c= rowBytes\\n\", row1 - row0 == source.rowBytes() ? '=' : '!');\n}",
- "hash": "bd0e0adb48b16d75129092649eab1617",
+ "code": "void draw(SkCanvas* canvas) {\n char* row0 = (char* ) source.getAddr(0, 0);\n char* row1 = (char* ) source.getAddr(0, 1);\n SkDebugf(\"addr interval %c= rowBytes\\n\",\n (size_t) (row1 - row0) == source.rowBytes() ? '=' : '!');\n}",
+ "hash": "ffcefb2344cd38c3b99f69cfe6d64a17",
"file": "SkBitmap_Reference",
"name": "SkBitmap::getAddr",
"stdout": "addr interval == rowBytes\\n"
@@ -239,15 +239,15 @@
"stdout": "original is volatile\\ncopy is not volatile\\n"
},
"SkBitmap_move_SkBitmap": {
- "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));\n SkDebugf(\"original has pixels before move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy(std::move(original)); \n SkDebugf(\"original has pixels after move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n}\n",
- "hash": "8172a14e66cb763b7133f70dc4ff601e",
+ "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n if (original.tryAllocPixels(\n SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {\n SkDebugf(\"original has pixels before move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy(std::move(original)); \n SkDebugf(\"original has pixels after move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n }\n}\n",
+ "hash": "a137b2027d2ac098a21d68d93391f5bb",
"file": "SkBitmap_Reference",
"name": "SkBitmap::SkBitmap(SkBitmap&& src)",
"stdout": "original has pixels before move: true\\noriginal has pixels after move: false\\ncopy has pixels: true\\n"
},
"SkBitmap_move_operator": {
- "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));\n SkDebugf(\"original has pixels before move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy = std::move(original); \n SkDebugf(\"original has pixels after move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n}\n",
- "hash": "5066583054077df5098bb1d2aa402149",
+ "code": "void draw(SkCanvas* canvas) {\n SkBitmap original;\n if (original.tryAllocPixels(\n SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {\n SkDebugf(\"original has pixels before move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkBitmap copy = std::move(original); \n SkDebugf(\"original has pixels after move: %s\\n\", original.getPixels() ? \"true\" : \"false\");\n SkDebugf(\"copy has pixels: %s\\n\", copy.getPixels() ? \"true\" : \"false\");\n }\n}\n",
+ "hash": "02836d36fa714d553c32f0d8ea11da73",
"file": "SkBitmap_Reference",
"name": "SkBitmap::operator=(SkBitmap&& src)",
"stdout": "original has pixels before move: true\\noriginal has pixels after move: false\\ncopy has pixels: true\\n"
@@ -309,8 +309,8 @@
"stdout": "rowBytes: 4 rowBytesAsPixels: 1\\nrowBytes: 5 rowBytesAsPixels: 1\\nrowBytes: 6 rowBytesAsPixels: 1\\nrowBytes: 7 rowBytesAsPixels: 1\\nrowBytes: 8 rowBytesAsPixels: 2\\n"
},
"SkBitmap_setAlphaType": {
- "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n const char* alphas[] = {\"Unknown \", \"Opaque \", \"Premul \", \"Unpremul\"}; \n SkBitmap bitmap;\n SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,\n kPremul_SkAlphaType, kUnpremul_SkAlphaType };\n SkDebugf(\"%88s\", \"Canonical Unknown Opaque Premul Unpremul\\n\");\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n for (SkAlphaType canonicalAlphaType : alphaTypes) {\n SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );\n SkDebugf(\"%10s %10s \", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);\n for (SkAlphaType alphaType : alphaTypes) {\n bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));\n bool result = bitmap.setAlphaType(alphaType);\n SkDebugf(\"%s %s \", result ? \"true \" : \"false\", alphas[(int) bitmap.alphaType()]);\n }\n SkDebugf(\"\\n\");\n }\n }\n}\n",
- "hash": "38cec6acbba80274232a85539ab34af1",
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n const char* alphas[] = {\"Unknown \", \"Opaque \", \"Premul \", \"Unpremul\"}; \n SkBitmap bitmap;\n SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,\n kUnpremul_SkAlphaType\n };\n SkDebugf(\"%88s\", \"Canonical Unknown Opaque Premul Unpremul\\n\");\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n for (SkAlphaType canonicalAlphaType : alphaTypes) {\n SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );\n SkDebugf(\"%10s %10s \", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);\n for (SkAlphaType alphaType : alphaTypes) {\n bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));\n bool result = bitmap.setAlphaType(alphaType);\n SkDebugf(\"%s %s \", result ? \"true \" : \"false\", alphas[(int) bitmap.alphaType()]);\n }\n SkDebugf(\"\\n\");\n }\n }\n}\n",
+ "hash": "be21305f5654a1d8ed765710813a1f14",
"file": "SkBitmap_Reference",
"name": "SkBitmap::setAlphaType",
"stdout": "Canonical Unknown Opaque Premul Unpremul\\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Alpha_8 Unknown true Unknown true Unknown true Unknown true Unknown \\n Alpha_8 Opaque false Opaque true Opaque true Premul true Premul \\n Alpha_8 Premul false Premul true Opaque true Premul true Premul \\n Alpha_8 Unpremul false Premul true Opaque true Premul true Premul \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n ARGB_4444 Unknown true Unknown true Unknown true Unknown true Unknown \\n ARGB_4444 Opaque false Opaque true Opaque true Premul true Unpremul \\n ARGB_4444 Premul false Premul true Opaque true Premul true Unpremul \\n ARGB_4444 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n RGBA_8888 Unknown true Unknown true Unknown true Unknown true Unknown \\n RGBA_8888 Opaque false Opaque true Opaque true Premul true Unpremul \\n RGBA_8888 Premul false Premul true Opaque true Premul true Unpremul \\n RGBA_8888 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n BGRA_8888 Unknown true Unknown true Unknown true Unknown true Unknown \\n BGRA_8888 Opaque false Opaque true Opaque true Premul true Unpremul \\n BGRA_8888 Premul false Premul true Opaque true Premul true Unpremul \\n BGRA_8888 Unpremul false Unpremul true Opaque true Premul true Unpremul \\nRGBA_1010102 Unknown true Unknown true Unknown true Unknown true Unknown \\nRGBA_1010102 Opaque false Opaque true Opaque true Premul true Unpremul \\nRGBA_1010102 Premul false Premul true Opaque true Premul true Unpremul \\nRGBA_1010102 Unpremul false Unpremul true Opaque true Premul true Unpremul \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGBA_F16 Unknown true Unknown true Unknown true Unknown true Unknown \\n RGBA_F16 Opaque false Opaque true Opaque true Premul true Unpremul \\n RGBA_F16 Premul false Premul true Opaque true Premul true Unpremul \\n RGBA_F16 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n"
@@ -330,8 +330,8 @@
"stdout": "color: kUnknown_SkColorType shiftPerPixel: 0\\ncolor: kAlpha_8_SkColorType shiftPerPixel: 0\\ncolor: kRGB_565_SkColorType shiftPerPixel: 1\\ncolor: kARGB_4444_SkColorType shiftPerPixel: 1\\ncolor: kRGBA_8888_SkColorType shiftPerPixel: 2\\ncolor: kRGB_888x_SkColorType shiftPerPixel: 2\\ncolor: kBGRA_8888_SkColorType shiftPerPixel: 2\\ncolor: kRGBA_1010102_SkColorType shiftPerPixel: 2\\ncolor: kRGB_101010x_SkColorType shiftPerPixel: 2\\ncolor: kGray_8_SkColorType shiftPerPixel: 0\\ncolor: kRGBA_F16_SkColorType shiftPerPixel: 3\\n"
},
"SkBitmap_swap": {
- "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkBitmap& b) -> void {\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkDebugf(\"%s width:%d height:%d colorType:k%s_SkColorType alphaType:k%s_SkAlphaType\\n\",\n prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]);\n };\n SkBitmap one, two;\n one.tryAllocPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));\n two.tryAllocPixels(SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType));\n for (int index = 0; index < 2; ++index) {\n debugster(\"one\", one);\n debugster(\"two\", two);\n one.swap(two);\n }\n}\n",
- "hash": "274d02e5f33866b1a9a78423c5569e22",
+ "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkBitmap& b) -> void {\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkDebugf(\"%s width:%d height:%d colorType:k%s_SkColorType alphaType:k%s_SkAlphaType\\n\",\n prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]);\n };\n SkBitmap one, two;\n if (!one.tryAllocPixels(\n SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType))) {\n return;\n }\n if (!two.tryAllocPixels(\n SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType))) {\n return;\n }\n for (int index = 0; index < 2; ++index) {\n debugster(\"one\", one);\n debugster(\"two\", two);\n one.swap(two);\n }\n}\n",
+ "hash": "de9be45255e48fae445c916a41063abc",
"file": "SkBitmap_Reference",
"name": "SkBitmap::swap()",
"stdout": "one width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType\\ntwo width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType\\none width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType\\ntwo width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType\\n"
@@ -631,8 +631,8 @@
"stdout": "pt.isZero() == true\\n"
},
"SkIPoint_minus_operator": {
- "code": "void draw(SkCanvas* canvas) {\n SkIPoint test[] = { {0, -0}, {-1, -2},\n { SK_MaxS32, SK_MinS32 },\n { SK_NaN32, -SK_NaN32 } };\n for (const SkIPoint& pt : test) {\n SkIPoint negPt = -pt;\n SkDebugf(\"pt: %d, %d negate: %d, %d\\n\", pt.fX, pt.fY, negPt.fX, negPt.fY);\n }\n}",
- "hash": "d283e8876366349aedd85b65cadb3706",
+ "code": "void draw(SkCanvas* canvas) {\n SkIPoint test[] = { {0, -0}, {-1, -2},\n { SK_MaxS32, SK_MinS32 },\n { SK_NaN32, SK_NaN32 } };\n for (const SkIPoint& pt : test) {\n SkIPoint negPt = -pt;\n SkDebugf(\"pt: %d, %d negate: %d, %d\\n\", pt.fX, pt.fY, negPt.fX, negPt.fY);\n }\n}",
+ "hash": "b30d4780475d113a7fed3637af7f0db1",
"file": "SkIPoint_Reference",
"name": "SkIPoint::operator-()_const",
"stdout": "pt: 0, 0 negate: 0, 0\\npt: -1, -2 negate: 1, 2\\npt: 2147483647, -2147483647 negate: -2147483647, 2147483647\\npt: -2147483648, -2147483648 negate: -2147483648, -2147483648\\n"
@@ -813,8 +813,8 @@
"stdout": "intersection: 30, 60, 50, 80\\n"
},
"SkIRect_intersectNoEmptyCheck": {
- "code": "void draw(SkCanvas* canvas) {\n SkIRect result;\n bool intersected = result.intersectNoEmptyCheck({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });\n SkDebugf(\"intersection: %d, %d, %d, %d\\n\",\n result.left(), result.top(), result.right(), result.bottom());\n}",
- "hash": "2b3e26ccba1cba3d961645f0824621ac",
+ "code": "void draw(SkCanvas* canvas) {\n SkIRect result;\n if (result.intersectNoEmptyCheck({ 10, 40, 50, 80 }, { 30, 60, 70, 90 })) {\n SkDebugf(\"intersection: %d, %d, %d, %d\\n\",\n result.left(), result.top(), result.right(), result.bottom());\n }\n}",
+ "hash": "d35fbc9fdea71df8b8a12fd3da50d11c",
"file": "SkIRect_Reference",
"name": "SkIRect::intersectNoEmptyCheck",
"stdout": "intersection: 30, 60, 50, 80\\n"
@@ -1015,6 +1015,83 @@
"name": "SkIRect::y()",
"stdout": "unsorted.fTop: 25 unsorted.y(): 25\\nsorted.fTop: 5 sorted.y(): 5\\n"
},
+ "SkImageInfo_alphaType": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n SkImageInfo info = SkImageInfo::MakeA8(16, 32);\n SkDebugf(\"alpha type: k\" \"%s\" \"_SkAlphaType\\n\", alphas[info.alphaType()]);\n}",
+ "hash": "5c1d2499a4056b6cff38c1cf924158a1",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::alphaType",
+ "stdout": "alpha type: kPremul_SkAlphaType\\n"
+ },
+ "SkImageInfo_bytesPerPixel": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);\n SkDebugf(\"color: k\" \"%s\" \"_SkColorType\" \"%*s\" \"bytesPerPixel: %d\\n\",\n colors[colorType], 13 - strlen(colors[colorType]), \" \",\n info.bytesPerPixel());\n }\n}",
+ "hash": "9b6de4a07b2316228e9340e5a3b82134",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::bytesPerPixel",
+ "stdout": "color: kUnknown_SkColorType bytesPerPixel: 0\\ncolor: kAlpha_8_SkColorType bytesPerPixel: 1\\ncolor: kRGB_565_SkColorType bytesPerPixel: 2\\ncolor: kARGB_4444_SkColorType bytesPerPixel: 2\\ncolor: kRGBA_8888_SkColorType bytesPerPixel: 4\\ncolor: kRGB_888x_SkColorType bytesPerPixel: 4\\ncolor: kBGRA_8888_SkColorType bytesPerPixel: 4\\ncolor: kRGBA_1010102_SkColorType bytesPerPixel: 4\\ncolor: kRGB_101010x_SkColorType bytesPerPixel: 4\\ncolor: kGray_8_SkColorType bytesPerPixel: 1\\ncolor: kRGBA_F16_SkColorType bytesPerPixel: 8\\n"
+ },
+ "SkImageInfo_colorSpace": {
+ "code": "void draw(SkCanvas* canvas) {\n SkImageInfo info = SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType, \n SkColorSpace::MakeSRGBLinear());\n SkColorSpace* colorSpace = info.colorSpace();\n SkDebugf(\"gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\\n\",\n colorSpace->gammaCloseToSRGB() ? \"true\" : \"false\",\n colorSpace->gammaIsLinear() ? \"true\" : \"false\",\n colorSpace->isSRGB() ? \"true\" : \"false\");\n}",
+ "hash": "2952a6c863bd504484c9f66cc727f968",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::colorSpace",
+ "stdout": "gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false\\n"
+ },
+ "SkImageInfo_colorType": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkImageInfo info = SkImageInfo::MakeA8(16, 32);\n SkDebugf(\"color type: k\" \"%s\" \"_SkColorType\\n\", colors[info.colorType()]);\n}",
+ "hash": "06ecc3ce7f35cc7f930cbc2a662e3105",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::colorType",
+ "stdout": "color type: kAlpha_8_SkColorType\\n"
+ },
+ "SkImageInfo_dimensions": {
+ "code": "void draw(SkCanvas* canvas) {\n const int height = 2;\n const int width = 2;\n SkImageInfo imageInfo = SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);\n SkISize dimensions = imageInfo.dimensions();\n SkIRect bounds = imageInfo.bounds();\n SkIRect dimensionsAsBounds = SkIRect::MakeSize(dimensions);\n SkDebugf(\"dimensionsAsBounds %c= bounds\\n\", dimensionsAsBounds == bounds ? '=' : '!');\n}",
+ "hash": "d5547cd2b302822aa85b7b0ae3f48458",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::dimensions()",
+ "stdout": "dimensionsAsBounds == bounds\\n"
+ },
+ "SkImageInfo_isEmpty": {
+ "code": "void draw(SkCanvas* canvas) {\n for (int width : { 0, 2 } ) {\n for (int height : { 0, 2 } ) {\n SkImageInfo imageInfo= SkImageInfo::MakeA8(width, height);\n SkDebugf(\"width: %d height: %d empty: %s\\n\", width, height,\n imageInfo.isEmpty() ? \"true\" : \"false\");\n }\n }\n}",
+ "hash": "b8757200da5be0b43763cf79feb681a7",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::isEmpty",
+ "stdout": "width: 0 height: 0 empty: true\\nwidth: 0 height: 2 empty: true\\nwidth: 2 height: 0 empty: true\\nwidth: 2 height: 2 empty: false\\n"
+ },
+ "SkImageInfo_isOpaque": {
+ "code": "void draw(SkCanvas* canvas) {\n const int height = 2;\n const int width = 2;\n SkBitmap bitmap;\n SkImageInfo imageInfo = SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);\n bitmap.setInfo(imageInfo);\n for (int index = 0; index < 2; ++index) {\n bitmap.allocPixels();\n bitmap.eraseColor(0x00000000);\n SkDebugf(\"isOpaque: %s\\n\", imageInfo.isOpaque() ? \"true\" : \"false\");\n bitmap.eraseColor(0xFFFFFFFF);\n SkDebugf(\"isOpaque: %s\\n\", imageInfo.isOpaque() ? \"true\" : \"false\");\n imageInfo = imageInfo.makeAlphaType(kOpaque_SkAlphaType);\n bitmap.setInfo(imageInfo);\n }\n}",
+ "hash": "e9bd4f02b6cfb3ac864cb7fee7d7299c",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::isOpaque",
+ "stdout": "isOpaque: false\\nisOpaque: false\\nisOpaque: true\\nisOpaque: true\\n"
+ },
+ "SkImageInfo_minRowBytes": {
+ "code": "void draw(SkCanvas* canvas) {\n for (int shift = 24; shift < 32; ++shift) {\n int width = 1 << shift;\n SkImageInfo imageInfo = \n SkImageInfo::Make(width, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType);\n size_t minRowBytes = imageInfo.minRowBytes();\n bool widthTooLarge = !minRowBytes;\n SkDebugf(\"RGBA_F16 width %d (0x%08x) %s\\n\",\n width, width, widthTooLarge ? \"too large\" : \"OK\"); \n }\n}",
+ "hash": "4cb6975732a7ffab2c9ebac31af1432e",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::minRowBytes",
+ "stdout": "RGBA_F16 width 16777216 (0x01000000) OK\\nRGBA_F16 width 33554432 (0x02000000) OK\\nRGBA_F16 width 67108864 (0x04000000) OK\\nRGBA_F16 width 134217728 (0x08000000) OK\\nRGBA_F16 width 268435456 (0x10000000) too large\\nRGBA_F16 width 536870912 (0x20000000) too large\\nRGBA_F16 width 1073741824 (0x40000000) too large\\nRGBA_F16 width -2147483648 (0x80000000) too large\\n"
+ },
+ "SkImageInfo_minRowBytes64": {
+ "code": "void draw(SkCanvas* canvas) {\n for (int shift = 24; shift < 32; ++shift) {\n int width = 1 << shift;\n SkImageInfo imageInfo = \n SkImageInfo::Make(width, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType);\n uint64_t minRowBytes = imageInfo.minRowBytes64();\n bool widthTooLarge = (uint64_t) (int32_t) minRowBytes != minRowBytes;\n SkDebugf(\"RGBA_F16 width %d (0x%08x) %s\\n\",\n width, width, widthTooLarge ? \"too large\" : \"OK\"); \n }\n}",
+ "hash": "3004125e67431bd7a5c0ff3863aad8a0",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::minRowBytes64",
+ "stdout": "RGBA_F16 width 16777216 (0x01000000) OK\\nRGBA_F16 width 33554432 (0x02000000) OK\\nRGBA_F16 width 67108864 (0x04000000) OK\\nRGBA_F16 width 134217728 (0x08000000) OK\\nRGBA_F16 width 268435456 (0x10000000) too large\\nRGBA_F16 width 536870912 (0x20000000) too large\\nRGBA_F16 width 1073741824 (0x40000000) too large\\nRGBA_F16 width -2147483648 (0x80000000) too large\\n"
+ },
+ "SkImageInfo_refColorSpace": {
+ "code": "void draw(SkCanvas* canvas) {\n SkImageInfo info1 = SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType, \n SkColorSpace::MakeSRGBLinear());\n SkImageInfo info2 = SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType,\n info1.refColorSpace());\n SkColorSpace* colorSpace = info2.colorSpace();\n SkDebugf(\"gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\\n\",\n colorSpace->gammaCloseToSRGB() ? \"true\" : \"false\",\n colorSpace->gammaIsLinear() ? \"true\" : \"false\",\n colorSpace->isSRGB() ? \"true\" : \"false\");\n}",
+ "hash": "f36afcc295602f5c8c4c2c2025c25884",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::refColorSpace",
+ "stdout": "gammaCloseToSRGB: false gammaIsLinear: true isSRGB: false\\n"
+ },
+ "SkImageInfo_shiftPerPixel": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);\n SkDebugf(\"color: k\" \"%s\" \"_SkColorType\" \"%*s\" \"shiftPerPixel: %d\\n\",\n colors[colorType], 14 - strlen(colors[colorType]), \" \",\n info.shiftPerPixel());\n }\n}",
+ "hash": "e47b911f94fc629f756a829e523a2a89",
+ "file": "SkImageInfo_Reference",
+ "name": "SkImageInfo::shiftPerPixel",
+ "stdout": "color: kUnknown_SkColorType shiftPerPixel: 0\\ncolor: kAlpha_8_SkColorType shiftPerPixel: 0\\ncolor: kRGB_565_SkColorType shiftPerPixel: 1\\ncolor: kARGB_4444_SkColorType shiftPerPixel: 1\\ncolor: kRGBA_8888_SkColorType shiftPerPixel: 2\\ncolor: kRGB_888x_SkColorType shiftPerPixel: 2\\ncolor: kBGRA_8888_SkColorType shiftPerPixel: 2\\ncolor: kRGBA_1010102_SkColorType shiftPerPixel: 2\\ncolor: kRGB_101010x_SkColorType shiftPerPixel: 2\\ncolor: kGray_8_SkColorType shiftPerPixel: 0\\ncolor: kRGBA_F16_SkColorType shiftPerPixel: 3\\n"
+ },
"SkImage_MakeFromRaster": {
"code": "static void releaseProc(const void* pixels, SkImage::ReleaseContext context) {\n int* countPtr = static_cast<int*>(context);\n *countPtr += 1;\n}\n\nvoid draw(SkCanvas* canvas) {\n SkColor color = 0;\n SkPixmap pixmap(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType), &color, 4);\n int releaseCount = 0;\n sk_sp<SkImage> image(SkImage::MakeFromRaster(pixmap, releaseProc, &releaseCount));\n SkDebugf(\"before reset: %d\\n\", releaseCount);\n image.reset();\n SkDebugf(\"after reset: %d\\n\", releaseCount);\n}\n",
"hash": "275356b65d18c8868f4434137350cddc",
@@ -1100,8 +1177,8 @@
"stdout": "matrix[SkMatrix::kMScaleX] == 42\\nmatrix[SkMatrix::kMScaleY] == 24\\n"
},
"SkMatrix_asAffine": {
- "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);\n SkScalar affine[6];\n matrix.asAffine(affine);\n const char* names[] = { \"ScaleX\", \"SkewY\", \"SkewX\", \"ScaleY\", \"TransX\", \"TransY\" };\n for (int i = 0; i < 6; ++i) {\n SkDebugf(\"%s: %g \", names[i], affine[i]);\n }\n SkDebugf(\"\\n\");\n}",
- "hash": "752e4a48ed1dae05765a2499c390f277",
+ "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);\n SkScalar affine[6];\n if (matrix.asAffine(affine)) {\n const char* names[] = { \"ScaleX\", \"SkewY\", \"SkewX\", \"ScaleY\", \"TransX\", \"TransY\" };\n for (int i = 0; i < 6; ++i) {\n SkDebugf(\"%s: %g \", names[i], affine[i]);\n }\n SkDebugf(\"\\n\");\n }\n}",
+ "hash": "3325bdf82bd86d9fbc4199f248afa82c",
"file": "SkMatrix_Reference",
"name": "SkMatrix::asAffine",
"stdout": "ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7 \\n"
@@ -1162,13 +1239,6 @@
"name": "SkMatrix::getMaxScale",
"stdout": "matrix.getMaxScale() 42\\n"
},
- "SkMatrix_getMinMaxScales": {
- "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setAll(1, 0, 0, 0, 1, 0, 0, 0, 0);\n matrix.invert(&matrix); \n SkScalar factor[2] = {2, 2};\n bool result = matrix.getMinMaxScales(factor);\n SkDebugf(\"matrix.getMinMaxScales() %s %g %g\\n\", result ? \"true\" : \"false\", factor[0], factor[1]);\n}",
- "hash": "cd4dc63d3e04226f0b5861ba8925e223",
- "file": "SkMatrix_Reference",
- "name": "SkMatrix::getMinMaxScales",
- "stdout": "matrix.getMinMaxScales() false 2 2\\n"
- },
"SkMatrix_getMinScale": {
"code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setScale(42, 24);\n SkDebugf(\"matrix.getMinScale() %g\\n\", matrix.getMinScale());\n}",
"hash": "1d6f67904c88a806c3731879e9af4ae5",
@@ -1261,8 +1331,8 @@
"stdout": "is translate: true\\nis translate: true\\nis translate: false\\nis translate: false\\n"
},
"SkMatrix_notequal_operator": {
- "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkMatrix& a, const SkMatrix& b) -> void {\n SkDebugf(\"%s: a %c= b a.cheapEqualTo(b): %s\\n\", prefix,\n a != b ? '!' : '=', a.cheapEqualTo(b) ? \"true\" : \"false\");\n };\n SkMatrix a, b;\n a.setAll(1, 0, 0, 0, 1, 0, 1, 0, 1);\n a.invert(&b);\n debugster(\"identity\", a, b);\n}",
- "hash": "8a8fadf5fd294daa4ee152833cc0dc0e",
+ "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkMatrix& a, const SkMatrix& b) -> void {\n SkDebugf(\"%s: a %c= b a.cheapEqualTo(b): %s\\n\", prefix,\n a != b ? '!' : '=', a.cheapEqualTo(b) ? \"true\" : \"false\");\n };\n SkMatrix a, b;\n a.setAll(1, 0, 0, 0, 1, 0, 1, 0, 1);\n if (a.invert(&b)) {\n debugster(\"identity\", a, b);\n }\n}",
+ "hash": "088ab41f877599f980a99523749b0afd",
"file": "SkMatrix_Reference",
"name": "SkMatrix::operator!=(const SkMatrix& a, const SkMatrix& b)",
"stdout": "identity: a != b a.cheapEqualTo(b): false\\n"
@@ -1296,8 +1366,8 @@
"stdout": "with identity matrix: x = 24\\nafter skew x mod: x = 24\\nafter 2nd skew x mod: x = 66\\n"
},
"SkMatrix_setAffine": {
- "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);\n SkScalar affine[6];\n matrix.asAffine(affine);\n const char* names[] = { \"ScaleX\", \"SkewY\", \"SkewX\", \"ScaleY\", \"TransX\", \"TransY\" };\n for (int i = 0; i < 6; ++i) {\n SkDebugf(\"%s: %g \", names[i], affine[i]);\n }\n SkDebugf(\"\\n\");\n matrix.reset();\n matrix.setAffine(affine);\n matrix.dump();\n}",
- "hash": "403370bd53526f59020a7141955d70b0",
+ "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);\n SkScalar affine[6];\n if (matrix.asAffine(affine)) {\n const char* names[] = { \"ScaleX\", \"SkewY\", \"SkewX\", \"ScaleY\", \"TransX\", \"TransY\" };\n for (int i = 0; i < 6; ++i) {\n SkDebugf(\"%s: %g \", names[i], affine[i]);\n }\n SkDebugf(\"\\n\");\n matrix.reset();\n matrix.setAffine(affine);\n matrix.dump();\n }\n}",
+ "hash": "f5b6d371c4d65e5b5ac6eebdd4b237d8",
"file": "SkMatrix_Reference",
"name": "SkMatrix::setAffine",
"stdout": "ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7 \\n[ 2.0000 3.0000 4.0000][ 5.0000 6.0000 7.0000][ 0.0000 0.0000 1.0000]\\n"
@@ -1457,8 +1527,8 @@
"stdout": "nullptr == image filter\\nnullptr != image filter\\n"
},
"SkPaint_getMaskFilter": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"nullptr %c= mask filter\\n\", paint.getMaskFilter() ? '!' : '=');\n paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3));\n SkDebugf(\"nullptr %c= mask filter\\n\", paint.getMaskFilter() ? '!' : '=');\n}\n",
- "hash": "8cd53ece8fc83e4560599ace094b0f16",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkDebugf(\"nullptr %c= mask filter\\n\", paint.getMaskFilter() ? '!' : '=');\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));\n SkDebugf(\"nullptr %c= mask filter\\n\", paint.getMaskFilter() ? '!' : '=');\n}\n",
+ "hash": "5ac4b31371726da87bb7390b385e9fee",
"file": "SkPaint_Reference",
"name": "SkPaint::getMaskFilter",
"stdout": "nullptr == mask filter\\nnullptr != mask filter\\n"
@@ -1681,8 +1751,8 @@
"stdout": "image filter unique: true\\nimage filter unique: false\\n"
},
"SkPaint_refMaskFilter": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint1, paint2;\n paint1.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 1));\n SkDebugf(\"mask filter unique: %s\\n\", paint1.getMaskFilter()->unique() ? \"true\" : \"false\");\n paint2.setMaskFilter(paint1.refMaskFilter());\n SkDebugf(\"mask filter unique: %s\\n\", paint1.getMaskFilter()->unique() ? \"true\" : \"false\");\n}\n",
- "hash": "35a397dce5d44658ee4e9e9dfb9fee22",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint1, paint2;\n paint1.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 1));\n SkDebugf(\"mask filter unique: %s\\n\", paint1.getMaskFilter()->unique() ? \"true\" : \"false\");\n paint2.setMaskFilter(paint1.refMaskFilter());\n SkDebugf(\"mask filter unique: %s\\n\", paint1.getMaskFilter()->unique() ? \"true\" : \"false\");\n}\n",
+ "hash": "084b0dc3cebd78718c651d58f257f799",
"file": "SkPaint_Reference",
"name": "SkPaint::refMaskFilter",
"stdout": "mask filter unique: true\\nmask filter unique: false\\n"
@@ -2136,8 +2206,8 @@
"stdout": "last point: 35.2786, 52.9772\\n"
},
"SkPath_getPoint": {
- "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkPath& path) -> void {\n SkDebugf(\"%s point count: %d\\n\", prefix, path.countPoints());\n };\n SkPath path;\n path.lineTo(20, 20);\n path.offset(-10, -10);\n for (int i= 0; i < path.countPoints(); ++i) {\n SkDebugf(\"point %d: (%1.8g,%1.8g)\\n\", i, path.getPoint(i).fX, path.getPoint(i).fY);\n } \n}\n",
- "hash": "1cf6b8dd2994c4ca9a2d6887ff888017",
+ "code": "void draw(SkCanvas* canvas) {\n SkPath path;\n path.lineTo(20, 20);\n path.offset(-10, -10);\n for (int i= 0; i < path.countPoints(); ++i) {\n SkDebugf(\"point %d: (%1.8g,%1.8g)\\n\", i, path.getPoint(i).fX, path.getPoint(i).fY);\n } \n}\n",
+ "hash": "abd6796f0e15bc7b4fe6f52f6cd2d1a5",
"file": "SkPath_Reference",
"name": "SkPath::getPoint",
"stdout": "point 0: (-10,-10)\\npoint 1: (10,10)\\n"
@@ -3280,8 +3350,8 @@
"Image_Info_Alpha_Type_Unpremul": {
"code": "void draw(SkCanvas* canvas) {\n SkColor color = SkColorSetARGB(150, 50, 100, 255);\n SkString s;\n s.printf(\"%u %u %u %u\", SkColorGetA(color), SkColorGetR(color),\n SkColorGetG(color), SkColorGetB(color));\n SkPaint paint;\n paint.setAntiAlias(true);\n canvas->drawString(s, 10, 62, paint);\n canvas->scale(50, 50);\n SkBitmap bitmap;\n SkImageInfo imageInfo = SkImageInfo::Make(1, 1, kN32_SkColorType, kUnpremul_SkAlphaType);\n if (bitmap.installPixels(imageInfo, (void*) &color, imageInfo.minRowBytes())) {\n canvas->drawBitmap(bitmap, 0, 0);\n }\n}",
"width": 256,
- "height": 256,
- "hash": "46e528e0c6b3f3e296d0d0930d638629",
+ "height": 64,
+ "hash": "b8216a9e5ff5bc61a0e46eba7d36307b",
"file": "SkImageInfo_Reference",
"name": "Alpha_Type_Unpremul"
},
@@ -3462,10 +3532,10 @@
"name": "Image_Filter_Methods"
},
"Paint_Mask_Filter_Methods": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setMaskFilter(SkBlurMaskFilter::Make(kSolid_SkBlurStyle, 3));\n canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kSolid_SkBlurStyle, 3));\n canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);\n}\n",
"width": 256,
"height": 256,
- "hash": "320b04ea1e1291d49f1e61994a0410fe",
+ "hash": "55d7b9d482ac8e17a6153f555a8adb8d",
"file": "SkPaint_Reference",
"name": "Mask_Filter_Methods"
},
@@ -3728,8 +3798,8 @@
"SkBitmap_bounds": {
"code": "void draw(SkCanvas* canvas) {\n canvas->scale(.5f, .5f);\n SkIRect bounds = source.bounds();\n for (int x : { 0, bounds.width() } ) {\n for (int y : { 0, bounds.height() } ) {\n canvas->drawBitmap(source, x, y);\n }\n }\n}",
"width": 256,
- "height": 128,
- "hash": "41a60435d6eb76cb400fe9be635e3762",
+ "height": 64,
+ "hash": "3e9126152ff1cc592aef6facbcb5fc96",
"file": "SkBitmap_Reference",
"name": "SkBitmap::bounds()"
},
@@ -3766,18 +3836,18 @@
"name": "SkBitmap::extractAlpha"
},
"SkBitmap_extractAlpha_2": {
- "code": "void draw(SkCanvas* canvas) {\n auto radiusToSigma = [](SkScalar radius) -> SkScalar {\n static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;\n return radius > 0 ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f;\n };\n SkBitmap alpha, bitmap;\n bitmap.allocN32Pixels(100, 100);\n SkCanvas offscreen(bitmap);\n offscreen.clear(0);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setColor(SK_ColorBLUE);\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(20);\n offscreen.drawCircle(50, 50, 39, paint);\n offscreen.flush();\n paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, radiusToSigma(25),\n SkBlurMaskFilter::kHighQuality_BlurFlag));\n SkIPoint offset;\n bitmap.extractAlpha(&alpha, &paint, &offset);\n paint.setColor(SK_ColorRED);\n canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);\n canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n auto radiusToSigma = [](SkScalar radius) -> SkScalar {\n static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;\n return radius > 0 ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f;\n };\n SkBitmap alpha, bitmap;\n bitmap.allocN32Pixels(100, 100);\n SkCanvas offscreen(bitmap);\n offscreen.clear(0);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setColor(SK_ColorBLUE);\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(20);\n offscreen.drawCircle(50, 50, 39, paint);\n offscreen.flush();\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, radiusToSigma(25)));\n SkIPoint offset;\n bitmap.extractAlpha(&alpha, &paint, &offset);\n paint.setColor(SK_ColorRED);\n canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);\n canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);\n}",
"width": 256,
"height": 160,
- "hash": "c102065eea5c3f109fdcad3f0e269ce5",
+ "hash": "092739b4cd5d732a27c07ced8ef45f01",
"file": "SkBitmap_Reference",
"name": "SkBitmap::extractAlpha_2"
},
"SkBitmap_extractAlpha_3": {
- "code": "void draw(SkCanvas* canvas) {\n SkBitmap alpha, bitmap;\n bitmap.allocN32Pixels(100, 100);\n SkCanvas offscreen(bitmap);\n offscreen.clear(0);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setColor(SK_ColorBLUE);\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(20);\n offscreen.drawCircle(50, 50, 39, paint);\n offscreen.flush();\n paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3));\n SkIPoint offset;\n bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);\n paint.setColor(SK_ColorRED);\n canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);\n canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkBitmap alpha, bitmap;\n bitmap.allocN32Pixels(100, 100);\n SkCanvas offscreen(bitmap);\n offscreen.clear(0);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setColor(SK_ColorBLUE);\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(20);\n offscreen.drawCircle(50, 50, 39, paint);\n offscreen.flush();\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));\n SkIPoint offset;\n bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);\n paint.setColor(SK_ColorRED);\n canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);\n canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);\n}",
"width": 256,
"height": 128,
- "hash": "3563cb608791d55bb584f38e842f3003",
+ "hash": "cd7543fa8c9f3cede46dc2d72eb8c4bd",
"file": "SkBitmap_Reference",
"name": "SkBitmap::extractAlpha_3"
},
@@ -4198,10 +4268,10 @@
"name": "SkCanvas::drawBitmapNine"
},
"SkCanvas_drawBitmapRect": {
- "code": "void draw(SkCanvas* canvas) {\n uint8_t pixels[][8] = { { 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00},\n { 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},\n { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00},\n { 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF},\n { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},\n { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00},\n { 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00},\n { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00} };\n SkBitmap bitmap;\n bitmap.installPixels(SkImageInfo::MakeA8(8, 8), \n (void*) pixels, sizeof(pixels[0]));\n SkPaint paint;\n paint.setMaskFilter(SkBlurMaskFilter::Make(kSolid_SkBlurStyle, 6));\n for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xFF007F00} ) {\n paint.setColor(color);\n canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(32, 32), &paint);\n canvas->translate(48, 0);\n }\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n uint8_t pixels[][8] = { { 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00},\n { 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},\n { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00},\n { 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF},\n { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},\n { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00},\n { 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00},\n { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00} };\n SkBitmap bitmap;\n bitmap.installPixels(SkImageInfo::MakeA8(8, 8), \n (void*) pixels, sizeof(pixels[0]));\n SkPaint paint;\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kSolid_SkBlurStyle, 6));\n for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xFF007F00} ) {\n paint.setColor(color);\n canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(32, 32), &paint);\n canvas->translate(48, 0);\n }\n}\n",
"width": 256,
"height": 64,
- "hash": "de449106e78ec558d9921b9f076de164",
+ "hash": "4be3c8406a350bc3429a69e5c1daa8cd",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawBitmapRect"
},
@@ -4294,10 +4364,10 @@
"name": "SkCanvas::drawImage"
},
"SkCanvas_drawImageLattice": {
- "code": "void draw(SkCanvas* canvas) {\n SkIRect center = { 20, 10, 50, 40 };\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));\n SkCanvas bitCanvas(bitmap);\n SkPaint paint;\n SkColor gray = 0xFF000000;\n int left = 0;\n for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {\n int top = 0;\n for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {\n paint.setColor(gray);\n bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);\n gray += 0x001f1f1f;\n top = bottom;\n }\n left = right; \n }\n const int xDivs[] = { center.fLeft, center.fRight };\n const int yDivs[] = { center.fTop, center.fBottom };\n SkCanvas::Lattice::RectType fillTypes[3][3];\n memset(fillTypes, 0, sizeof(fillTypes)); \n fillTypes[1][1] = SkCanvas::Lattice::kTransparent;\n SkColor dummy[9]; // temporary pending bug fix\n SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),\n SK_ARRAY_COUNT(yDivs), nullptr, dummy };\n sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);\n SkImage* imagePtr = image.get();\n for (auto dest: { 20, 30, 40, 60, 90 } ) {\n canvas->drawImageNine(imagePtr, center, SkRect::MakeWH(dest, dest), nullptr);\n canvas->translate(dest + 4, 0);\n }\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n SkIRect center = { 20, 10, 50, 40 };\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));\n SkCanvas bitCanvas(bitmap);\n SkPaint paint;\n SkColor gray = 0xFF000000;\n int left = 0;\n for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {\n int top = 0;\n for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {\n paint.setColor(gray);\n bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);\n gray += 0x001f1f1f;\n top = bottom;\n }\n left = right; \n }\n sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);\n SkImage* imagePtr = image.get();\n for (auto dest: { 20, 30, 40, 60, 90 } ) {\n canvas->drawImageNine(imagePtr, center, SkRect::MakeWH(dest, dest), nullptr);\n canvas->translate(dest + 4, 0);\n }\n}\n",
"width": 256,
"height": 128,
- "hash": "75f43f11c6bd58175071b8b54ebec676",
+ "hash": "47f78f3f70ccd9e6c40ee3203a5c71dd",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawImageLattice"
},
@@ -4438,10 +4508,10 @@
"name": "SkCanvas::drawPath"
},
"SkCanvas_drawPicture": {
- "code": "void draw(SkCanvas* canvas) { \n SkPictureRecorder recorder;\n SkCanvas* recordingCanvas = recorder.beginRecording(50, 50);\n for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xff007f00 } ) {\n SkPaint paint;\n paint.setColor(color);\n recordingCanvas->drawRect({10, 10, 30, 40}, paint);\n recordingCanvas->translate(10, 10);\n recordingCanvas->scale(1.2f, 1.4f);\n }\n sk_sp<SkPicture> playback = recorder.finishRecordingAsPicture();\n const SkPicture* playbackPtr = playback.get();\n canvas->drawPicture(playback);\n canvas->scale(2, 2);\n canvas->translate(50, 0);\n canvas->drawPicture(playback);\n}\n",
+ "code": "void draw(SkCanvas* canvas) { \n SkPictureRecorder recorder;\n SkCanvas* recordingCanvas = recorder.beginRecording(50, 50);\n for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xff007f00 } ) {\n SkPaint paint;\n paint.setColor(color);\n recordingCanvas->drawRect({10, 10, 30, 40}, paint);\n recordingCanvas->translate(10, 10);\n recordingCanvas->scale(1.2f, 1.4f);\n }\n sk_sp<SkPicture> playback = recorder.finishRecordingAsPicture();\n canvas->drawPicture(playback);\n canvas->scale(2, 2);\n canvas->translate(50, 0);\n canvas->drawPicture(playback);\n}\n",
"width": 256,
"height": 256,
- "hash": "fde216281ff93d612768a49f2cf309ae",
+ "hash": "a7373b01354dda73dafe8718f4fd0cfc",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawPicture"
},
@@ -4757,13 +4827,29 @@
"file": "SkCanvas_Reference",
"name": "SkCanvas::writePixels_2"
},
- "SkDestinationSurfaceColorMode": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "SkColorTypeBytesPerPixel": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n SkPaint paint;\n paint.setTypeface(SkTypeface::MakeFromName(\"monospace\", SkFontStyle()));\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n int y = 15;\n canvas->drawString(\" colorType bytes\", 10, y, paint);\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n int result = SkColorTypeBytesPerPixel(colorType);\n SkString string;\n string.printf(\"%13s %4d\", colors[(int) colorType], result);\n canvas->drawString(string, 10, y += 14, paint);\n }\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 192,
+ "hash": "09ef49d07cb7005ba3e34d5ea53896f5",
"file": "SkImageInfo_Reference",
- "name": "SkDestinationSurfaceColorMode"
+ "name": "SkColorTypeBytesPerPixel"
+},
+ "SkColorTypeIsAlwaysOpaque": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n SkPaint paint;\n paint.setTypeface(SkTypeface::MakeFromName(\"monospace\", SkFontStyle()));\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n int y = 15;\n canvas->drawString(\" colorType bytes\", 10, y, paint);\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n bool result = SkColorTypeIsAlwaysOpaque(colorType);\n SkString string;\n string.printf(\"%13s %6s\", colors[(int) colorType], result ? \"true\" : \"false\");\n canvas->drawString(string, 10, y += 14, paint);\n }\n}",
+ "width": 256,
+ "height": 192,
+ "hash": "9b3eb5aaa0dfea9feee54e7650fa5446",
+ "file": "SkImageInfo_Reference",
+ "name": "SkColorTypeIsAlwaysOpaque"
+},
+ "SkColorTypeValidateAlphaType": {
+ "code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n const char* alphas[] = {\"Unknown \", \"Opaque \", \"Premul \", \"Unpremul\"};\n SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,\n kUnpremul_SkAlphaType\n };\n SkPaint paint;\n paint.setTypeface(SkTypeface::MakeFromName(\"monospace\", SkFontStyle()));\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n int y = 15;\n canvas->drawString(\" colorType alphaType canonical\", 10, y, paint);\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n for (SkAlphaType alphaType : alphaTypes) {\n SkAlphaType canonicalAlphaType = kUnknown_SkAlphaType;\n bool result = SkColorTypeValidateAlphaType(colorType, alphaType, &canonicalAlphaType);\n SkString string;\n string.printf(\"%13s %10s %10s\", colors[(int) colorType], alphas[(int) alphaType],\n result ? alphas[(int) canonicalAlphaType] : \"------ \");\n canvas->drawString(string, 10, y += 14, paint);\n }\n }\n}",
+ "width": 256,
+ "height": 640,
+ "hash": "befac1c29ed21507d367e4d824383a04",
+ "file": "SkImageInfo_Reference",
+ "name": "SkColorTypeValidateAlphaType"
},
"SkIPoint_add_operator": {
"code": "void draw(SkCanvas* canvas) {\n auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void {\n for (size_t i = 0; i < count - 1; ++i) {\n SkPoint p0, p1;\n p0.iset(pts[i]);\n p1.iset(pts[i + 1]);\n canvas->drawLine(p0, p1, paint);\n }\n };\n SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } };\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->scale(30, 15);\n draw_lines(points, SK_ARRAY_COUNT(points), paint);\n SkIPoint mod = {4, 1};\n for (auto& point : points) {\n point = point + mod;\n mod.fX -= 1;\n mod.fY += 1;\n }\n paint.setColor(SK_ColorRED);\n draw_lines(points, SK_ARRAY_COUNT(points), paint);\n}",
@@ -4814,10 +4900,10 @@
"name": "SkImageInfo::Make"
},
"SkImageInfo_MakeA8": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n uint8_t pixels[][8] = { { 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00},\n { 0x00, 0x7f, 0xff, 0x3f, 0x3f, 0x7f, 0x3f, 0x00},\n { 0x3f, 0xff, 0x7f, 0x00, 0x7f, 0xff, 0x7f, 0x00},\n { 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x7f, 0x3f, 0x00},\n { 0x3f, 0x7f, 0x7f, 0x3f, 0x00, 0x00, 0x00, 0x00},\n { 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x3f, 0x7f, 0x3f},\n { 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x7f, 0xff, 0x7f},\n { 0x3f, 0x7f, 0x7f, 0x3f, 0x00, 0x3f, 0x7f, 0x3f} };\n SkBitmap bitmap;\n bitmap.installPixels(SkImageInfo::MakeA8(8, 8),\n (void*) pixels, sizeof(pixels[0]));\n SkPaint paint;\n canvas->scale(4, 4);\n for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xFF007F00} ) {\n paint.setColor(color);\n canvas->drawBitmap(bitmap, 0, 0, &paint);\n canvas->translate(12, 0);\n }\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 64,
+ "hash": "547388991687b8e10d482d8b1c82777d",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::MakeA8"
},
@@ -4869,46 +4955,14 @@
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::MakeUnknown_2"
},
- "SkImageInfo_alphaType": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::alphaType"
-},
"SkImageInfo_bounds": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n canvas->scale(.5f, .5f);\n SkImageInfo imageInfo = source.info();\n SkIRect bounds = imageInfo.bounds();\n for (int x : { 0, bounds.width() } ) {\n for (int y : { 0, bounds.height() } ) {\n canvas->drawBitmap(source, x, y);\n }\n }\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 64,
+ "hash": "a818be8945cd0c18f99ffe53e90afa48",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::bounds()"
},
- "SkImageInfo_bytesPerPixel": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::bytesPerPixel"
-},
- "SkImageInfo_colorSpace": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::colorSpace"
-},
- "SkImageInfo_colorType": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::colorType"
-},
"SkImageInfo_computeByteSize": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
@@ -4926,26 +4980,18 @@
"name": "SkImageInfo::computeMinByteSize"
},
"SkImageInfo_computeOffset": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n uint8_t pixels[][12] = { { 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00},\n { 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00},\n { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00},\n { 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF},\n { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},\n { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00},\n { 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00},\n { 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00} };\n SkImageInfo imageInfo = SkImageInfo::MakeA8(8, 8);\n SkBitmap bitmap;\n bitmap.installPixels(imageInfo, (void*) pixels, sizeof(pixels[0]));\n SkPaint paint;\n paint.setColor(SK_ColorRED);\n canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(32, 32), &paint);\n size_t offset = imageInfo.computeOffset(2, 3, sizeof(pixels[0]));\n pixels[0][offset] = 0x7F;\n offset = imageInfo.computeOffset(5, 3, sizeof(pixels[0]));\n pixels[0][offset] = 0x7F;\n bitmap.installPixels(imageInfo, (void*) pixels, sizeof(pixels[0]));\n canvas->drawBitmapRect(bitmap, SkRect::MakeWH(8, 8), SkRect::MakeWH(128, 128), &paint);\n}",
"width": 256,
"height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "hash": "0a1ddddfe4f01c025e893ae826cb4ece",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::computeOffset"
},
- "SkImageInfo_dimensions": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::dimensions()"
-},
"SkImageInfo_empty_constructor": {
- "code": "void draw(SkCanvas* canvas) {\n SkImageInfo imageInfo;\n size_t rowBytes;\n SkIPoint origin;\n uint32_t* access = (uint32_t*) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);\n const char* alphaType[] = { \"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\" };\n SkString string;\n string.printf(\"k%s_SkAlphaType\", alphaType[(int) imageInfo.alphaType()]);\n SkPaint paint;\n canvas->drawString(string, 20, 20, paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkImageInfo imageInfo;\n size_t rowBytes;\n SkIPoint origin;\n (void) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);\n const char* alphaType[] = { \"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\" };\n SkString string;\n string.printf(\"k%s_SkAlphaType\", alphaType[(int) imageInfo.alphaType()]);\n SkPaint paint;\n canvas->drawString(string, 20, 20, paint);\n}",
"width": 256,
"height": 32,
- "hash": "20a156a9ca80ec081426b7e975383443",
+ "hash": "f206f698e7a8db3d84334c26b1a702dc",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::SkImageInfo()"
},
@@ -4966,10 +5012,10 @@
"name": "SkImageInfo::flatten()"
},
"SkImageInfo_gammaCloseToSRGB": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n const int width = 256;\n const int height = 64;\n auto drawLabel = [=](const char* what, bool closeToSRGB) -> void {\n SkString string;\n string.printf(\"%s gamma is %s\" \"close to sRGB\", what, closeToSRGB ? \"\" : \"not \");\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawString(string, width / 2, 56, paint);\n };\n SkColor gradColors[] = { 0xFFFF7F00, 0xFF00FF7F, 0xFF0000FF, 0xFF7F7FFF };\n SkPoint gradPoints[] = { { 0, 0 }, { width, 0 }, { width * 2, 0 }, { width * 3, 0 } };\n SkPaint gradPaint;\n gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,\n SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));\n canvas->drawRect(SkRect::MakeWH(width, height), gradPaint);\n drawLabel(\"canvas\", canvas->imageInfo().gammaCloseToSRGB());\n SkBitmap bitmap;\n SkImageInfo offscreenInfo = SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType);\n bitmap.allocPixels(offscreenInfo);\n SkCanvas sRGBOffscreen(bitmap);\n sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);\n canvas->translate(0, 80);\n canvas->drawBitmap(bitmap, 0, 0);\n drawLabel(\"offscreen\", offscreenInfo.gammaCloseToSRGB());\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 144,
+ "hash": "dcdc308a1a2089db47b8375178491832",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::gammaCloseToSRGB"
},
@@ -4981,70 +5027,38 @@
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::height()"
},
- "SkImageInfo_isEmpty": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::isEmpty"
-},
- "SkImageInfo_isOpaque": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::isOpaque"
-},
"SkImageInfo_makeAlphaType": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n const int width = 256;\n const int height = 128;\n SkColor pixels[height][width];\n for (int y = 0; y < height; ++y) {\n for (int x = 0; x < width; ++x) {\n int red = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 4 + y) * 0.03f))); \n int blue = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 3 + y) * 0.04f))); \n int green = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 2 + y) * 0.05f)));\n int alpha = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 1 + y) * 0.006f)));\n pixels[y][x] = \n SkColorSetARGB(alpha, red * alpha / 255, green * alpha / 255, blue * alpha / 255);\n }\n }\n SkBitmap bitmap;\n SkImageInfo info = SkImageInfo::Make(width, height, kBGRA_8888_SkColorType, kPremul_SkAlphaType);\n bitmap.installPixels(info, (void*) pixels, sizeof(SkColor) * width);\n canvas->drawBitmap(source, 0, 0);\n canvas->drawBitmap(bitmap, 0, 0);\n SkImageInfo unpremulInfo = info.makeAlphaType(kUnpremul_SkAlphaType);\n bitmap.installPixels(unpremulInfo, (void*) pixels, sizeof(SkColor) * width);\n canvas->drawBitmap(bitmap, 0, 128);\n}",
"width": 256,
"height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "hash": "5166f1a04d53443ed8aed519d0faa3db",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::makeAlphaType"
},
"SkImageInfo_makeColorSpace": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n const int width = 256;\n const int height = 64;\n auto drawLabel = [=](const char* what, bool closeToSRGB) -> void {\n SkString string;\n string.printf(\"%s gamma is %s\" \"close to sRGB\", what, closeToSRGB ? \"\" : \"not \");\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawString(string, width / 2, 56, paint);\n };\n SkColor gradColors[] = { 0xFFFF7F00, 0xFF00FF7F, 0xFF0000FF, 0xFF7F7FFF };\n SkPoint gradPoints[] = { { 0, 0 }, { width, 0 }, { width * 2, 0 }, { width * 3, 0 } };\n SkPaint gradPaint;\n gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,\n SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));\n canvas->drawRect(SkRect::MakeWH(width, height), gradPaint);\n drawLabel(\"canvas\", canvas->imageInfo().gammaCloseToSRGB());\n SkBitmap bitmap;\n SkImageInfo offscreenInfo = SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType);\n bitmap.allocPixels(offscreenInfo);\n SkCanvas sRGBOffscreen(bitmap);\n sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);\n canvas->translate(0, 80);\n canvas->drawBitmap(bitmap, 0, 0);\n drawLabel(\"offscreen\", offscreenInfo.gammaCloseToSRGB());\n SkImageInfo linearGamma =\n offscreenInfo.makeColorSpace(offscreenInfo.colorSpace()->makeLinearGamma());\n bitmap.allocPixels(linearGamma);\n SkCanvas lgOffscreen(bitmap);\n lgOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);\n canvas->translate(0, 80);\n canvas->drawBitmap(bitmap, 0, 0);\n drawLabel(\"linear\", linearGamma.gammaCloseToSRGB());\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 224,
+ "hash": "454add968099811053e2b372238472e3",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::makeColorSpace"
},
"SkImageInfo_makeColorType": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n const int width = 256;\n const int height = 128;\n SkColor pixels[height][width];\n for (int y = 0; y < height; ++y) {\n for (int x = 0; x < width; ++x) {\n int red = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 4 + y) * 0.03f))); \n int blue = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 3 + y) * 0.04f))); \n int green = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarSin((x * 2 + y) * 0.05f)));\n int alpha = SkScalarRoundToInt(255 * SkScalarAbs(SkScalarCos((x * 1 + y) * 0.006f)));\n pixels[y][x] = \n SkColorSetARGB(alpha, red * alpha / 255, green * alpha / 255, blue * alpha / 255);\n }\n }\n SkBitmap bitmap;\n SkImageInfo info = SkImageInfo::Make(width, height, kBGRA_8888_SkColorType, kPremul_SkAlphaType);\n bitmap.installPixels(info, (void*) pixels, sizeof(SkColor) * width);\n canvas->drawBitmap(source, 0, 0);\n canvas->drawBitmap(bitmap, 0, 0);\n SkImageInfo rgbaInfo = info.makeColorType(kRGBA_8888_SkColorType);\n bitmap.installPixels(rgbaInfo, (void*) pixels, sizeof(SkColor) * width);\n canvas->drawBitmap(bitmap, 0, 128);\n}",
"width": 256,
"height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "hash": "0d67609fbf0988bfaf9ca5e2460af3d3",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::makeColorType"
},
"SkImageInfo_makeWH": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkImageInfo canvasImageInfo = canvas->imageInfo();\n SkRect canvasBounds = SkRect::Make(canvasImageInfo.bounds());\n canvas->drawBitmapRect(source, source.bounds(), canvasBounds, nullptr);\n SkImageInfo insetImageInfo = \n canvasImageInfo.makeWH(canvasBounds.width() / 2, canvasBounds.height() / 2);\n SkBitmap inset;\n inset.allocPixels(insetImageInfo);\n SkCanvas offscreen(inset);\n offscreen.drawBitmapRect(source, source.bounds(), SkRect::Make(inset.bounds()), nullptr);\n canvas->drawBitmap(inset, canvasBounds.width() / 4, canvasBounds.height() / 4);\n}",
"width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
+ "height": 144,
+ "hash": "26827898b6b199d6c4b5e4d2c6e6bac8",
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::makeWH"
},
- "SkImageInfo_minRowBytes": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::minRowBytes"
-},
- "SkImageInfo_minRowBytes64": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::minRowBytes64"
-},
"SkImageInfo_notequal1_operator": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
@@ -5053,14 +5067,6 @@
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::operator!=(const SkImageInfo& other)_const"
},
- "SkImageInfo_refColorSpace": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::refColorSpace"
-},
"SkImageInfo_reset": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
@@ -5069,14 +5075,6 @@
"file": "SkImageInfo_Reference",
"name": "SkImageInfo::reset()"
},
- "SkImageInfo_shiftPerPixel": {
- "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
- "width": 256,
- "height": 256,
- "hash": "882e8e0103048009a25cfc20400492f7",
- "file": "SkImageInfo_Reference",
- "name": "SkImageInfo::shiftPerPixel"
-},
"SkImageInfo_unflatten": {
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
"width": 256,
@@ -5237,6 +5235,14 @@
"file": "SkImage_Reference",
"name": "SkImage::colorSpace"
},
+ "SkImage_colorType": {
+ "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
+ "width": 256,
+ "height": 256,
+ "hash": "882e8e0103048009a25cfc20400492f7",
+ "file": "SkImage_Reference",
+ "name": "SkImage::colorType"
+},
"SkImage_encodeToData": {
"code": "void draw(SkCanvas* canvas) {\n canvas->scale(4, 4);\n SkIRect subset = {0, 0, 16, 64};\n int x = 0;\n for (int quality : { 0, 10, 50, 100 } ) {\n sk_sp<SkData> data(image->encodeToData(SkEncodedImageFormat::kJPEG, quality));\n sk_sp<SkImage> filtered = SkImage::MakeFromEncoded(data, &subset);\n canvas->drawImage(filtered, x, 0);\n x += 16;\n }\n}",
"width": 256,
@@ -5254,10 +5260,10 @@
"name": "SkImage::encodeToData_2"
},
"SkImage_getTextureHandle": {
- "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n SkString str;\n int y = -10;\n for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context,\n backEndTexture, origin, kPremul_SkAlphaType, nullptr));\n GrSurfaceOrigin readBackOrigin;\n GrBackendObject readBackHandle = srcImage->getTextureHandle(false, &readBackOrigin);\n str.printf(\"readBackHandle: 0x%x\", readBackHandle);\n canvas->drawString(str, 5, y += 30, paint);\n canvas->drawImage(srcImage, 80, y += 10);\n str.printf(\"origin: k%s_GrSurfaceOrigin\", readBackOrigin ? \"BottomLeft\" : \"TopLeft\");\n canvas->drawString(str, 5, y += srcImage->height() + 10, paint);\n }\n}",
+ "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n SkString str;\n int y = -10;\n for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context,\n backEndTexture, origin, kPremul_SkAlphaType, nullptr));\n GrSurfaceOrigin readBackOrigin;\n GrBackendObject readBackHandle = srcImage->getTextureHandle(false, &readBackOrigin);\n str.printf(\"readBackHandle: 0x%lx\", readBackHandle);\n canvas->drawString(str, 5, y += 30, paint);\n canvas->drawImage(srcImage, 80, y += 10);\n str.printf(\"origin: k%s_GrSurfaceOrigin\", readBackOrigin ? \"BottomLeft\" : \"TopLeft\");\n canvas->drawString(str, 5, y += srcImage->height() + 10, paint);\n }\n}",
"width": 256,
"height": 256,
- "hash": "f8943191063bfcc69f29f2b149df5c6d",
+ "hash": "1de691e4159745d7ee5e82158acdb349",
"file": "SkImage_Reference",
"name": "SkImage::getTextureHandle"
},
@@ -5366,10 +5372,10 @@
"name": "SkImage::makeTextureImage"
},
"SkImage_makeWithFilter": {
- "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkImageFilter> shadowFilter = SkDropShadowImageFilter::Make(\n -10.0f * frame, 5.0f * frame, 3.0f, 3.0f, SK_ColorBLUE,\n SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,\n nullptr);\n sk_sp<SkImageFilter> offsetFilter = SkOffsetImageFilter::Make(40, 40, shadowFilter, nullptr);\n SkIRect subset = image->bounds();\n SkIRect clipBounds = image->bounds();\n clipBounds.outset(60, 60);\n SkIRect outSubset;\n SkIPoint offset;\n sk_sp<SkImage> filtered(image->makeWithFilter(offsetFilter.get(), subset, clipBounds,\n &outSubset, &offset));\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->drawLine(0, 0, offset.fX, offset.fY, paint);\n canvas->translate(offset.fX, offset.fY);\n canvas->drawImage(filtered, 0, 0);\n canvas->drawRect(SkRect::MakeFromIRect(outSubset), paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkImageFilter> shadowFilter = SkDropShadowImageFilter::Make(\n -10.0f * frame, 5.0f * frame, 3.0f, 3.0f, SK_ColorBLUE,\n SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,\n nullptr);\n sk_sp<SkImageFilter> offsetFilter = SkOffsetImageFilter::Make(40, 40, shadowFilter, nullptr);\n SkIRect subset = image->bounds();\n SkIRect clipBounds = image->bounds();\n clipBounds.outset(60, 60);\n SkIRect outSubset;\n SkIPoint offset;\n sk_sp<SkImage> filtered(image->makeWithFilter(offsetFilter.get(), subset, clipBounds,\n &outSubset, &offset));\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n canvas->drawLine(0, 0, offset.fX, offset.fY, paint);\n canvas->translate(offset.fX, offset.fY);\n canvas->drawImage(filtered, 0, 0);\n canvas->drawRect(SkRect::Make(outSubset), paint);\n}",
"width": 256,
"height": 256,
- "hash": "eabb12543886ace5e1212af220a19c6d",
+ "hash": "17547129251dd9607c381a3cc30cff15",
"file": "SkImage_Reference",
"name": "SkImage::makeWithFilter"
},
@@ -5501,6 +5507,14 @@
"file": "SkMatrix_Reference",
"name": "SkMatrix::fixedStepInX"
},
+ "SkMatrix_getMinMaxScales": {
+ "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setAll(1, 0, 0, 0, 1, 0, 0, 0, 0);\n if (matrix.invert(&matrix)) {\n SkScalar factor[2] = {2, 2};\n bool result = matrix.getMinMaxScales(factor);\n SkDebugf(\"matrix.getMinMaxScales() %s %g %g\\n\",\n result ? \"true\" : \"false\", factor[0], factor[1]);\n }\n}",
+ "width": 256,
+ "height": 256,
+ "hash": "13adba0ecf5f82247cf051b4fa4d8a9c",
+ "file": "SkMatrix_Reference",
+ "name": "SkMatrix::getMinMaxScales"
+},
"SkMatrix_getPerspX": {
"code": "void draw(SkCanvas* canvas) {\n SkMatrix m;\n m.setIdentity();\n m.set(SkMatrix::kMPersp0, -0.004f);\n SkAutoCanvasRestore autoRestore(canvas, true);\n canvas->translate(22, 144);\n SkPaint black;\n black.setAntiAlias(true);\n black.setTextSize(24);\n SkPaint gray = black;\n gray.setColor(0xFF9f9f9f);\n SkString string;\n string.appendScalar(m.getPerspX());\n canvas->drawString(string, 0, -72, gray);\n canvas->concat(m);\n canvas->drawString(string, 0, 0, black);\n}",
"width": 256,
@@ -5526,10 +5540,10 @@
"name": "SkMatrix::hasPerspective"
},
"SkMatrix_invert": {
- "code": "void draw(SkCanvas* canvas) {\n const SkPoint src[] = { { 10, 120}, {120, 120}, {120, 10}, { 10, 10} };\n const SkPoint dst[] = { {150, 120}, {200, 100}, {240, 30}, { 130, 40} };\n SkPaint paint;\n paint.setAntiAlias(true);\n SkMatrix matrix;\n matrix.setPolyToPoly(src, dst, 4);\n canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, src, paint);\n canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, dst, paint);\n paint.setColor(SK_ColorBLUE);\n paint.setStrokeWidth(3);\n paint.setStrokeCap(SkPaint::kRound_Cap);\n canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);\n matrix.invert(&matrix);\n canvas->concat(matrix);\n canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n const SkPoint src[] = { { 10, 120}, {120, 120}, {120, 10}, { 10, 10} };\n const SkPoint dst[] = { {150, 120}, {200, 100}, {240, 30}, { 130, 40} };\n SkPaint paint;\n paint.setAntiAlias(true);\n SkMatrix matrix;\n matrix.setPolyToPoly(src, dst, 4);\n canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, src, paint);\n canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, dst, paint);\n paint.setColor(SK_ColorBLUE);\n paint.setStrokeWidth(3);\n paint.setStrokeCap(SkPaint::kRound_Cap);\n canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);\n if (matrix.invert(&matrix)) {\n canvas->concat(matrix);\n canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);\n }\n}",
"width": 256,
"height": 128,
- "hash": "10a10c5bf2ac7ec88e84204441fc83b6",
+ "hash": "0e03cd9f154603ed4b21ca56d69dae44",
"file": "SkMatrix_Reference",
"name": "SkMatrix::invert()"
},
@@ -5654,18 +5668,18 @@
"name": "SkMatrix::mapXY_2"
},
"SkMatrix_postConcat": {
- "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix, matrix2;\n SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};\n SkRect::Make(source.bounds()).toQuad(bitmapBounds);\n matrix.setPolyToPoly(bitmapBounds, perspect, 4);\n matrix.postConcat(matrix);\n canvas->concat(matrix);\n canvas->drawBitmap(source, 0, 0);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};\n SkRect::Make(source.bounds()).toQuad(bitmapBounds);\n matrix.setPolyToPoly(bitmapBounds, perspect, 4);\n matrix.postConcat(matrix);\n canvas->concat(matrix);\n canvas->drawBitmap(source, 0, 0);\n}",
"width": 256,
"height": 64,
- "hash": "0a4214289249c77f48d59227c4ac4d9e",
+ "hash": "e4226c55d9bdbc119264bd372b2b9835",
"file": "SkMatrix_Reference",
"name": "SkMatrix::postConcat"
},
"SkMatrix_postIDiv": {
- "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix, matrix2;\n SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};\n SkRect::Make(source.bounds()).toQuad(bitmapBounds);\n matrix.setPolyToPoly(bitmapBounds, perspect, 4);\n matrix.postIDiv(1, 2);\n canvas->concat(matrix);\n canvas->drawBitmap(source, 0, 0);\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};\n SkRect::Make(source.bounds()).toQuad(bitmapBounds);\n matrix.setPolyToPoly(bitmapBounds, perspect, 4);\n matrix.postIDiv(1, 2);\n canvas->concat(matrix);\n canvas->drawBitmap(source, 0, 0);\n}",
"width": 256,
"height": 256,
- "hash": "58c844b8f0c36acdbc8211e8c929c253",
+ "hash": "e6ad0bd2999613d9e4758b661d45070c",
"file": "SkMatrix_Reference",
"name": "SkMatrix::postIDiv"
},
@@ -6150,10 +6164,10 @@
"name": "SkPaint::setLinearText"
},
"SkPaint_setMaskFilter": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(10);\n paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 10));\n canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setStrokeWidth(10);\n paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 10));\n canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);\n}\n",
"width": 256,
"height": 256,
- "hash": "62c5a826692f85c3de3bab65e9e97aa9",
+ "hash": "a993831c40f3e134f809134e3b74e4a6",
"file": "SkPaint_Reference",
"name": "SkPaint::setMaskFilter"
},
@@ -6734,10 +6748,10 @@
"name": "SkPixmap::extractSubset"
},
"SkPixmap_readPixels": {
- "code": "void draw(SkCanvas* canvas) {\n SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height(),\n canvas->imageInfo().colorSpace() ? SkColorSpace::MakeSRGB() : nullptr);\n std::vector<int32_t> srcPixels;\n srcPixels.resize(image->height() * image->width() * 4);\n SkPixmap pixmap(info, (const void*) &srcPixels.front(), image->width() * 4);\n image->readPixels(pixmap, 0, 0);\n SkTransferFunctionBehavior behavior = canvas->imageInfo().colorSpace() ?\n SkTransferFunctionBehavior::kRespect : SkTransferFunctionBehavior::kIgnore;\n std::vector<int32_t> dstPixels;\n dstPixels.resize(image->height() * image->width() * 4);\n int offset = 0;\n for (auto behavior : { SkTransferFunctionBehavior::kRespect,\n SkTransferFunctionBehavior::kIgnore} ) {\n pixmap.readPixels(info, &dstPixels.front(), image->width() * 4, offset, 0, behavior);\n offset += 128;\n }\n SkBitmap bitmap;\n SkPixmap dstmap(info, &dstPixels.front(), image->width() * 4);\n bitmap.installPixels(dstmap);\n canvas->drawBitmap(bitmap, 0, 0);\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n SkImageInfo srgb = SkImageInfo::MakeS32(image->width(), image->height(),\n kPremul_SkAlphaType);\n SkImageInfo linear = srgb.makeColorSpace(srgb.colorSpace()->makeLinearGamma());\n std::vector<int32_t> srcPixels;\n size_t rowBytes = image->width() * 4;\n srcPixels.resize(image->height() * rowBytes);\n SkPixmap pixmap(srgb, (const void*) &srcPixels.front(), rowBytes);\n image->readPixels(pixmap, 0, 0);\n int offset = -64;\n std::vector<int32_t> dstPixels;\n dstPixels.resize(image->height() * rowBytes);\n for (const auto& info : { srgb, linear } ) {\n for (auto behavior : { SkTransferFunctionBehavior::kRespect,\n SkTransferFunctionBehavior::kIgnore} ) {\n pixmap.readPixels(info, &dstPixels.front(), rowBytes, 0, 0, behavior);\n SkBitmap bitmap;\n SkPixmap dstmap(info, &dstPixels.front(), rowBytes);\n bitmap.installPixels(dstmap);\n canvas->drawBitmap(bitmap, 0, offset += 64);\n }\n }\n}\n",
"width": 256,
"height": 256,
- "hash": "2b7f6cc59ea2d5ebceddccbc2f232bcf",
+ "hash": "48ccfadec48f987c81a1e218e49cca68",
"file": "SkPixmap_Reference",
"name": "SkPixmap::readPixels"
},
@@ -7086,18 +7100,18 @@
"name": "SkSurface::getCanvas"
},
"SkSurface_getRenderTargetHandle": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject;\n if (gpuSurface->getRenderTargetHandle(&backendObject, \n SkSurface::kFlushRead_BackendHandleAccess)) {\n SkString str;\n str.printf(\"backendObject=%d\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject;\n if (gpuSurface->getRenderTargetHandle(&backendObject, \n SkSurface::kFlushRead_BackendHandleAccess)) {\n SkString str;\n str.printf(\"backendObject=%ld\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}",
"width": 256,
"height": 64,
- "hash": "16e848a4405ce08f8393bba13cc3b8bf",
+ "hash": "dbc6c0e01a177ba03c87c00c32a43148",
"file": "SkSurface_Reference",
"name": "SkSurface::getRenderTargetHandle"
},
"SkSurface_getTextureHandle": {
- "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject = gpuSurface->getTextureHandle(\n SkSurface::kFlushRead_BackendHandleAccess);\n if (backendObject) {\n SkString str;\n str.printf(\"backendObject=%08x\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}",
+ "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject = gpuSurface->getTextureHandle(\n SkSurface::kFlushRead_BackendHandleAccess);\n if (backendObject) {\n SkString str;\n str.printf(\"backendObject=%08lx\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}",
"width": 256,
"height": 64,
- "hash": "4b5720038daaf65ba1ba546e678ddd6e",
+ "hash": "f7558a62985f70f2286307993db4b3bc",
"file": "SkSurface_Reference",
"name": "SkSurface::getTextureHandle"
},
diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md
index f7ccf2bb37..86aae54dbe 100644
--- a/site/user/api/undocumented.md
+++ b/site/user/api/undocumented.md
@@ -172,6 +172,15 @@ static sk_sp&lt;SkColorSpace&gt; MakeSRGBLinear()
---
+<a name="SkColorSpace_gammaCloseToSRGB"></a>
+## gammaCloseToSRGB
+
+<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
+bool gammaCloseToSRGB() const
+</pre>
+
+---
+
## <a name="SkTransferFunctionBehavior"></a> Enum SkTransferFunctionBehavior
### Constants
@@ -890,6 +899,8 @@ Topic</table>
# <a name="GrBackendTexture"></a> Class GrBackendTexture
+# <a name="Transfer_Mode"></a> Transfer Mode
+
# <a name="Typeface"></a> Typeface
# <a name="SkTypeface"></a> Class SkTypeface