remove SkPaint Align from doc examples

remove SkPaint::.*_Align from doc examples

TBR=reed@oogle.com
NOTRY=true
Docs-Preview: https://skia.org/?cl=166561
Bug: skia:
Change-Id: I34e02c96852035400803555816af2d062ebc5a95
Reviewed-on: https://skia-review.googlesource.com/c/166561
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
Cary Clark 2018-10-30 15:42:28 -04:00 committed by Skia Commit-Bot
parent a4eb9360a4
commit ab8fc1d951
5 changed files with 146 additions and 223 deletions

View File

@ -69,7 +69,6 @@ Constructs Paint with default values.
# Path_Effect # nullptr ##
# Shader # nullptr ##
# Style # kFill_Style ##
# Text_Align # kLeft_Align ##
# Text_Encoding # kUTF8_TextEncoding ##
# Text_Scale_X # 1 ##
# Text_Size # 12 ##
@ -3307,77 +3306,23 @@ Increments drawLooper Reference_Count by one.
#Line # text placement relative to position ##
#Enum Align
#Line # glyph locations relative to text position ##
#Code
#Populate
##
#Code
#In Constant
#Filter kAlign
#Populate
#Const kLeft_Align 1
#Deprecated
##
Align adjusts the text relative to the text position.
Align affects Glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText,
SkCanvas::drawPosTextH, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob,
and SkCanvas::drawString;
as well as calls that place text Glyphs like getTextWidths and getTextPath.
The text position is set by the font for both horizontal and vertical text.
Typically, for horizontal text, the position is to the left side of the glyph on the
base line; and for vertical text, the position is the horizontal center of the glyph
at the caps height.
Align adjusts the glyph position to center it or move it to abut the position
using the metrics returned by the font.
Align defaults to kLeft_Align.
#Const kLeft_Align 0
#Line # positions glyph by computed font offset ##
Leaves the glyph at the position computed by the font offset by the text position.
#Const kCenter_Align 2
#Deprecated
##
#Const kCenter_Align 1
#Line # centers line of glyphs by its width or height ##
Moves the glyph half its width.
#Const kRight_Align 3
#Deprecated
##
#Const kRight_Align 2
#Line # moves lines of glyphs by its width or height ##
Moves the glyph by its width.
##
#Const kAlignCount 3
#Line # number of different Text_Align values defined ##
May be used to verify that Align is a legal value.
##
#Deprecated
#Enum ##
#Example
#Height 160
#Description
Each position separately moves the glyph in drawPosText.
##
#Function
###$
#include "SkTextUtils.h"
$$$#
##
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setTextSize(40);
for (SkPaint::Align a : { SkPaint::kLeft_Align,
SkPaint::kCenter_Align,
SkPaint::kRight_Align}) {
SkTextUtils::DrawString(canvas, "Aa", 100, 50, paint, a);
canvas->translate(0, 50);
}
}
#Const kAlignCount 0
#Deprecated
##
#Method Align getTextAlign() const

View File

@ -15,10 +15,10 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "16-bit word", 5 + 20 * 8, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 1.5f, 137, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 6.5f, 187, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "16-bit word", 5 + 20 * 8, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 1.5f, 137, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 6.5f, 187, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -30,7 +30,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -38,7 +38,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -74,8 +74,8 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "16-bit word", 5 + 20 * 8, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "16-bit word", 5 + 20 * 8, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -87,7 +87,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -95,7 +95,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -129,8 +129,8 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -142,7 +142,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -150,7 +150,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -186,8 +186,8 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -199,7 +199,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -207,7 +207,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -243,8 +243,8 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -256,7 +256,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -264,7 +264,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -300,14 +300,14 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 4, 137, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 3, 187, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 7, 187, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 2, 237, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 6, 237, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 5, 287, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 4, 137, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 3, 187, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 7, 187, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 2, 237, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 6, 237, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 5, 287, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -319,7 +319,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -327,7 +327,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -368,14 +368,14 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 4, 137, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 3, 187, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 7, 187, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 2, 237, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 6, 237, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 5, 287, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "32-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 4, 137, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 3, 187, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 7, 187, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 2, 237, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 6, 237, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 5, 287, paint, SkTextUtils::kCenter_Align);
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
@ -387,7 +387,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -395,7 +395,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -436,11 +436,11 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "64-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 135, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "64-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 135, paint, SkTextUtils::kCenter_Align);
for (int i = 0; i < 4; ++i) {
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 4, 187 + i * 100, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 4, 237 + i * 100, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 20 * 4, 187 + i * 100, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 5 + 20 * 4, 237 + i * 100, paint, SkTextUtils::kCenter_Align);
}
auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
@ -453,7 +453,7 @@ void draw(SkCanvas* canvas) {
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'};
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);
break;
}
}
@ -461,7 +461,7 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
@ -504,11 +504,11 @@ void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
SkTextUtils::DrawString(canvas, "128-bit word", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 135, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "128-bit word", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "little endian byte order", 5 + 20 * 4, 135, paint, SkTextUtils::kCenter_Align);
for (int i = 0; i < 4; ++i) {
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 10 * 4, 187 + i * 100, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 105 + 10 * 4, 237 + i * 100, paint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "(low bits)", 5 + 10 * 4, 187 + i * 100, paint, SkTextUtils::kCenter_Align);
SkTextUtils::DrawString(canvas, "(high bits)", 105 + 10 * 4, 237 + i * 100, paint, SkTextUtils::kCenter_Align);
}
auto drawBoxText = [=](SkScalar e[], const char* s[], const char* nums[] ,
int count, int n, SkScalar yPos) -> void {
@ -522,9 +522,9 @@ void draw(SkCanvas* canvas) {
if (2 == count) {
x += stringIndex * 12 + (stringIndex ? 8 : 0);
}
SkTextUtils::DrawString(canvas, nums[stringIndex], x, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, nums[stringIndex], x, yPos - 5, p, SkTextUtils::kCenter_Align);
if (1 == count) {
SkTextUtils::DrawString(canvas, nums[stringIndex], xPos + 100, yPos - 5, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, nums[stringIndex], xPos + 100, yPos - 5, p, SkTextUtils::kCenter_Align);
}
++stringIndex;
}
@ -532,9 +532,9 @@ void draw(SkCanvas* canvas) {
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkTextUtils::kCenter_Align);
if (1 == count) {
SkTextUtils::DrawString(canvas, s[i], 105 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, s[i], 105 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkTextUtils::kCenter_Align);
}
}
p.setStyle(SkPaint::kStroke_Style);
@ -610,10 +610,10 @@ void draw(SkCanvas* canvas) {
SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,
SkBlendMode::kDstIn, SkBlendMode::kDstOut,
SkBlendMode::kClear, SkBlendMode::kXor } ) {
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkTextUtils::kCenter_Align);
srcPaint.setBlendMode(blend);
canvas->drawBitmap(srcBits, 0, 0, &srcPaint);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkTextUtils::kCenter_Align);
canvas->translate(80, 0);
if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {
canvas->translate(-80 * 5, 100);
@ -657,10 +657,10 @@ void draw(SkCanvas* canvas) {
SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,
SkBlendMode::kDstIn, SkBlendMode::kDstOut,
SkBlendMode::kClear, SkBlendMode::kXor } ) {
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkTextUtils::kCenter_Align);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkTextUtils::kCenter_Align);
canvas->translate(80, 0);
if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {
canvas->translate(-80 * 5, 100);
@ -699,10 +699,10 @@ void draw(SkCanvas* canvas) {
SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,
SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,
SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply } ) {
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkTextUtils::kCenter_Align);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkTextUtils::kCenter_Align);
canvas->translate(90, 0);
if (SkBlendMode::kLighten == blend || SkBlendMode::kDifference == blend) {
canvas->translate(-90 * 5, 100);
@ -739,11 +739,11 @@ void draw(SkCanvas* canvas) {
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,
SkBlendMode::kLuminosity } ) {
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkTextUtils::kCenter_Align);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint,
SkPaint::kCenter_Align);
SkTextUtils::kCenter_Align);
canvas->translate(90, 0);
}
}
@ -783,16 +783,16 @@ void draw(SkCanvas* canvas) {
canvas->drawColor(0, SkBlendMode::kClear);
srcPaint.setBlendMode(SkBlendMode::kModulate);
for (auto step: { 1, 2 } ) {
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "&", 50, 80, dstPaint, SkTextUtils::kCenter_Align);
if (1 == step) {
canvas->drawBitmap(srcBits, 0, 0, &srcPaint);
SkTextUtils::DrawString(canvas, "Bitmap", 50, 18, labelPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "Bitmap", 50, 18, labelPaint, SkTextUtils::kCenter_Align);
} else {
canvas->drawPath(srcPath, srcPaint);
SkTextUtils::DrawString(canvas, "Geometry", 50, 18, labelPaint, SkPaint::kCenter_Align);
SkTextUtils::DrawString(canvas, "Geometry", 50, 18, labelPaint, SkTextUtils::kCenter_Align);
}
SkTextUtils::DrawString(canvas, SkBlendMode_Name(SkBlendMode::kModulate), 50, 100, labelPaint,
SkPaint::kCenter_Align);
SkTextUtils::kCenter_Align);
canvas->translate(120, 0);
}
}

View File

@ -439,7 +439,7 @@ bits for <a href='SkColor_Reference#Alpha'>Alpha</a>.
Pixels are fully opaque as if its <a href='SkColor_Reference#Alpha'>Color Alpha</a> was set to one, and should
always be paired with <a href='#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>.
![Color_Type_RGB_565](https://fiddle.skia.org/i/21e703b1aba5f2404f94f3db34d4f7cb_raster.png "")
![Color_Type_RGB_565](https://fiddle.skia.org/i/6dec0226490a4ac1977dc87a31564147_raster.png "")
### Example
@ -458,7 +458,7 @@ component: alpha, blue, green, and red; use four bits, describing 16 levels.
Note that <a href='#kARGB_4444_SkColorType'>kARGB_4444_SkColorType</a> is misnamed; the acronym does not
describe the actual component order.
![Color_Type_ARGB_4444](https://fiddle.skia.org/i/bdc77b69231f1e1699e245944f1b239c_raster.png "")
![Color_Type_ARGB_4444](https://fiddle.skia.org/i/e8008512f0d197051e3f26faa67bafc2_raster.png "")
If paired with <a href='#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are
<a href='undocumented#Premultiply'>Premultiplied</a> by the alpha value. If blue, green, or red is greater than alpha,
@ -487,7 +487,7 @@ less than 15, the drawn result is undefined.
<a href='#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a> encodes ARGB into a 32-bit word. Each component:
red, green, blue, alpha; use eight bits, describing 256 levels.
![Color_Type_RGBA_8888](https://fiddle.skia.org/i/98d5232ae83a71fecf35713bcd635fdc_raster.png "")
![Color_Type_RGBA_8888](https://fiddle.skia.org/i/9abc324f670e6468f09385551aae5a1c_raster.png "")
If paired with <a href='#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: red, green, and blue components are
<a href='undocumented#Premultiply'>Premultiplied</a> by the alpha value. If red, green, or blue is greater than alpha,
@ -523,7 +523,7 @@ unused. Pixels described by <a href='#kRGB_888x_SkColorType'>kRGB_888x_SkColorTy
their <a href='SkColor_Reference#Alpha'>Color Alpha</a> was set to one, and should always be paired with
<a href='#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>.
![Color_Type_RGB_888](https://fiddle.skia.org/i/a11d984d5880664ca15dbac5beed44a3_raster.png "")
![Color_Type_RGB_888](https://fiddle.skia.org/i/7527d7ade4764302818e250cd4e03962_raster.png "")
### Example
@ -540,7 +540,7 @@ their <a href='SkColor_Reference#Alpha'>Color Alpha</a> was set to one, and shou
<a href='#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a> encodes ARGB into a 32-bit word. Each component:
blue, green, red, and alpha; use eight bits, describing 256 levels.
![Color_Type_BGRA_8888](https://fiddle.skia.org/i/743a950f1df07936e8a5fcb2a91208c4_raster.png "")
![Color_Type_BGRA_8888](https://fiddle.skia.org/i/6c35ca14d88b0de200ba7f897f889ad7_raster.png "")
If paired with <a href='#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are
<a href='undocumented#Premultiply'>Premultiplied</a> by the alpha value. If blue, green, or red is greater than alpha,
@ -579,7 +579,7 @@ three: fully opaque.
At present, <a href='SkColor_Reference#Color'>Color</a> in <a href='SkPaint_Reference#Paint'>Paint</a> does not provide enough precision to
draw all colors possible to a <a href='#kRGBA_1010102_SkColorType'>kRGBA_1010102_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>.
![Color_Type_RGBA_1010102](https://fiddle.skia.org/i/2ee75d2bd4e59dc7ab97a96d86fd9bfc_raster.png "")
![Color_Type_RGBA_1010102](https://fiddle.skia.org/i/8d78daf69145f611054f289a7443a670_raster.png "")
If paired with <a href='#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: red, green, and blue components are
<a href='undocumented#Premultiply'>Premultiplied</a> by the alpha value. If red, green, or blue is greater than the
@ -614,7 +614,7 @@ with <a href='#kOpaque_SkAlphaType'>kOpaque_SkAlphaType</a>.
At present, <a href='SkColor_Reference#Color'>Color</a> in <a href='SkPaint_Reference#Paint'>Paint</a> does not provide enough precision to
draw all colors possible to a <a href='#kRGB_101010x_SkColorType'>kRGB_101010x_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>.
![Color_Type_RGB_101010](https://fiddle.skia.org/i/719fea0149e040ac1178fe298d4f7c7a_raster.png "")
![Color_Type_RGB_101010](https://fiddle.skia.org/i/4c9f4d939e2047269d73fa3507caf01f_raster.png "")
### Example
@ -657,7 +657,7 @@ Each component encodes a floating point value using <a href='https://www.khronos
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/adc8262f27f1ac048984b4cbff9334ac_raster.png "")
![Color_Type_RGBA_F16](https://fiddle.skia.org/i/1bb35ae52173e0fef874022ca8138adc_raster.png "")
If paired with <a href='#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are
<a href='undocumented#Premultiply'>Premultiplied</a> by the alpha value. If blue, green, or red is greater than alpha,
@ -694,7 +694,7 @@ Each component encodes a floating point value using <a href='https://en.wikipedi
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_F32](https://fiddle.skia.org/i/36efa3247a841d0a46aee987a05e9fc2_raster.png "")
![Color_Type_RGBA_F32](https://fiddle.skia.org/i/4ba31a8f9bc94a996f34da81ef541a9c_raster.png "")
If paired with <a href='#kPremul_SkAlphaType'>kPremul_SkAlphaType</a>: blue, green, and red components are
<a href='undocumented#Premultiply'>Premultiplied</a> by the alpha value. If blue, green, or red is greater than alpha,

View File

@ -299,7 +299,6 @@ Constructs <a href='#Paint'>Paint</a> with default values.
| <a href='undocumented#Path_Effect'>Path Effect</a> | nullptr |
| <a href='undocumented#Shader'>Shader</a> | nullptr |
| <a href='#SkPaint_Style'>Style</a> | <a href='#SkPaint_kFill_Style'>kFill Style</a> |
| <a href='#Text_Align'>Text Align</a> | <a href='#SkPaint_kLeft_Align'>kLeft Align</a> |
| <a href='#Text_Encoding'>Text Encoding</a> | <a href='#SkPaint_kUTF8_TextEncoding'>kUTF8 TextEncoding</a> |
| <a href='#Text_Scale_X'>Text Scale X</a> | 1 |
| <a href='#Text_Size'>Text Size</a> | 12 |
@ -3631,8 +3630,6 @@ Deprecated.
<a name='Text_Align'></a>
---
<a name='SkPaint_Align'></a>
---
@ -3645,26 +3642,6 @@ Deprecated.
};
</pre>
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
static constexpr int <a href='#SkPaint_kAlignCount'>kAlignCount</a> = 3;
</pre>
<a href='#SkPaint_Align'>Align</a> adjusts the text relative to the text position.
<a href='#SkPaint_Align'>Align</a> affects <a href='undocumented#Glyph'>Glyphs</a> drawn with: <a href='SkCanvas_Reference#SkCanvas_drawText'>SkCanvas::drawText</a>, <a href='SkCanvas_Reference#SkCanvas_drawPosText'>SkCanvas::drawPosText</a>,
<a href='SkCanvas_Reference#SkCanvas_drawPosTextH'>SkCanvas::drawPosTextH</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextRSXform'>SkCanvas::drawTextRSXform</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextBlob'>SkCanvas::drawTextBlob</a>,
and <a href='SkCanvas_Reference#SkCanvas_drawString'>SkCanvas::drawString</a>;
as well as calls that place text <a href='undocumented#Glyph'>Glyphs</a> like <a href='#SkPaint_getTextWidths'>getTextWidths</a> and <a href='#SkPaint_getTextPath'>getTextPath</a>.
The text position is set by the font for both horizontal and vertical text.
Typically, for horizontal text, the position is to the left side of the glyph on the
base line; and for vertical text, the position is the horizontal center of the glyph
at the caps height.
<a href='#SkPaint_Align'>Align</a> adjusts the glyph position to center it or move it to abut the position
using the metrics returned by the font.
<a href='#SkPaint_Align'>Align</a> defaults to <a href='#SkPaint_kLeft_Align'>kLeft Align</a>.
### Constants
<table style='border-collapse: collapse; width: 62.5em'>
@ -3673,38 +3650,47 @@ using the metrics returned by the font.
<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLeft_Align'><code>SkPaint::kLeft_Align</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
Leaves the glyph at the position computed by the font offset by the text position.
Deprecated.
</td>
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kCenter_Align'><code>SkPaint::kCenter_Align</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
Moves the glyph half its width.
Deprecated.
</td>
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kRight_Align'><code>SkPaint::kRight_Align</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
Moves the glyph by its width.
</td>
</tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAlignCount'><code>SkPaint::kAlignCount</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
May be used to verify that <a href='#SkPaint_Align'>Align</a> is a legal value.
Deprecated.
</td>
</tr>
</table>
### Example
Deprecated.
<div><fiddle-embed name="6ee1866e4da0064d9d340b07e05f0aca"><div>Each position separately moves the glyph in drawPosText.
</div></fiddle-embed></div>
### Constants
<table style='border-collapse: collapse; width: 62.5em'>
<tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th>
<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th>
<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAlignCount'><code>SkPaint::kAlignCount</code></a></td>
<td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
Deprecated.
</td>
</tr>
</table>
<a name='SkPaint_getTextAlign'></a>

View File

@ -3884,114 +3884,114 @@
"name": "Color_Constants_4"
},
"Illustrations_Blend_Mode_Overview_Color_Blends": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n canvas->drawColor(0, SkBlendMode::kClear);\n for (auto blend : { SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,\n SkBlendMode::kLuminosity } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkPaint::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint,\n SkPaint::kCenter_Align);\n canvas->translate(90, 0);\n }\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n canvas->drawColor(0, SkBlendMode::kClear);\n for (auto blend : { SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,\n SkBlendMode::kLuminosity } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkTextUtils::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint,\n SkTextUtils::kCenter_Align);\n canvas->translate(90, 0);\n }\n}\n",
"width": 480,
"height": 110,
"hash": "6a95ff41078ca855131f8d8b4fde29f2",
"hash": "630fe21aea8369b307231f5bcf8b2d50",
"file": "illustrations",
"name": "Blend_Mode_Overview_Color_Blends"
},
"Illustrations_Blend_Mode_Overview_Lighten_Darken": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n canvas->drawColor(0, SkBlendMode::kClear);\n for (auto blend : { SkBlendMode::kPlus, SkBlendMode::kScreen, SkBlendMode::kOverlay,\n SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,\n SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,\n SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkPaint::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkPaint::kCenter_Align);\n canvas->translate(90, 0);\n if (SkBlendMode::kLighten == blend || SkBlendMode::kDifference == blend) {\n canvas->translate(-90 * 5, 100);\n }\n }\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n canvas->drawColor(0, SkBlendMode::kClear);\n for (auto blend : { SkBlendMode::kPlus, SkBlendMode::kScreen, SkBlendMode::kOverlay,\n SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,\n SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,\n SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkTextUtils::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkTextUtils::kCenter_Align);\n canvas->translate(90, 0);\n if (SkBlendMode::kLighten == blend || SkBlendMode::kDifference == blend) {\n canvas->translate(-90 * 5, 100);\n }\n }\n}\n",
"width": 480,
"height": 330,
"hash": "39e81a69cd300e53976e815e5024398c",
"hash": "23a33fa04cdd0204b2490d05e340f87c",
"file": "illustrations",
"name": "Blend_Mode_Overview_Lighten_Darken"
},
"Illustrations_Blend_Mode_Overview_Modulate_Blend": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n SkBitmap srcBits;\n srcBits.allocN32Pixels(80, 84);\n SkCanvas srcCanvas(srcBits);\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n srcBits.eraseColor(0);\n srcCanvas.drawPath(srcPath, srcPaint);\n canvas->drawColor(0, SkBlendMode::kClear);\n srcPaint.setBlendMode(SkBlendMode::kModulate);\n for (auto step: { 1, 2 } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkPaint::kCenter_Align);\n if (1 == step) {\n canvas->drawBitmap(srcBits, 0, 0, &srcPaint);\n SkTextUtils::DrawString(canvas, \"Bitmap\", 50, 18, labelPaint, SkPaint::kCenter_Align);\n } else {\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, \"Geometry\", 50, 18, labelPaint, SkPaint::kCenter_Align);\n }\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(SkBlendMode::kModulate), 50, 100, labelPaint,\n SkPaint::kCenter_Align);\n canvas->translate(120, 0);\n }\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n SkBitmap srcBits;\n srcBits.allocN32Pixels(80, 84);\n SkCanvas srcCanvas(srcBits);\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n srcBits.eraseColor(0);\n srcCanvas.drawPath(srcPath, srcPaint);\n canvas->drawColor(0, SkBlendMode::kClear);\n srcPaint.setBlendMode(SkBlendMode::kModulate);\n for (auto step: { 1, 2 } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkTextUtils::kCenter_Align);\n if (1 == step) {\n canvas->drawBitmap(srcBits, 0, 0, &srcPaint);\n SkTextUtils::DrawString(canvas, \"Bitmap\", 50, 18, labelPaint, SkTextUtils::kCenter_Align);\n } else {\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, \"Geometry\", 50, 18, labelPaint, SkTextUtils::kCenter_Align);\n }\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(SkBlendMode::kModulate), 50, 100, labelPaint,\n SkTextUtils::kCenter_Align);\n canvas->translate(120, 0);\n }\n}\n",
"width": 480,
"height": 110,
"hash": "34840d6e411e78af50d4f5144296ef6a",
"hash": "877f96610ab7638a310432674b04f837",
"file": "illustrations",
"name": "Blend_Mode_Overview_Modulate_Blend"
},
"Illustrations_Blend_Mode_Overview_Porter_Duff": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n SkBitmap srcBits;\n srcBits.allocN32Pixels(80, 84);\n SkCanvas srcCanvas(srcBits);\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n srcBits.eraseColor(0);\n srcCanvas.drawPath(srcPath, srcPaint);\n canvas->drawColor(0, SkBlendMode::kClear);\n for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,\n SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,\n SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,\n SkBlendMode::kDstIn, SkBlendMode::kDstOut,\n SkBlendMode::kClear, SkBlendMode::kXor } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkPaint::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawBitmap(srcBits, 0, 0, &srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkPaint::kCenter_Align);\n canvas->translate(80, 0);\n if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {\n canvas->translate(-80 * 5, 100);\n }\n }\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n SkBitmap srcBits;\n srcBits.allocN32Pixels(80, 84);\n SkCanvas srcCanvas(srcBits);\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n srcBits.eraseColor(0);\n srcCanvas.drawPath(srcPath, srcPaint);\n canvas->drawColor(0, SkBlendMode::kClear);\n for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,\n SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,\n SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,\n SkBlendMode::kDstIn, SkBlendMode::kDstOut,\n SkBlendMode::kClear, SkBlendMode::kXor } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkTextUtils::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawBitmap(srcBits, 0, 0, &srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkTextUtils::kCenter_Align);\n canvas->translate(80, 0);\n if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {\n canvas->translate(-80 * 5, 100);\n }\n }\n}\n",
"width": 480,
"height": 330,
"hash": "ebb1f51cfbae33baefacb2e4196c9013",
"hash": "819903e0bb125385269948474b6c8a84",
"file": "illustrations",
"name": "Blend_Mode_Overview_Porter_Duff"
},
"Illustrations_Blend_Mode_Overview_Porter_Duff_2": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n canvas->drawColor(0, SkBlendMode::kClear);\n SkBitmap dstBits;\n dstBits.allocN32Pixels(80, 80);\n SkCanvas dstCanvas(dstBits);\n for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,\n SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,\n SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,\n SkBlendMode::kDstIn, SkBlendMode::kDstOut,\n SkBlendMode::kClear, SkBlendMode::kXor } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkPaint::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkPaint::kCenter_Align);\n canvas->translate(80, 0);\n if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {\n canvas->translate(-80 * 5, 100);\n }\n }\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint srcPaint;\n srcPaint.setAntiAlias(true);\n SkPaint labelPaint = srcPaint;\n labelPaint.setTextSize(16);\n SkPaint dstPaint = labelPaint;\n dstPaint.setTextSize(80);\n dstPaint.setColor(0xFF606080);\n dstPaint.setTypeface(SkTypeface::MakeFromName(\"Roboto\", SkFontStyle::Bold()));\n srcPaint.setColor(0xFFcc6633);\n SkPath srcPath;\n const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};\n srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);\n canvas->drawColor(0, SkBlendMode::kClear);\n SkBitmap dstBits;\n dstBits.allocN32Pixels(80, 80);\n SkCanvas dstCanvas(dstBits);\n for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,\n SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,\n SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,\n SkBlendMode::kDstIn, SkBlendMode::kDstOut,\n SkBlendMode::kClear, SkBlendMode::kXor } ) {\n SkTextUtils::DrawString(canvas, \"&\", 50, 80, dstPaint, SkTextUtils::kCenter_Align);\n srcPaint.setBlendMode(blend);\n canvas->drawPath(srcPath, srcPaint);\n SkTextUtils::DrawString(canvas, SkBlendMode_Name(blend), 50, 100, labelPaint, SkTextUtils::kCenter_Align);\n canvas->translate(80, 0);\n if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {\n canvas->translate(-80 * 5, 100);\n }\n }\n}\n",
"width": 480,
"height": 330,
"hash": "8e87d55e01bb2bfd71361156d78dde0c",
"hash": "8f320c1e94e77046e00f7e9e843caa27",
"file": "illustrations",
"name": "Blend_Mode_Overview_Porter_Duff_2"
},
"Illustrations_Image_Info_Color_Type_ARGB_4444": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"16-bit word\", 5 + 20 * 8, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 4, 8, 12, 16 };\n const char* labels[] = { \"red\", \"green\", \"blue\", \"alpha\" };\n drawBoxText(&edges[0], &labels[0], 4, 15, 45);\n drawBoxText(&edges[0], &labels[2], 2, 7, 110);\n drawBoxText(&edges[0], &labels[0], 2, 7, 160);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"16-bit word\", 5 + 20 * 8, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 4, 8, 12, 16 };\n const char* labels[] = { \"red\", \"green\", \"blue\", \"alpha\" };\n drawBoxText(&edges[0], &labels[0], 4, 15, 45);\n drawBoxText(&edges[0], &labels[2], 2, 7, 110);\n drawBoxText(&edges[0], &labels[0], 2, 7, 160);\n}\n",
"width": 415,
"height": 250,
"hash": "bdc77b69231f1e1699e245944f1b239c",
"hash": "e8008512f0d197051e3f26faa67bafc2",
"file": "illustrations",
"name": "Image_Info_Color_Type_ARGB_4444"
},
"Illustrations_Image_Info_Color_Type_BGRA_8888": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 8, 16, 24, 32 };\n const char* labels[] = { \"alpha\", \"red\", \"green\", \"blue\" };\n drawBoxText(edges, &labels[0], 4, 31, 45);\n drawBoxText(edges, &labels[3], 1, 7, 110);\n drawBoxText(edges, &labels[2], 1, 7, 160);\n drawBoxText(edges, &labels[1], 1, 7, 210);\n drawBoxText(edges, &labels[0], 1, 7, 260);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 8, 16, 24, 32 };\n const char* labels[] = { \"alpha\", \"red\", \"green\", \"blue\" };\n drawBoxText(edges, &labels[0], 4, 31, 45);\n drawBoxText(edges, &labels[3], 1, 7, 110);\n drawBoxText(edges, &labels[2], 1, 7, 160);\n drawBoxText(edges, &labels[1], 1, 7, 210);\n drawBoxText(edges, &labels[0], 1, 7, 260);\n}\n",
"width": 812,
"height": 365,
"hash": "743a950f1df07936e8a5fcb2a91208c4",
"hash": "6c35ca14d88b0de200ba7f897f889ad7",
"file": "illustrations",
"name": "Image_Info_Color_Type_BGRA_8888"
},
"Illustrations_Image_Info_Color_Type_RGBA_1010102": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 4, 137, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 3, 187, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 7, 187, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 2, 237, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 6, 237, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 5, 287, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 2, 12, 22, 32,\n 0, 8,\n 0, 6, 8,\n 0, 4, 8,\n 0, 2, 8\n };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n drawBoxText(&edges[0], &labels[0], 4, 31, 45);\n drawBoxText(&edges[5], &labels[3], 1, 7, 110);\n drawBoxText(&edges[7], &labels[2], 2, 7, 160);\n drawBoxText(&edges[10], &labels[1], 2, 7, 210);\n drawBoxText(&edges[13], &labels[0], 2, 7, 260);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 4, 137, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 3, 187, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 7, 187, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 2, 237, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 6, 237, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 5, 287, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 2, 12, 22, 32,\n 0, 8,\n 0, 6, 8,\n 0, 4, 8,\n 0, 2, 8\n };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n drawBoxText(&edges[0], &labels[0], 4, 31, 45);\n drawBoxText(&edges[5], &labels[3], 1, 7, 110);\n drawBoxText(&edges[7], &labels[2], 2, 7, 160);\n drawBoxText(&edges[10], &labels[1], 2, 7, 210);\n drawBoxText(&edges[13], &labels[0], 2, 7, 260);\n}\n",
"width": 812,
"height": 380,
"hash": "2ee75d2bd4e59dc7ab97a96d86fd9bfc",
"hash": "8d78daf69145f611054f289a7443a670",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGBA_1010102"
},
"Illustrations_Image_Info_Color_Type_RGBA_8888": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 8, 16, 24, 32 };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n drawBoxText(edges, &labels[0], 4, 31, 45);\n drawBoxText(edges, &labels[3], 1, 7, 110);\n drawBoxText(edges, &labels[2], 1, 7, 160);\n drawBoxText(edges, &labels[1], 1, 7, 210);\n drawBoxText(edges, &labels[0], 1, 7, 260);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 8, 16, 24, 32 };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n drawBoxText(edges, &labels[0], 4, 31, 45);\n drawBoxText(edges, &labels[3], 1, 7, 110);\n drawBoxText(edges, &labels[2], 1, 7, 160);\n drawBoxText(edges, &labels[1], 1, 7, 210);\n drawBoxText(edges, &labels[0], 1, 7, 260);\n}\n",
"width": 812,
"height": 365,
"hash": "98d5232ae83a71fecf35713bcd635fdc",
"hash": "9abc324f670e6468f09385551aae5a1c",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGBA_8888"
},
"Illustrations_Image_Info_Color_Type_RGBA_F16": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"64-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 135, paint, SkPaint::kCenter_Align);\n for (int i = 0; i < 4; ++i) {\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 4, 187 + i * 100, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 4, 237 + i * 100, paint, SkPaint::kCenter_Align);\n }\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 16, 32,\n 0, 8\n };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n drawBoxText(&edges[0], &labels[0], 2, 63, 45);\n drawBoxText(&edges[0], &labels[2], 2, 31, 95);\n drawBoxText(&edges[3], &labels[3], 1, 7, 160);\n drawBoxText(&edges[3], &labels[3], 1, 7, 210);\n drawBoxText(&edges[3], &labels[2], 1, 7, 260);\n drawBoxText(&edges[3], &labels[2], 1, 7, 310);\n drawBoxText(&edges[3], &labels[1], 1, 7, 360);\n drawBoxText(&edges[3], &labels[1], 1, 7, 410);\n drawBoxText(&edges[3], &labels[0], 1, 7, 460);\n drawBoxText(&edges[3], &labels[0], 1, 7, 510);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"64-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 135, paint, SkTextUtils::kCenter_Align);\n for (int i = 0; i < 4; ++i) {\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 4, 187 + i * 100, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 4, 237 + i * 100, paint, SkTextUtils::kCenter_Align);\n }\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 16, 32,\n 0, 8\n };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n drawBoxText(&edges[0], &labels[0], 2, 63, 45);\n drawBoxText(&edges[0], &labels[2], 2, 31, 95);\n drawBoxText(&edges[3], &labels[3], 1, 7, 160);\n drawBoxText(&edges[3], &labels[3], 1, 7, 210);\n drawBoxText(&edges[3], &labels[2], 1, 7, 260);\n drawBoxText(&edges[3], &labels[2], 1, 7, 310);\n drawBoxText(&edges[3], &labels[1], 1, 7, 360);\n drawBoxText(&edges[3], &labels[1], 1, 7, 410);\n drawBoxText(&edges[3], &labels[0], 1, 7, 460);\n drawBoxText(&edges[3], &labels[0], 1, 7, 510);\n}\n",
"width": 812,
"height": 685,
"hash": "adc8262f27f1ac048984b4cbff9334ac",
"hash": "1bb35ae52173e0fef874022ca8138adc",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGBA_F16"
},
"Illustrations_Image_Info_Color_Type_RGBA_F32": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"128-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 135, paint, SkPaint::kCenter_Align);\n for (int i = 0; i < 4; ++i) {\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 10 * 4, 187 + i * 100, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 105 + 10 * 4, 237 + i * 100, paint, SkPaint::kCenter_Align);\n }\n auto drawBoxText = [=](SkScalar e[], const char* s[], const char* nums[] , \n int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int stringIndex = 0;\n for (int i = n; i >= 0; --i) {\n if (0 == i || n == i || 32 == i || 31 == i) {\n int x = xPos;\n if (2 == count) {\n x += stringIndex * 12 + (stringIndex ? 8 : 0);\n }\n SkTextUtils::DrawString(canvas, nums[stringIndex], x, yPos - 5, p, SkPaint::kCenter_Align);\n if (1 == count) {\n SkTextUtils::DrawString(canvas, nums[stringIndex], xPos + 100, yPos - 5, p, SkPaint::kCenter_Align);\n }\n ++stringIndex;\n }\n xPos += 9;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkPaint::kCenter_Align);\n if (1 == count) {\n SkTextUtils::DrawString(canvas, s[i], 105 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkPaint::kCenter_Align);\n }\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 10, yPos, 5 + e[i] * 10, yPos + 15, p);\n if (1 == count) {\n canvas->drawLine(105 + e[i] * 10, yPos, 105 + e[i] * 10, yPos + 15, p);\n }\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 10, yPos + i * 15,\n 5 + e[count] * 10, yPos + i * 15, p);\n if (1 == count) {\n canvas->drawLine(105 + e[0] * 10, yPos + i * 15,\n 105 + e[count] * 10, yPos + i * 15, p);\n }\n }\n };\n SkScalar edges[] = { 0, 32, 64,\n 0, 8\n };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n const char* nums128[] = { \"127\", \"96\", \"95\", \"64\"};\n const char* nums64[] = { \"63\", \"32\", \"31\", \"0\"};\n const char* nums8[] = { \"7\", \"0\"};\n drawBoxText(&edges[0], &labels[0], nums128, 2, 63, 45);\n drawBoxText(&edges[0], &labels[2], nums64, 2, 63, 95);\n drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 160);\n drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 210);\n drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 260);\n drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 310);\n drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 360);\n drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 410);\n drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 460);\n drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 510);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"128-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 135, paint, SkTextUtils::kCenter_Align);\n for (int i = 0; i < 4; ++i) {\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 10 * 4, 187 + i * 100, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 105 + 10 * 4, 237 + i * 100, paint, SkTextUtils::kCenter_Align);\n }\n auto drawBoxText = [=](SkScalar e[], const char* s[], const char* nums[] , \n int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int stringIndex = 0;\n for (int i = n; i >= 0; --i) {\n if (0 == i || n == i || 32 == i || 31 == i) {\n int x = xPos;\n if (2 == count) {\n x += stringIndex * 12 + (stringIndex ? 8 : 0);\n }\n SkTextUtils::DrawString(canvas, nums[stringIndex], x, yPos - 5, p, SkTextUtils::kCenter_Align);\n if (1 == count) {\n SkTextUtils::DrawString(canvas, nums[stringIndex], xPos + 100, yPos - 5, p, SkTextUtils::kCenter_Align);\n }\n ++stringIndex;\n }\n xPos += 9;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkTextUtils::kCenter_Align);\n if (1 == count) {\n SkTextUtils::DrawString(canvas, s[i], 105 + (e[i] + e[i + 1]) * 5, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 10, yPos, 5 + e[i] * 10, yPos + 15, p);\n if (1 == count) {\n canvas->drawLine(105 + e[i] * 10, yPos, 105 + e[i] * 10, yPos + 15, p);\n }\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 10, yPos + i * 15,\n 5 + e[count] * 10, yPos + i * 15, p);\n if (1 == count) {\n canvas->drawLine(105 + e[0] * 10, yPos + i * 15,\n 105 + e[count] * 10, yPos + i * 15, p);\n }\n }\n };\n SkScalar edges[] = { 0, 32, 64,\n 0, 8\n };\n const char* labels[] = { \"alpha\", \"blue\", \"green\", \"red\" };\n const char* nums128[] = { \"127\", \"96\", \"95\", \"64\"};\n const char* nums64[] = { \"63\", \"32\", \"31\", \"0\"};\n const char* nums8[] = { \"7\", \"0\"};\n drawBoxText(&edges[0], &labels[0], nums128, 2, 63, 45);\n drawBoxText(&edges[0], &labels[2], nums64, 2, 63, 95);\n drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 160);\n drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 210);\n drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 260);\n drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 310);\n drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 360);\n drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 410);\n drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 460);\n drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 510);\n}\n",
"width": 812,
"height": 685,
"hash": "36efa3247a841d0a46aee987a05e9fc2",
"hash": "4ba31a8f9bc94a996f34da81ef541a9c",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGBA_F32"
},
"Illustrations_Image_Info_Color_Type_RGB_101010": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 4, 137, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 3, 187, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 7, 187, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 2, 237, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 6, 237, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 5, 287, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 2, 12, 22, 32,\n 0, 8,\n 0, 6, 8,\n 0, 4, 8,\n 0, 2, 8\n };\n const char* labels[] = { \"unused\", \"blue\", \"green\", \"red\" };\n drawBoxText(&edges[0], &labels[0], 4, 31, 45);\n drawBoxText(&edges[5], &labels[3], 1, 7, 110);\n drawBoxText(&edges[7], &labels[2], 2, 7, 160);\n drawBoxText(&edges[10], &labels[1], 2, 7, 210);\n drawBoxText(&edges[13], &labels[0], 2, 7, 260);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 4, 137, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 3, 187, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 7, 187, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 2, 237, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 6, 237, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 5, 287, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 2, 12, 22, 32,\n 0, 8,\n 0, 6, 8,\n 0, 4, 8,\n 0, 2, 8\n };\n const char* labels[] = { \"unused\", \"blue\", \"green\", \"red\" };\n drawBoxText(&edges[0], &labels[0], 4, 31, 45);\n drawBoxText(&edges[5], &labels[3], 1, 7, 110);\n drawBoxText(&edges[7], &labels[2], 2, 7, 160);\n drawBoxText(&edges[10], &labels[1], 2, 7, 210);\n drawBoxText(&edges[13], &labels[0], 2, 7, 260);\n}\n",
"width": 812,
"height": 380,
"hash": "719fea0149e040ac1178fe298d4f7c7a",
"hash": "4c9f4d939e2047269d73fa3507caf01f",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGB_101010"
},
"Illustrations_Image_Info_Color_Type_RGB_565": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"16-bit word\", 5 + 20 * 8, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 1.5f, 137, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 6.5f, 187, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 5, 11, 16,\n 0, 3, 8,\n 0, 5, 8 };\n const char* labels[] = { \"red\", \"green\", \"blue\" };\n drawBoxText(&edges[0], &labels[0], 3, 15, 45);\n drawBoxText(&edges[4], &labels[1], 2, 7, 110);\n drawBoxText(&edges[7], &labels[0], 2, 7, 160);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"16-bit word\", 5 + 20 * 8, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(low bits)\", 5 + 20 * 1.5f, 137, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"(high bits)\", 5 + 20 * 6.5f, 187, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 5, 11, 16,\n 0, 3, 8,\n 0, 5, 8 };\n const char* labels[] = { \"red\", \"green\", \"blue\" };\n drawBoxText(&edges[0], &labels[0], 3, 15, 45);\n drawBoxText(&edges[4], &labels[1], 2, 7, 110);\n drawBoxText(&edges[7], &labels[0], 2, 7, 160);\n}\n",
"width": 415,
"height": 250,
"hash": "21e703b1aba5f2404f94f3db34d4f7cb",
"hash": "6dec0226490a4ac1977dc87a31564147",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGB_565"
},
"Illustrations_Image_Info_Color_Type_RGB_888": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkPaint::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkPaint::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkPaint::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkPaint::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 8, 16, 24, 32 };\n const char* labels[] = { \"(unused)\", \"blue\", \"green\", \"red\" };\n drawBoxText(edges, &labels[0], 4, 31, 45);\n drawBoxText(edges, &labels[3], 1, 7, 110);\n drawBoxText(edges, &labels[2], 1, 7, 160);\n drawBoxText(edges, &labels[1], 1, 7, 210);\n drawBoxText(edges, &labels[0], 1, 7, 260);\n}\n",
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n canvas->scale(1.25f, 1.25f);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(10);\n SkTextUtils::DrawString(canvas, \"32-bit word\", 5 + 20 * 16, 20, paint, SkTextUtils::kCenter_Align);\n SkTextUtils::DrawString(canvas, \"little endian byte order\", 5 + 20 * 4, 85, paint, SkTextUtils::kCenter_Align);\n auto drawBoxText = [=](SkScalar e[], const char* s[], int count, int n, SkScalar yPos) -> void {\n SkPaint p(paint);\n p.setColor(SK_ColorRED);\n SkScalar xPos = 15;\n int width = n % 32 + 1;\n int lastN = n > 32 ? 32 : 0;\n for (; n >= lastN; --n) {\n for (int i = 0; i <= count; ++i) {\n int a = width - e[i];\n if (a == n || a == n + 1 || a == n - 32 || a == n - 31) {\n char num[3] = {(char) ('0' + n / 10), (char) ('0' + n % 10), '\\0'};\n SkTextUtils::DrawString(canvas, n >= 10 ? num : &num[1], xPos, yPos - 5, p, SkTextUtils::kCenter_Align);\n break;\n }\n }\n xPos += 20;\n }\n p.setColor(SK_ColorBLACK);\n for (int i = 0; i < count; ++i) {\n SkTextUtils::DrawString(canvas, s[i], 5 + (e[i] + e[i + 1]) * 10, yPos + 10, p, SkTextUtils::kCenter_Align);\n }\n p.setStyle(SkPaint::kStroke_Style);\n for (int i = 0; i <= count; ++i) {\n canvas->drawLine(5 + e[i] * 20, yPos, 5 + e[i] * 20, yPos + 15, p);\n }\n for (int i = 0; i < 2; ++i) {\n canvas->drawLine(5 + e[0] * 20, yPos + i * 15, 5 + e[count] * 20, yPos + i * 15, p);\n }\n };\n SkScalar edges[] = { 0, 8, 16, 24, 32 };\n const char* labels[] = { \"(unused)\", \"blue\", \"green\", \"red\" };\n drawBoxText(edges, &labels[0], 4, 31, 45);\n drawBoxText(edges, &labels[3], 1, 7, 110);\n drawBoxText(edges, &labels[2], 1, 7, 160);\n drawBoxText(edges, &labels[1], 1, 7, 210);\n drawBoxText(edges, &labels[0], 1, 7, 260);\n}\n",
"width": 812,
"height": 365,
"hash": "a11d984d5880664ca15dbac5beed44a3",
"hash": "7527d7ade4764302818e250cd4e03962",
"file": "illustrations",
"name": "Image_Info_Color_Type_RGB_888"
},
@ -4258,14 +4258,6 @@
"hash": "5112c7209a19e035c61cef33a624a652",
"file": "SkPaint_Reference",
"name": "Stroke_Width"
},
"Paint_Text_Align": {
"code": "#include \"SkTextUtils.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(40);\n for (SkPaint::Align a : { SkPaint::kLeft_Align,\n SkPaint::kCenter_Align,\n SkPaint::kRight_Align}) {\n SkTextUtils::DrawString(canvas, \"Aa\", 100, 50, paint, a);\n canvas->translate(0, 50);\n }\n}\n",
"width": 256,
"height": 160,
"hash": "6ee1866e4da0064d9d340b07e05f0aca",
"file": "SkPaint_Reference",
"name": "Text_Align"
},
"Paint_Text_Encoding": {
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n const char hello8[] = \"Hello\" \"\\xE2\" \"\\x98\" \"\\xBA\";\n const uint16_t hello16[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };\n const uint32_t hello32[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };\n paint.setTextSize(24);\n canvas->drawText(hello8, sizeof(hello8) - 1, 10, 30, paint);\n paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);\n canvas->drawText(hello16, sizeof(hello16), 10, 60, paint);\n paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);\n canvas->drawText(hello32, sizeof(hello32), 10, 90, paint);\n uint16_t glyphs[SK_ARRAY_COUNT(hello32)];\n paint.textToGlyphs(hello32, sizeof(hello32), glyphs);\n paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);\n canvas->drawText(glyphs, sizeof(glyphs), 10, 120, paint);\n}\n",
@ -8556,10 +8548,10 @@
"name": "SkRRect::writeToMemory"
},
"SkRegion_Op": {
"code": "void draw(SkCanvas* canvas) {\n SkRegion operand({35, 35, 85, 85});\n const char* labels[] = {\"difference\", \"intersect\", \"union\", \"xor\", \"reverse diff\", \"replace\"};\n int index = 0;\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n for (auto op : { SkRegion::kDifference_Op, SkRegion::kIntersect_Op, SkRegion::kUnion_Op,\n SkRegion::kXOR_Op, SkRegion::kReverseDifference_Op, SkRegion::kReplace_Op } ) {\n SkRegion target({10, 10, 60, 60});\n target.op(operand, op);\n canvas->drawRegion(target, paint);\n canvas->drawString(labels[index++], 40, 100, paint);\n canvas->translate(80, 0);\n if (SkRegion::kUnion_Op == op) {\n canvas->translate(-240, 120);\n }\n }\n}",
"code": "void draw(SkCanvas* canvas) {\n SkRegion operand({35, 35, 85, 85});\n const char* labels[] = {\"difference\", \"intersect\", \"union\", \"xor\", \"reverse diff\", \"replace\"};\n int index = 0;\n SkPaint paint;\n for (auto op : { SkRegion::kDifference_Op, SkRegion::kIntersect_Op, SkRegion::kUnion_Op,\n SkRegion::kXOR_Op, SkRegion::kReverseDifference_Op, SkRegion::kReplace_Op } ) {\n SkRegion target({10, 10, 60, 60});\n target.op(operand, op);\n canvas->drawRegion(target, paint);\n canvas->drawString(labels[index++], 40, 100, paint);\n canvas->translate(80, 0);\n if (SkRegion::kUnion_Op == op) {\n canvas->translate(-240, 120);\n }\n }\n}",
"width": 256,
"height": 256,
"hash": "fb82d2d3ec51912215a0eb9b45dcbc3c",
"hash": "026dd8b180fe8e43f477fce43e9217b3",
"file": "SkRegion_Reference",
"name": "SkRegion::Op"
},
@ -9100,10 +9092,10 @@
"name": "SkTextBlobBuilder::allocRun_2"
},
"SkTextBlob_Deserialize": {
"code": "#include \"SkSerialProcs.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint blobPaint;\n blobPaint.setTextSize(24);\n sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromText(\"Hello World!\", 12, blobPaint);\n sk_sp<SkData> data = blob->serialize(SkSerialProcs());\n uint16_t glyphs[6];\n blobPaint.textToGlyphs(\"Hacker\", 6, glyphs);\n memcpy((char*)data->writable_data() + 0x54, glyphs, sizeof(glyphs));\n sk_sp<SkTextBlob> copy = SkTextBlob::Deserialize(data->data(), data->size(), SkDeserialProcs());\n canvas->drawTextBlob(copy, 20, 20, SkPaint());\n}",
"code": "#include \"SkSerialProcs.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkFont blobFont;\n blobFont.setSize(24);\n sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromText(\"Hello World!\", 12, blobFont);\n sk_sp<SkData> data = blob->serialize(SkSerialProcs());\n uint16_t glyphs[6];\n SkPaint blobPaint;\n blobPaint.textToGlyphs(\"Hacker\", 6, glyphs);\n memcpy((char*)data->writable_data() + 0x54, glyphs, sizeof(glyphs));\n sk_sp<SkTextBlob> copy = SkTextBlob::Deserialize(data->data(), data->size(), SkDeserialProcs());\n canvas->drawTextBlob(copy, 20, 20, SkPaint());\n}",
"width": 256,
"height": 24,
"hash": "9feac5842eaac425a062754097eb7b7b",
"hash": "68b6d0208eb0b4de67fc152381af7a58",
"file": "SkTextBlob_Reference",
"name": "SkTextBlob::Deserialize"
},
@ -9132,18 +9124,18 @@
"name": "SkTextBlob::bounds()"
},
"SkTextBlob_serialize": {
"code": "#include \"SkSerialProcs.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint blobPaint;\n blobPaint.setTextSize(24);\n sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromText(\"Hello World\", 11, blobPaint);\n char storage[2048];\n size_t used = blob->serialize(SkSerialProcs(), storage, sizeof(storage));\n sk_sp<SkTextBlob> copy = SkTextBlob::Deserialize(storage, used, SkDeserialProcs());\n canvas->drawTextBlob(copy, 20, 20, SkPaint());\n std::string usage = \"size=\" + std::to_string(sizeof(storage)) + \" used=\" + std::to_string(used);\n canvas->drawString(usage.c_str(), 20, 40, SkPaint());\n}",
"code": "#include \"SkSerialProcs.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkFont blobFont;\n blobFont.setSize(24);\n sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromText(\"Hello World\", 11, blobFont);\n char storage[2048];\n size_t used = blob->serialize(SkSerialProcs(), storage, sizeof(storage));\n sk_sp<SkTextBlob> copy = SkTextBlob::Deserialize(storage, used, SkDeserialProcs());\n canvas->drawTextBlob(copy, 20, 20, SkPaint());\n std::string usage = \"size=\" + std::to_string(sizeof(storage)) + \" used=\" + std::to_string(used);\n canvas->drawString(usage.c_str(), 20, 40, SkPaint());\n}",
"width": 256,
"height": 64,
"hash": "b1d67f0b0f342eb3e70db01bdefdc21b",
"hash": "90ce8c327d407b1faac73baa2ebd0378",
"file": "SkTextBlob_Reference",
"name": "SkTextBlob::serialize()"
},
"SkTextBlob_serialize_2": {
"code": "#include \"SkSerialProcs.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint blobPaint;\n blobPaint.setTextSize(24);\n sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromText(\"Hello World\", 11, blobPaint);\n sk_sp<SkData> data = blob->serialize(SkSerialProcs());\n sk_sp<SkTextBlob> copy = SkTextBlob::Deserialize(data->data(), data->size(), SkDeserialProcs());\n canvas->drawTextBlob(copy, 20, 20, SkPaint());\n}",
"code": "#include \"SkSerialProcs.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkFont blobFont;\n blobFont.setSize(24);\n sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromText(\"Hello World\", 11, blobFont);\n sk_sp<SkData> data = blob->serialize(SkSerialProcs());\n sk_sp<SkTextBlob> copy = SkTextBlob::Deserialize(data->data(), data->size(), SkDeserialProcs());\n canvas->drawTextBlob(copy, 20, 20, SkPaint());\n}",
"width": 256,
"height": 24,
"hash": "9447d4cf5d560b40b7535e403d854c20",
"hash": "464201a828f7e94fc01cd57facfcd2f4",
"file": "SkTextBlob_Reference",
"name": "SkTextBlob::serialize_2"
},