work in imageinfo and phrase substitution
This adds the ability to define long phrases in one place and refer to those phrases in many places. Bookmaker has new syntax to support phrase substitution. When it encounters #some_phrase_reference# It substitutes the body of #PhraseDef some_phrase_reference text to substitute when encountering the phrase ## The phrase label must start with a lowercase letter, and be bracketed by single hash marks, without spaces between the label and the hash marks. Docs-Preview: https://skia.org/?cl=111224 TBR=caryclark@google.com Bug: skia:6898 Change-Id: I12c57d916ccedbd86b421377d117399150ada72a Reviewed-on: https://skia-review.googlesource.com/111224 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
f6188425c7
commit
1a8d762a18
@ -509,9 +509,7 @@ bitmap height: 32 info height: 32
|
||||
#Method SkColorType colorType() const
|
||||
#In Property
|
||||
#Line # returns Image_Info Color_Type ##
|
||||
Returns Color_Type, one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType,
|
||||
kBGRA_8888_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType.
|
||||
Returns Color_Type, one of: #list_of_color_types#.
|
||||
|
||||
#Return Color_Type in Image_Info ##
|
||||
|
||||
@ -634,24 +632,24 @@ Returns zero if colorType( is kUnknown_SkColorType.
|
||||
"BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16"};
|
||||
SkImageInfo info = SkImageInfo::MakeA8(1, 1);
|
||||
SkBitmap bitmap;
|
||||
for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType,
|
||||
kBGRA_8888_SkColorType, kGray_8_SkColorType,
|
||||
kRGBA_F16_SkColorType } ) {
|
||||
for (SkColorType colorType : { #list_of_color_types#
|
||||
} ) {
|
||||
bitmap.setInfo(info.makeColorType(colorType));
|
||||
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
|
||||
colors[colorType], 13 - strlen(colors[colorType]), " ",
|
||||
bitmap.bytesPerPixel());
|
||||
}
|
||||
#StdOut
|
||||
color: kUnknown_SkColorType bytesPerPixel: 0
|
||||
color: kAlpha_8_SkColorType bytesPerPixel: 1
|
||||
color: kRGB_565_SkColorType bytesPerPixel: 2
|
||||
color: kARGB_4444_SkColorType bytesPerPixel: 2
|
||||
color: kRGBA_8888_SkColorType bytesPerPixel: 4
|
||||
color: kBGRA_8888_SkColorType bytesPerPixel: 4
|
||||
color: kGray_8_SkColorType bytesPerPixel: 1
|
||||
color: kUnknown_SkColorType bytesPerPixel: 0
|
||||
color: kAlpha_8_SkColorType bytesPerPixel: 1
|
||||
color: kRGB_565_SkColorType bytesPerPixel: 2
|
||||
color: kARGB_4444_SkColorType bytesPerPixel: 2
|
||||
color: kRGBA_8888_SkColorType bytesPerPixel: 4
|
||||
color: kRGB_888x_SkColorType bytesPerPixel: 4
|
||||
color: kBGRA_8888_SkColorType bytesPerPixel: 4
|
||||
color: kRGBA_1010102_SkColorType bytesPerPixel: 4
|
||||
color: kRGB_101010x_SkColorType bytesPerPixel: 4
|
||||
color: kGray_8_SkColorType bytesPerPixel: 1
|
||||
color: kRGBA_F16_SkColorType bytesPerPixel: 8
|
||||
##
|
||||
##
|
||||
@ -704,24 +702,25 @@ Returns zero for kUnknown_SkColorType.
|
||||
"BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16"};
|
||||
SkImageInfo info = SkImageInfo::MakeA8(1, 1);
|
||||
SkBitmap bitmap;
|
||||
for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
|
||||
for (SkColorType colorType : { #list_of_color_types#
|
||||
} ) {
|
||||
bitmap.setInfo(info.makeColorType(colorType));
|
||||
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
|
||||
colors[colorType], 10 - strlen(colors[colorType]), " ",
|
||||
colors[colorType], 14 - strlen(colors[colorType]), " ",
|
||||
bitmap.shiftPerPixel());
|
||||
}
|
||||
#StdOut
|
||||
color: kUnknown_SkColorType shiftPerPixel: 0
|
||||
color: kAlpha_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGB_565_SkColorType shiftPerPixel: 1
|
||||
color: kARGB_4444_SkColorType shiftPerPixel: 1
|
||||
color: kRGBA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kBGRA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kGray_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGBA_F16_SkColorType shiftPerPixel: 3
|
||||
color: kUnknown_SkColorType shiftPerPixel: 0
|
||||
color: kAlpha_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGB_565_SkColorType shiftPerPixel: 1
|
||||
color: kARGB_4444_SkColorType shiftPerPixel: 1
|
||||
color: kRGBA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kRGB_888x_SkColorType shiftPerPixel: 2
|
||||
color: kBGRA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kRGBA_1010102_SkColorType shiftPerPixel: 2
|
||||
color: kRGB_101010x_SkColorType shiftPerPixel: 2
|
||||
color: kGray_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGBA_F16_SkColorType shiftPerPixel: 3
|
||||
##
|
||||
##
|
||||
|
||||
@ -900,9 +899,8 @@ void draw(SkCanvas* canvas) {
|
||||
SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,
|
||||
kPremul_SkAlphaType, kUnpremul_SkAlphaType };
|
||||
SkDebugf("%88s", "Canonical Unknown Opaque Premul Unpremul\n");
|
||||
for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
|
||||
kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
|
||||
for (SkColorType colorType : { #list_of_color_types#
|
||||
} ) {
|
||||
for (SkAlphaType canonicalAlphaType : alphaTypes) {
|
||||
SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );
|
||||
SkDebugf("%10s %10s ", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);
|
||||
|
@ -194,6 +194,13 @@ in the same order.
|
||||
#Alias Color_Type
|
||||
#Alias Color_Types
|
||||
|
||||
#PhraseDef list_of_color_types
|
||||
kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
|
||||
kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,
|
||||
kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
##
|
||||
|
||||
#Subtopic Native
|
||||
#Alias Native_Color_Type
|
||||
#Substitute native SkColorType
|
||||
@ -759,8 +766,14 @@ range. See http://en.wikipedia.org/wiki/Rec._709 for details.
|
||||
|
||||
#Struct SkImageInfo
|
||||
|
||||
Describes Image dimensions and pixel type.
|
||||
Used for both source images and render-targets (surfaces).
|
||||
Describes pixel dimensions and encoding. Bitmap, Image, PixMap, and Surface
|
||||
can be created from Image_Info. Image_Info can be retrieved from Bitmap and
|
||||
Pixmap, but not from Image and Surface. For example, Image and Surface
|
||||
implementations may defer pixel depth, so may not completely specify Image_Info.
|
||||
|
||||
Image_Info contains dimensions, the pixel integral width and height. It encodes
|
||||
how pixel bits describe Color_Alpha, transparency; Color components red, blue,
|
||||
and green; and Color_Space, the range and linearity of colors.
|
||||
|
||||
#Subtopic Member_Function
|
||||
#Populate
|
||||
@ -775,18 +788,33 @@ Used for both source images and render-targets (surfaces).
|
||||
#Populate
|
||||
##
|
||||
|
||||
|
||||
#Method SkImageInfo()
|
||||
|
||||
#In Constructor
|
||||
#Line # creates with zero dimensions, kUnknown_SkColorType, kUnknown_SkAlphaType ##
|
||||
#Return incomplete ##
|
||||
Creates an empty Image_Info with kUnknown_SkColorType, kUnknown_SkAlphaType,
|
||||
a width and height of zero, and no Color_Space.
|
||||
|
||||
#Return empty Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Height 32
|
||||
#Description
|
||||
An empty Image_Info may be passed to SkCanvas::accessTopLayerPixels as storage
|
||||
for the Canvas actual Image_Info.
|
||||
##
|
||||
SkImageInfo imageInfo;
|
||||
size_t rowBytes;
|
||||
SkIPoint origin;
|
||||
uint32_t* access = (uint32_t*) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);
|
||||
const char* alphaType[] = { "Unknown", "Opaque", "Premul", "Unpremul" };
|
||||
SkString string;
|
||||
string.printf("k%s_SkAlphaType", alphaType[(int) imageInfo.alphaType()]);
|
||||
SkPaint paint;
|
||||
canvas->drawString(string, 20, 20, paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso Make MakeN32 MakeS32 MakeA8
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -796,20 +824,42 @@ Used for both source images and render-targets (surfaces).
|
||||
sk_sp<SkColorSpace> cs = nullptr)
|
||||
#In Constructor
|
||||
#Line # creates Image_Info from dimensions, Color_Type, Alpha_Type, Color_Space ##
|
||||
Creates Image_Info from integral dimensions width and height, Color_Type ct,
|
||||
Alpha_Type at, and optionally Color_Space cs.
|
||||
|
||||
#Param width incomplete ##
|
||||
#Param height incomplete ##
|
||||
#Param ct incomplete ##
|
||||
#Param at incomplete ##
|
||||
#Param cs incomplete ##
|
||||
If Color_Space cs is nullptr and Image_Info is part of drawing source: Color_Space
|
||||
defaults to sRGB, mapping into Surface Color_Space.
|
||||
|
||||
#Return incomplete ##
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
#Param width pixel column count; must be zero or greater ##
|
||||
#Param height pixel row count; must be zero or greater ##
|
||||
#Param ct one of: #list_of_color_types#
|
||||
##
|
||||
#Param at one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
|
||||
kUnpremul_SkAlphaType
|
||||
##
|
||||
#Param cs range of colors; may be nullptr ##
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Height 48
|
||||
uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },
|
||||
{ 0xAC, 0xA8, 0x89, 0xA7, 0x87 },
|
||||
{ 0x9B, 0xB5, 0xE5, 0x95, 0x46 },
|
||||
{ 0x90, 0x81, 0xC5, 0x71, 0x33 },
|
||||
{ 0x75, 0x55, 0x44, 0x40, 0x30 }};
|
||||
SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);
|
||||
SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);
|
||||
SkBitmap bitmap;
|
||||
bitmap.installPixels(pixmap);
|
||||
canvas->scale(8, 8);
|
||||
canvas->drawBitmap(bitmap, 0, 0);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso MakeN32 MakeN32Premul MakeS32 MakeA8
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -819,21 +869,38 @@ Used for both source images and render-targets (surfaces).
|
||||
sk_sp<SkColorSpace> cs = nullptr)
|
||||
#In Constructor
|
||||
#Line # creates Image_Info with Native_Color_Type ##
|
||||
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
|
||||
Alpha_Type at, and optionally Color_Space cs. kN32_SkColorType will equal either
|
||||
kBGRA_8888_SkColorType or kRGBA_8888_SkColorType, whichever is optimal.
|
||||
|
||||
Sets Color_Type to kN32_SkColorType.
|
||||
If Color_Space cs is nullptr and Image_Info is part of drawing source: Color_Space
|
||||
defaults to sRGB, mapping into Surface Color_Space.
|
||||
|
||||
#Param width incomplete ##
|
||||
#Param height incomplete ##
|
||||
#Param at incomplete ##
|
||||
#Param cs incomplete ##
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
#Return incomplete ##
|
||||
#Param width pixel column count; must be zero or greater ##
|
||||
#Param height pixel row count; must be zero or greater ##
|
||||
#Param at one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
|
||||
kUnpremul_SkAlphaType
|
||||
##
|
||||
#Param cs range of colors; may be nullptr ##
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Height 128
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType));
|
||||
SkCanvas offscreen(bitmap);
|
||||
offscreen.clear(SK_ColorWHITE);
|
||||
SkPaint paint;
|
||||
offscreen.drawString("g", 0, 10, paint);
|
||||
canvas->scale(8, 8);
|
||||
canvas->drawBitmap(bitmap, 0, 0);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso Make MakeN32Premul MakeS32 MakeA8
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -843,19 +910,54 @@ Sets Color_Type to kN32_SkColorType.
|
||||
|
||||
#In Constructor
|
||||
#Line # creates Image_Info with Native_Color_Type, sRGB Color_Space ##
|
||||
Creates Image_Info marked as sRGB with kN32_SkColorType swizzle.
|
||||
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
|
||||
Alpha_Type at, with sRGB Color_Space.
|
||||
|
||||
#Param width incomplete ##
|
||||
#Param height incomplete ##
|
||||
#Param at incomplete ##
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
#Return incomplete ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Param width pixel column count; must be zero or greater ##
|
||||
#Param height pixel row count; must be zero or greater ##
|
||||
#Param at one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
|
||||
kUnpremul_SkAlphaType
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
#Set sRGB
|
||||
#Height 128
|
||||
#Description
|
||||
Top gradient is drawn to offscreen without Color_Space. It is darker than middle
|
||||
gradient, drawn to offscreen with sRGB Color_Space. Bottom gradient shares bits
|
||||
with middle, but does not specify the Color_Space in noColorSpaceBitmap. A source
|
||||
without Color_Space is treated as sRGB; the bottom gradient is identical to the
|
||||
middle gradient.
|
||||
##
|
||||
const int width = 256;
|
||||
const int height = 32;
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
|
||||
SkColor gradColors[] = { 0xFFAA0055, 0xFF11CC88 };
|
||||
SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };
|
||||
SkPaint gradPaint;
|
||||
gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
|
||||
SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType));
|
||||
SkCanvas offscreen(bitmap);
|
||||
offscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
|
||||
canvas->drawBitmap(bitmap, 0, 0);
|
||||
bitmap.allocPixels(SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType));
|
||||
SkCanvas sRGBOffscreen(bitmap);
|
||||
sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
|
||||
canvas->drawBitmap(bitmap, 0, 48);
|
||||
SkBitmap noColorSpaceBitmap;
|
||||
noColorSpaceBitmap.setInfo(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType));
|
||||
noColorSpaceBitmap.setPixels(bitmap.getAddr(0, 0));
|
||||
canvas->drawBitmap(noColorSpaceBitmap, 0, 96);
|
||||
##
|
||||
|
||||
#SeeAlso Make MakeN32 MakeN32Premul MakeA8
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -865,19 +967,35 @@ Creates Image_Info marked as sRGB with kN32_SkColorType swizzle.
|
||||
|
||||
#In Constructor
|
||||
#Line # creates Image_Info with Native_Color_Type, kPremul_SkAlphaType ##
|
||||
Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
|
||||
kPremul_SkAlphaType, with optional Color_Space.
|
||||
|
||||
#Param width incomplete ##
|
||||
#Param height incomplete ##
|
||||
#Param cs incomplete ##
|
||||
If Color_Space cs is nullptr and Image_Info is part of drawing source: Color_Space
|
||||
defaults to sRGB, mapping into Surface Color_Space.
|
||||
|
||||
#Return incomplete ##
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
#Param width pixel column count; must be zero or greater ##
|
||||
#Param height pixel row count; must be zero or greater ##
|
||||
#Param cs range of colors; may be nullptr ##
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32Premul(18, 18));
|
||||
SkCanvas offscreen(bitmap);
|
||||
offscreen.clear(SK_ColorWHITE);
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setTextSize(15);
|
||||
offscreen.drawString("\xF0\x9F\x98\xB8", 1, 15, paint);
|
||||
canvas->scale(6, 6);
|
||||
canvas->drawBitmap(bitmap, 0, 0);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso MakeN32 MakeS32 MakeA8 Make
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -886,15 +1004,33 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
#Method static SkImageInfo MakeN32Premul(const SkISize& size)
|
||||
|
||||
#In Constructor
|
||||
#Param size incomplete ##
|
||||
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
|
||||
kPremul_SkAlphaType, with Color_Space set to nullptr.
|
||||
|
||||
#Return incomplete ##
|
||||
If Image_Info is part of drawing source: Color_Space defaults to sRGB, mapping
|
||||
into Surface Color_Space.
|
||||
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
#Param size width and height, each must be zero or greater ##
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32Premul({18, 18}));
|
||||
SkCanvas offscreen(bitmap);
|
||||
offscreen.clear(SK_ColorWHITE);
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setTextSize(15);
|
||||
offscreen.drawString("\xF0\x9F\x98\xB9", 1, 15, paint);
|
||||
canvas->scale(6, 6);
|
||||
canvas->drawBitmap(bitmap, 0, 0);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso MakeN32 MakeS32 MakeA8 Make
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -904,16 +1040,19 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
|
||||
#In Constructor
|
||||
#Line # creates Image_Info with kAlpha_8_SkColorType, kPremul_SkAlphaType ##
|
||||
#Param width incomplete ##
|
||||
#Param height incomplete ##
|
||||
Creates Image_Info from integral dimensions width and height, kAlpha_8_SkColorType,
|
||||
kPremul_SkAlphaType, with Color_Space set to nullptr.
|
||||
|
||||
#Return incomplete ##
|
||||
#Param width pixel column count; must be zero or greater ##
|
||||
#Param height pixel row count; must be zero or greater ##
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso MakeN32 MakeS32 Make
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -923,16 +1062,29 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
|
||||
#In Constructor
|
||||
#Line # creates Image_Info with kUnknown_SkColorType, kUnknown_SkAlphaType ##
|
||||
#Param width incomplete ##
|
||||
#Param height incomplete ##
|
||||
Creates Image_Info from integral dimensions width and height, kUnknown_SkColorType,
|
||||
kUnknown_SkAlphaType, with Color_Space set to nullptr.
|
||||
|
||||
#Return incomplete ##
|
||||
Returned Image_Info as part of source does not draw, and as part of destination
|
||||
can not be drawn to.
|
||||
|
||||
#Param width pixel column count; must be zero or greater ##
|
||||
#Param height pixel row count; must be zero or greater ##
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Height 32
|
||||
#Width 384
|
||||
SkImageInfo info; // default constructor
|
||||
SkString string;
|
||||
string.printf("SkImageInfo() %c= SkImageInfo::MakeUnknown(0, 0)",
|
||||
info == SkImageInfo::MakeUnknown(0, 0) ? '=' : '!');
|
||||
SkPaint paint;
|
||||
canvas->drawString(string, 0, 12, paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso SkImageInfo() MakeN32 MakeS32 Make
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -941,13 +1093,26 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
#Method static SkImageInfo MakeUnknown()
|
||||
|
||||
#In Constructor
|
||||
#Return incomplete ##
|
||||
Creates Image_Info from integral dimensions width and height set to zero,
|
||||
kUnknown_SkColorType, kUnknown_SkAlphaType, with Color_Space set to nullptr.
|
||||
|
||||
Returned Image_Info as part of source does not draw, and as part of destination
|
||||
can not be drawn to.
|
||||
|
||||
#Return created Image_Info ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Height 32
|
||||
#Width 384
|
||||
SkImageInfo info; // default constructor
|
||||
SkString string;
|
||||
string.printf("SkImageInfo() %c= SkImageInfo::MakeUnknown()",
|
||||
info == SkImageInfo::MakeUnknown() ? '=' : '!');
|
||||
SkPaint paint;
|
||||
canvas->drawString(string, 0, 12, paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso SkImageInfo() MakeN32 MakeS32 Make
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -960,14 +1125,25 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
|
||||
#Method int width() const
|
||||
#In Property
|
||||
#Line # incomplete ##
|
||||
#Return incomplete ##
|
||||
#Line # returns pixel column count ##
|
||||
Returns pixel count in each row.
|
||||
|
||||
#Return pixel width ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Image 4
|
||||
#Height 96
|
||||
canvas->translate(10, 10);
|
||||
canvas->drawBitmap(source, 0, 0);
|
||||
SkImageInfo imageInfo = source.info();
|
||||
canvas->translate(0, imageInfo.height());
|
||||
SkPaint paint;
|
||||
paint.setTextAlign(SkPaint::kCenter_Align);
|
||||
canvas->drawLine(0, 10, imageInfo.width(), 10, paint);
|
||||
canvas->drawString("width", imageInfo.width() / 2, 25, paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso height SkBitmap::width SkPixelRef::width SkImage::width SkSurface::width
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -975,14 +1151,25 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
|
||||
#Method int height() const
|
||||
#In Property
|
||||
#Line # incomplete ##
|
||||
#Return incomplete ##
|
||||
#Line # returns pixel row count ##
|
||||
Returns pixel row count.
|
||||
|
||||
#Return pixel height ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Image 4
|
||||
#Height 96
|
||||
canvas->translate(10, 20);
|
||||
canvas->drawBitmap(source, 0, 0);
|
||||
SkImageInfo imageInfo = source.info();
|
||||
SkPaint paint;
|
||||
paint.setTextAlign(SkPaint::kCenter_Align);
|
||||
paint.setVerticalText(true);
|
||||
canvas->drawLine(imageInfo.width() + 10, 0, imageInfo.width() + 10, imageInfo.height(), paint);
|
||||
canvas->drawString("height", imageInfo.width() + 25, imageInfo.height() / 2, paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso width SkBitmap::height SkPixelRef::height SkImage::height SkSurface::height
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -991,7 +1178,9 @@ Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
|
||||
#Method SkColorType colorType() const
|
||||
#In Property
|
||||
#Line # incomplete ##
|
||||
#Return incomplete ##
|
||||
Returns Color_Type, one of: #list_of_color_types#.
|
||||
|
||||
#Return Color_Type ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
|
@ -392,10 +392,7 @@ Recognized formats vary by GPU back-end.
|
||||
#Param context GPU_Context ##
|
||||
#Param backendTexture texture residing on GPU ##
|
||||
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
|
||||
#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
#Param colorType one of: #list_of_color_types#
|
||||
##
|
||||
#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
|
||||
kPremul_SkAlphaType, kUnpremul_SkAlphaType
|
||||
@ -450,10 +447,7 @@ Recognized formats vary by GPU back-end.
|
||||
#Param context GPU_Context ##
|
||||
#Param backendTexture texture residing on GPU ##
|
||||
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
|
||||
#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
#Param colorType one of: #list_of_color_types#
|
||||
##
|
||||
#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
|
||||
kPremul_SkAlphaType, kUnpremul_SkAlphaType
|
||||
@ -617,10 +611,7 @@ Recognized formats vary by GPU back-end.
|
||||
#Param context GPU_Context ##
|
||||
#Param backendTexture texture residing on GPU ##
|
||||
#Param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
|
||||
#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
#Param colorType one of: #list_of_color_types#
|
||||
##
|
||||
#Param alphaType one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
|
||||
kPremul_SkAlphaType, kUnpremul_SkAlphaType
|
||||
|
@ -5099,7 +5099,8 @@ Paint may draw to.
|
||||
#Method bool canComputeFastBounds() const
|
||||
|
||||
#In Fast_Bounds
|
||||
#Line # returns true if settings allow for fast bounds computation ###Private
|
||||
#Line # returns true if settings allow for fast bounds computation ##
|
||||
#Private
|
||||
(to be made private)
|
||||
##
|
||||
|
||||
@ -5113,7 +5114,8 @@ Paint may draw to.
|
||||
#Method const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const
|
||||
|
||||
#In Fast_Bounds
|
||||
#Line # returns fill bounds for quick reject tests ###Private
|
||||
#Line # returns fill bounds for quick reject tests ##
|
||||
#Private
|
||||
(to be made private)
|
||||
##
|
||||
|
||||
@ -5179,7 +5181,7 @@ Paint may draw to.
|
||||
#Return fast computed bounds ##
|
||||
##
|
||||
|
||||
#Subtopic Fast_Bounds Fast_Bounds ##
|
||||
#Subtopic Fast_Bounds ##
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#Subtopic Utility
|
||||
|
@ -2989,6 +2989,7 @@ constructions are converted to Conic data when added to Path.
|
||||
#List ##
|
||||
#Description ##
|
||||
#Function
|
||||
###$
|
||||
struct data {
|
||||
const char* name;
|
||||
char super;
|
||||
@ -3024,7 +3025,7 @@ const char* yna[] = {
|
||||
"no",
|
||||
"yes"
|
||||
};
|
||||
|
||||
$$$#
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkPaint lp;
|
||||
@ -3657,8 +3658,10 @@ of its geometric bounds.
|
||||
|
||||
#Example
|
||||
#Function
|
||||
###$
|
||||
#define nameValue(fill) { SkPath::fill, #fill }
|
||||
|
||||
$$$#
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
struct {
|
||||
@ -3713,8 +3716,10 @@ Returns equivalent Fill_Type representing Path fill inside its bounds.
|
||||
|
||||
#Example
|
||||
#Function
|
||||
###$
|
||||
#define nameValue(fill) { SkPath::fill, #fill }
|
||||
|
||||
$$$#
|
||||
##
|
||||
void draw(SkCanvas* canvas) {
|
||||
struct {
|
||||
|
@ -443,10 +443,7 @@ pixmap height: 32 info height: 32
|
||||
|
||||
#In Image_Info_Access
|
||||
#Line # returns Image_Info Color_Type ##
|
||||
Returns Color_Type, one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType,
|
||||
kRGB_888x_SkColorType, kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType,
|
||||
kRGB_101010x_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType.
|
||||
Returns Color_Type, one of: #list_of_color_types#.
|
||||
|
||||
#Return Color_Type in Image_Info ##
|
||||
|
||||
|
@ -427,10 +427,7 @@ If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr.
|
||||
#Param backendTexture texture residing on GPU ##
|
||||
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
|
||||
#Param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing ##
|
||||
#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
#Param colorType one of: #list_of_color_types#
|
||||
##
|
||||
#Param colorSpace range of colors ##
|
||||
#Param surfaceProps LCD striping orientation and setting for device independent
|
||||
@ -542,10 +539,7 @@ If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr.
|
||||
#Param context GPU_Context ##
|
||||
#Param backendRenderTarget GPU intermediate memory buffer ##
|
||||
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
|
||||
#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
#Param colorType one of: #list_of_color_types#
|
||||
##
|
||||
#Param colorSpace range of colors ##
|
||||
#Param surfaceProps LCD striping orientation and setting for device independent
|
||||
@ -653,10 +647,7 @@ If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr.
|
||||
#Param backendTexture texture residing on GPU ##
|
||||
#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ##
|
||||
#Param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing ##
|
||||
#Param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
|
||||
kRGB_565_SkColorType, kARGB_4444_SkColorType,
|
||||
kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
|
||||
kGray_8_SkColorType, kRGBA_F16_SkColorType
|
||||
#Param colorType one of: #list_of_color_types#
|
||||
##
|
||||
#Param colorSpace range of colors ##
|
||||
#Param surfaceProps LCD striping orientation and setting for device independent
|
||||
@ -1742,11 +1733,11 @@ and the client will still own the semaphores.
|
||||
|
||||
#Return true if GPU is waiting on semaphores ##
|
||||
|
||||
#Example
|
||||
#NoExample
|
||||
#ToDo this is copy and paste silliness masquerading as an example. Probably need gpu
|
||||
globals and definitely need gpu expertise to make a real example out of this
|
||||
##
|
||||
#Platform !fiddle gpu
|
||||
#Platform gpu
|
||||
#Height 64
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
|
@ -166,7 +166,8 @@ is useful to position one or more <a href="#Bitmap">Bitmaps</a> within a shared
|
||||
class <a href="#SkBitmap_Allocator">Allocator</a> : public <a href="undocumented#SkRefCnt">SkRefCnt</a> {
|
||||
public:
|
||||
virtual bool <a href="#SkBitmap_Allocator_allocPixelRef">allocPixelRef(SkBitmap* bitmap)</a> = 0;
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Abstract subclass of <a href="#SkBitmap_HeapAllocator">HeapAllocator</a>.
|
||||
|
||||
@ -204,7 +205,8 @@ true if <a href="undocumented#Pixel_Ref">Pixel Ref</a> was allocated
|
||||
class <a href="#SkBitmap_HeapAllocator">HeapAllocator</a> : public <a href="#SkBitmap_Allocator">Allocator</a> {
|
||||
public:
|
||||
bool <a href="#SkBitmap_HeapAllocator_allocPixelRef">allocPixelRef(SkBitmap* bitmap)</a> override;
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Subclass of <a href="#SkBitmap_Allocator">SkBitmap::Allocator</a> that returns a <a href="undocumented#Pixel_Ref">Pixel Ref</a> that allocates its pixel
|
||||
memory from the heap. This is the default <a href="#SkBitmap_Allocator">SkBitmap::Allocator</a> invoked by
|
||||
@ -693,9 +695,10 @@ bitmap height: 32 info height: 32
|
||||
SkColorType colorType() const
|
||||
</pre>
|
||||
|
||||
Returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>.
|
||||
Returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>.
|
||||
|
||||
### Return Value
|
||||
|
||||
@ -769,7 +772,8 @@ immutable.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="7ade8a1a21ea5197e565c86740b47b73"><div><a href="undocumented#SkColorSpace_MakeSRGBLinear">SkColorSpace::MakeSRGBLinear</a> creates <a href="undocumented#Color_Space">Color Space</a> with linear gamma
|
||||
and an sRGB gamut. This <a href="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.</div>
|
||||
and an sRGB gamut. This <a href="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -836,7 +840,10 @@ bytes in pixel
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="4bfe28ea3f70f3bfd73d956e913c1a20">
|
||||
<div><fiddle-embed name="2a688e6f0a516c0d44a826381e9d637f"><a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -846,7 +853,10 @@ color: kAlpha_8_SkColorType bytesPerPixel: 1
|
||||
color: kRGB_565_SkColorType bytesPerPixel: 2
|
||||
color: kARGB_4444_SkColorType bytesPerPixel: 2
|
||||
color: kRGBA_8888_SkColorType bytesPerPixel: 4
|
||||
color: kRGB_888x_SkColorType bytesPerPixel: 4
|
||||
color: kBGRA_8888_SkColorType bytesPerPixel: 4
|
||||
color: kRGBA_1010102_SkColorType bytesPerPixel: 4
|
||||
color: kRGB_101010x_SkColorType bytesPerPixel: 4
|
||||
color: kGray_8_SkColorType bytesPerPixel: 1
|
||||
color: kRGBA_F16_SkColorType bytesPerPixel: 8
|
||||
~~~~
|
||||
@ -911,19 +921,25 @@ one of: 0, 1, 2, 3; left shift to convert pixels to bytes
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="2c77d92f20b950154b9444d3b639b36c">
|
||||
<div><fiddle-embed name="56ede4b7d45c15d5936f81ac3d74f070"><a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>
|
||||
|
||||
#### Example Output
|
||||
|
||||
~~~~
|
||||
color: kUnknown_SkColorType shiftPerPixel: 0
|
||||
color: kAlpha_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGB_565_SkColorType shiftPerPixel: 1
|
||||
color: kARGB_4444_SkColorType shiftPerPixel: 1
|
||||
color: kRGBA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kBGRA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kGray_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGBA_F16_SkColorType shiftPerPixel: 3
|
||||
color: kUnknown_SkColorType shiftPerPixel: 0
|
||||
color: kAlpha_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGB_565_SkColorType shiftPerPixel: 1
|
||||
color: kARGB_4444_SkColorType shiftPerPixel: 1
|
||||
color: kRGBA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kRGB_888x_SkColorType shiftPerPixel: 2
|
||||
color: kBGRA_8888_SkColorType shiftPerPixel: 2
|
||||
color: kRGBA_1010102_SkColorType shiftPerPixel: 2
|
||||
color: kRGB_101010x_SkColorType shiftPerPixel: 2
|
||||
color: kGray_8_SkColorType shiftPerPixel: 0
|
||||
color: kRGBA_F16_SkColorType shiftPerPixel: 3
|
||||
~~~~
|
||||
|
||||
</fiddle-embed></div>
|
||||
@ -1122,7 +1138,10 @@ true if <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a> is set
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9394975fa8a13204a5cc2e94f86737e5"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="38cec6acbba80274232a85539ab34af1"><a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1254,7 +1273,8 @@ Writing to immutable <a href="#Bitmap">Bitmap</a> pixels triggers an assert on d
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9210060d1f4ca46e1375496237902ef3"><div>Triggers assert if SK_DEBUG is true, runs fine otherwise.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="9210060d1f4ca46e1375496237902ef3"><div>Triggers assert if SK_DEBUG is true, runs fine otherwise.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1279,7 +1299,8 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> describes opaq
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="5e76b68bb46d54315eb0c12d83bd6949"><div><a href="#SkBitmap_isOpaque">isOpaque</a> ignores whether all pixels are opaque or not.</div>
|
||||
<div><fiddle-embed name="5e76b68bb46d54315eb0c12d83bd6949"><div><a href="#SkBitmap_isOpaque">isOpaque</a> ignores whether all pixels are opaque or not.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1643,7 +1664,8 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> set successful
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
enum <a href="#SkBitmap_AllocFlags">AllocFlags</a> {
|
||||
<a href="#SkBitmap_kZeroPixels_AllocFlag">kZeroPixels AllocFlag</a> = 1 << 0,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkBitmap_AllocFlags">AllocFlags</a> provides the option to zero pixel memory when allocated.
|
||||
|
||||
@ -1651,7 +1673,8 @@ enum <a href="#SkBitmap_AllocFlags">AllocFlags</a> {
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkBitmap_kZeroPixels_AllocFlag"> <code><strong>SkBitmap::kZeroPixels_AllocFlag </strong></code> </a></td><td>1</td><td>Instructs <a href="#SkBitmap_tryAllocPixelsFlags">tryAllocPixelsFlags</a> and <a href="#SkBitmap_allocPixelsFlags">allocPixelsFlags</a> to zero pixel memory.</td>
|
||||
<td><a name="SkBitmap_kZeroPixels_AllocFlag"> <code><strong>SkBitmap::kZeroPixels_AllocFlag </strong></code> </a></td><td>1</td><td>Instructs <a href="#SkBitmap_tryAllocPixelsFlags">tryAllocPixelsFlags</a> and <a href="#SkBitmap_allocPixelsFlags">allocPixelsFlags</a> to zero pixel memory.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1771,7 +1794,8 @@ contains width, height, <a href="SkImageInfo_Reference#Alpha_Type">Alpha Type</a
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="f21b8965a88c94a32393a8890c4672af"><div><a href="undocumented#Text">Text</a> is drawn on a transparent background; drawing the bitmap a second time
|
||||
lets the first draw show through.</div></fiddle-embed></div>
|
||||
lets the first draw show through.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2060,7 +2084,8 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is set to info
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="ff5b5c349efb5d929ff5dff07b7727e6"><div><a href="#SkBitmap_installPixels_releaseProc">releaseProc</a> is called immediately because <a href="#SkBitmap_rowBytes">rowBytes</a> is too small for <a href="undocumented#Pixel_Ref">Pixel Ref</a>.</div>
|
||||
<div><fiddle-embed name="ff5b5c349efb5d929ff5dff07b7727e6"><div><a href="#SkBitmap_installPixels_releaseProc">releaseProc</a> is called immediately because <a href="#SkBitmap_rowBytes">rowBytes</a> is too small for <a href="undocumented#Pixel_Ref">Pixel Ref</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2111,7 +2136,8 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> is set to info
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a7e04447b2081010c50d7920e80a6bb2"><div>GPU does not support <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>, does not assert that it does not.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="a7e04447b2081010c50d7920e80a6bb2"><div>GPU does not support <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>, does not assert that it does not.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2148,7 +2174,8 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> was set to pix
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="6e2a8c9358b34aebd2ec586815fe9d3a"><div><a href="#Draw">Draw</a> a five by five bitmap, and draw it again with a center white pixel.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="6e2a8c9358b34aebd2ec586815fe9d3a"><div><a href="#Draw">Draw</a> a five by five bitmap, and draw it again with a center white pixel.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2236,7 +2263,8 @@ true if the allocation succeeds
|
||||
|
||||
<div><fiddle-embed name="720e4c053fae9e929ab6518b47e49370"><div><a href="#Bitmap">Bitmap</a> hosts and draws gray values in set1. <a href="#SkBitmap_tryAllocPixels">tryAllocPixels</a> replaces <a href="undocumented#Pixel_Ref">Pixel Ref</a>
|
||||
and erases it to black, but does not alter set1. <a href="#SkBitmap_setPixels">setPixels</a> replaces black
|
||||
<a href="undocumented#Pixel_Ref">Pixel Ref</a> with set1.</div></fiddle-embed></div>
|
||||
<a href="undocumented#Pixel_Ref">Pixel Ref</a> with set1.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2261,7 +2289,8 @@ time by defining SK_ABORT.
|
||||
|
||||
<div><fiddle-embed name="1219b38c788bf270fb20f8cd2d78cff8"><div><a href="#Bitmap">Bitmap</a> hosts and draws gray values in set1. <a href="#SkBitmap_allocPixels">allocPixels</a> replaces <a href="undocumented#Pixel_Ref">Pixel Ref</a>
|
||||
and erases it to black, but does not alter set1. <a href="#SkBitmap_setPixels">setPixels</a> replaces black
|
||||
<a href="undocumented#Pixel_Ref">Pixel Ref</a> with set2.</div></fiddle-embed></div>
|
||||
<a href="undocumented#Pixel_Ref">Pixel Ref</a> with set2.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2297,7 +2326,8 @@ true if custom <a href="#SkBitmap_tryAllocPixels_4_allocator">allocator</a> repo
|
||||
<div><fiddle-embed name="eb6f861ca1839146d26e40d56c2a001c"><div><a href="#SkBitmap_HeapAllocator">HeapAllocator</a> limits the maximum size of <a href="#Bitmap">Bitmap</a> to two gigabytes. Using
|
||||
a custom <a href="#SkBitmap_tryAllocPixels_4_allocator">allocator</a>, this limitation may be relaxed. This example can be
|
||||
modified to allocate an eight gigabyte <a href="#Bitmap">Bitmap</a> on a 64 bit platform with
|
||||
sufficient memory.</div></fiddle-embed></div>
|
||||
sufficient memory.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2440,7 +2470,8 @@ row offset in <a href="undocumented#Pixel_Ref">Pixel Ref</a> for bitmap origin</
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="13df9e5b1adcec33d11e4b0f8a91ecb8"><div>Treating 32 bit data as 8 bit data is unlikely to produce useful results.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="13df9e5b1adcec33d11e4b0f8a91ecb8"><div>Treating 32 bit data as 8 bit data is unlikely to produce useful results.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3112,7 +3143,8 @@ true if pixels are copied to <a href="#SkBitmap_readPixels_2_dstPixels">dstPixel
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="b2cbbbbcffb618865d8aae3bc04b2a62"><div>Transferring the gradient from 8 bits per component to 4 bits per component
|
||||
creates visible banding.</div></fiddle-embed></div>
|
||||
creates visible banding.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
|
@ -217,7 +217,8 @@ may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="525285073aae7e53eb8f454a398f880c"><div>Allocates a three by three bitmap, clears it to white, and draws a black pixel
|
||||
in the center.</div>
|
||||
in the center.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -282,7 +283,8 @@ interval from one <a href="SkSurface_Reference#Surface">Surface</a> row to the n
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a9b116a7ebd1708237ce81ef532e9cb4"><div>Allocates a three by three bitmap, clears it to white, and draws a black pixel
|
||||
in the center.</div>
|
||||
in the center.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -316,7 +318,8 @@ empty <a href="#Canvas">Canvas</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="903451d6c93bf69e2833747a3e8cc8f7"><div>Passes a placeholder to a function that requires one.</div>
|
||||
<div><fiddle-embed name="903451d6c93bf69e2833747a3e8cc8f7"><div>Passes a placeholder to a function that requires one.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -424,7 +427,8 @@ storage of <a href="undocumented#Raster_Surface">Raster Surface</a></td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="dd92db963af190e849894038f39b598a"><div>The actual output depends on the installed fonts.</div>
|
||||
<div><fiddle-embed name="dd92db963af190e849894038f39b598a"><div>The actual output depends on the installed fonts.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -455,13 +459,15 @@ storage of <a href="undocumented#Raster_Surface">Raster Surface</a></td>
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
enum class <a href="#SkCanvas_ColorBehavior">ColorBehavior</a> {
|
||||
<a href="#SkCanvas_ColorBehavior_kLegacy">kLegacy</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_ColorBehavior_kLegacy"> <code><strong>SkCanvas::ColorBehavior::kLegacy </strong></code> </a></td><td>0</td><td>Is a placeholder to allow specialized constructor; has no meaning.</td>
|
||||
<td><a name="SkCanvas_ColorBehavior_kLegacy"> <code><strong>SkCanvas::ColorBehavior::kLegacy </strong></code> </a></td><td>0</td><td>Is a placeholder to allow specialized constructor; has no meaning.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -518,7 +524,8 @@ device independent fonts</td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="c26cfae4c42cb445240335cc12a50235"><div>The actual output depends on the installed fonts.</div>
|
||||
<div><fiddle-embed name="c26cfae4c42cb445240335cc12a50235"><div>The actual output depends on the installed fonts.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -559,7 +566,8 @@ Frees up resources used by <a href="#Canvas">Canvas</a>.
|
||||
<div><fiddle-embed name="b7bc91ff16c9b9351b2a127f35394b82"><div><a href="#Canvas">Canvas</a> <a href="#Layer">Layer</a> draws into bitmap. <a href="#SkCanvas_saveLayerAlpha">saveLayerAlpha</a> sets up an additional
|
||||
drawing surface that blends with the bitmap. When <a href="#Layer">Layer</a> goes out of
|
||||
scope, <a href="#Layer">Layer</a> Destructor is called. The saved <a href="#Layer">Layer</a> is restored, drawing
|
||||
transparent letters.</div></fiddle-embed></div>
|
||||
transparent letters.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -856,7 +864,8 @@ address of pixels, or nullptr if inaccessible
|
||||
device.
|
||||
|
||||
The <a href="#Layer">Layer</a> and blended result appear on the CPU and GPU but the large dotted
|
||||
"" appear only on the CPU.</div></fiddle-embed></div>
|
||||
"" appear only on the CPU.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1019,7 +1028,8 @@ true if pixels were copied
|
||||
|
||||
<div><fiddle-embed name="2964297993747769b0760874c19e0168"><div>A black circle drawn on a blue background provides an image to copy.
|
||||
<a href="#SkCanvas_readPixels">readPixels</a> copies one quarter of the canvas into each of the four corners.
|
||||
The copied quarter circles overdraw the original circle.</div></fiddle-embed></div>
|
||||
The copied quarter circles overdraw the original circle.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### Example
|
||||
|
||||
@ -1027,7 +1037,8 @@ The copied quarter circles overdraw the original circle.</div></fiddle-embed></d
|
||||
<a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="undocumented#Alpha">Color Alpha</a> equal 0x80
|
||||
and <a href="undocumented#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="undocumented#RGB">Color RGB</a> is multiplied by <a href="undocumented#Alpha">Color Alpha</a>
|
||||
to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580. <a href="#SkCanvas_readPixels">readPixels</a> converts pixel back
|
||||
to <a href="undocumented#Unpremultiply">Unpremultiplied</a> value 0x8056A9FF, introducing error.</div>
|
||||
to <a href="undocumented#Unpremultiply">Unpremultiplied</a> value 0x8056A9FF, introducing error.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1100,7 +1111,8 @@ true if pixels were copied
|
||||
|
||||
<div><fiddle-embed name="85f199032943b6483722c34a91c4e20f"><div><a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="undocumented#Alpha">Color Alpha</a> equal 0x80
|
||||
and <a href="undocumented#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="undocumented#RGB">Color RGB</a> is multiplied by <a href="undocumented#Alpha">Color Alpha</a>
|
||||
to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580.</div>
|
||||
to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1172,7 +1184,8 @@ true if pixels were copied
|
||||
|
||||
<div><fiddle-embed name="af6dec8ef974aa67bf102f29915bcd6a"><div><a href="#SkCanvas_clear">clear</a> takes <a href="undocumented#Unpremultiply">Unpremultiplied</a> input with <a href="undocumented#Alpha">Color Alpha</a> equal 0x80
|
||||
and <a href="undocumented#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="undocumented#RGB">Color RGB</a> is multiplied by <a href="undocumented#Alpha">Color Alpha</a>
|
||||
to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580.</div>
|
||||
to generate <a href="undocumented#Premultiply">Premultiplied</a> value 0x802B5580.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1337,14 +1350,16 @@ save state and return the depth of the stack.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a4548baa133302e933b4d3442c06f5b3"><div><a href="#Draw">Draw</a> to ever smaller clips; then restore drawing to full canvas.
|
||||
Note that the second <a href="#SkCanvas_clipRect">clipRect</a> is not permitted to enlarge <a href="#Clip">Clip</a>.</div></fiddle-embed></div>
|
||||
Note that the second <a href="#SkCanvas_clipRect">clipRect</a> is not permitted to enlarge <a href="#Clip">Clip</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
Each <a href="#Clip">Clip</a> uses the current <a href="#Matrix">Matrix</a> for its coordinates.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9f563a2d60aa31d4b26742e5aa17aa4e"><div>While <a href="#SkCanvas_clipRect">clipRect</a> is given the same rectangle twice, <a href="#Matrix">Matrix</a> makes the second
|
||||
<a href="#SkCanvas_clipRect">clipRect</a> draw at half the size of the first.</div></fiddle-embed></div>
|
||||
<a href="#SkCanvas_clipRect">clipRect</a> draw at half the size of the first.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1377,7 +1392,8 @@ depth of saved stack
|
||||
|
||||
<div><fiddle-embed name="e477dce358a9ba3b0aa1bf33b8a376de"><div>The black square is translated 50 pixels down and to the right.
|
||||
Restoring <a href="#Canvas">Canvas</a> state removes <a href="#SkCanvas_translate">translate</a> from <a href="#Canvas">Canvas</a> stack;
|
||||
the red square is not translated, and is drawn at the origin.</div></fiddle-embed></div>
|
||||
the red square is not translated, and is drawn at the origin.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1534,7 +1550,8 @@ depth of saved stack
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="1a025d6018f64140af2dc36acad59008"><div>Rectangles are blurred by <a href="undocumented#Image_Filter">Image Filter</a> when <a href="#SkCanvas_restore">restore</a> draws <a href="#Layer">Layer</a> to main
|
||||
<a href="#Canvas">Canvas</a>.</div></fiddle-embed></div>
|
||||
<a href="#Canvas">Canvas</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1582,7 +1599,8 @@ depth of saved stack
|
||||
|
||||
<div><fiddle-embed name="5b59231feae0c09cb1ab6a292229d7a4"><div>Rectangles are blurred by <a href="undocumented#Image_Filter">Image Filter</a> when <a href="#SkCanvas_restore">restore</a> draws <a href="#Layer">Layer</a> to main <a href="#Canvas">Canvas</a>.
|
||||
The red rectangle is clipped; it does not fully fit on <a href="#Layer">Layer</a>.
|
||||
<a href="undocumented#Image_Filter">Image Filter</a> blurs past edge of <a href="#Layer">Layer</a> so red rectangle is blurred on all sides.</div></fiddle-embed></div>
|
||||
<a href="undocumented#Image_Filter">Image Filter</a> blurs past edge of <a href="#Layer">Layer</a> so red rectangle is blurred on all sides.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1696,7 +1714,8 @@ enum {
|
||||
<a href="#SkCanvas_kPreserveLCDText_SaveLayerFlag">kPreserveLCDText SaveLayerFlag</a> = 1 << 1,
|
||||
<a href="#SkCanvas_kInitWithPrevious_SaveLayerFlag">kInitWithPrevious SaveLayerFlag</a> = 1 << 2,
|
||||
<a href="#SkCanvas_kDontClipToLayer_Legacy_SaveLayerFlag">kDontClipToLayer Legacy SaveLayerFlag</a> = kDontClipToLayer_PrivateSaveLayerFlag,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkCanvas_SaveLayerFlags">SaveLayerFlags</a> provides options that may be used in any combination in <a href="#SkCanvas_SaveLayerRec">SaveLayerRec</a>,
|
||||
defining how <a href="#Layer">Layer</a> allocated by <a href="#SkCanvas_saveLayer">saveLayer</a> operates.
|
||||
@ -1706,10 +1725,12 @@ defining how <a href="#Layer">Layer</a> allocated by <a href="#SkCanvas_saveLaye
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kPreserveLCDText_SaveLayerFlag"> <code><strong>SkCanvas::kPreserveLCDText_SaveLayerFlag </strong></code> </a></td><td>2</td><td>Creates <a href="#Layer">Layer</a> for LCD text. Flag is ignored if <a href="#Layer">Layer</a> <a href="SkPaint_Reference#Paint">Paint</a> contains
|
||||
<a href="undocumented#Image_Filter">Image Filter</a> or <a href="undocumented#Color_Filter">Color Filter</a>.</td>
|
||||
<a href="undocumented#Image_Filter">Image Filter</a> or <a href="undocumented#Color_Filter">Color Filter</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kInitWithPrevious_SaveLayerFlag"> <code><strong>SkCanvas::kInitWithPrevious_SaveLayerFlag </strong></code> </a></td><td>4</td><td>Initializes <a href="#Layer">Layer</a> with the contents of the previous <a href="#Layer">Layer</a>.</td>
|
||||
<td><a name="SkCanvas_kInitWithPrevious_SaveLayerFlag"> <code><strong>SkCanvas::kInitWithPrevious_SaveLayerFlag </strong></code> </a></td><td>4</td><td>Initializes <a href="#Layer">Layer</a> with the contents of the previous <a href="#Layer">Layer</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kDontClipToLayer_Legacy_SaveLayerFlag"> <code><strong>SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag </strong></code> </a></td><td>0x80000000</td><td>soon</td>
|
||||
@ -1719,7 +1740,8 @@ defining how <a href="#Layer">Layer</a> allocated by <a href="#SkCanvas_saveLaye
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="d314c688925d2c549d4762f5cc6e6a1a"><div><a href="#Canvas">Canvas</a> <a href="#Layer">Layer</a> captures red and blue circles scaled up by four.
|
||||
scalePaint blends <a href="#Layer">Layer</a> back with transparency.</div></fiddle-embed></div>
|
||||
scalePaint blends <a href="#Layer">Layer</a> back with transparency.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1737,7 +1759,8 @@ const <a href="SkRect_Reference#SkRect">SkRect</a>* <a href="#SkCanvas
|
||||
const <a href="SkPaint_Reference#SkPaint">SkPaint</a>* <a href="#SkCanvas_SaveLayerRec_fPaint">fPaint</a>;
|
||||
const <a href="undocumented#SkImageFilter">SkImageFilter</a>* <a href="#SkCanvas_SaveLayerRec_fBackdrop">fBackdrop</a>;
|
||||
<a href="#SkCanvas_SaveLayerFlags">SaveLayerFlags</a> <a href="#SkCanvas_SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>;
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkCanvas_SaveLayerRec_SaveLayerRec">SaveLayerRec</a> contains the state used to create the <a href="#Layer">Layer</a>.
|
||||
|
||||
@ -1780,7 +1803,8 @@ contents of the previous <a href="#Layer">Layer</a>.
|
||||
|
||||
<div><fiddle-embed name="7b18146582fc2440656b839a173ed500"><div><a href="#Canvas">Canvas</a> <a href="#Layer">Layer</a> captures a red Anti-aliased circle and a blue <a href="undocumented#Alias">Aliased</a> circle scaled
|
||||
up by four. After drawing another red circle without scaling on top, the <a href="#Layer">Layer</a> is
|
||||
transferred to the main canvas.</div></fiddle-embed></div>
|
||||
transferred to the main canvas.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkCanvas_SaveLayerRec_SaveLayerRec"></a>
|
||||
## SaveLayerRec
|
||||
@ -1906,7 +1930,8 @@ SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* ba
|
||||
const SkImage* clipMask, const SkMatrix* clipMatrix, SaveLayerFlags saveLayerFlags)
|
||||
</pre>
|
||||
|
||||
Not ready for general use.Sets <a href="#SkCanvas_SaveLayerRec_fBounds">fBounds</a>, <a href="#SkCanvas_SaveLayerRec_fPaint">fPaint</a>, <a href="#SkCanvas_SaveLayerRec_fBackdrop">fBackdrop</a>, <a href="#SkCanvas_SaveLayerRec_fClipMask">fClipMask</a>, <a href="#SkCanvas_SaveLayerRec_fClipMatrix">fClipMatrix</a>, and <a href="#SkCanvas_SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>.
|
||||
Not ready for general use.
|
||||
Sets <a href="#SkCanvas_SaveLayerRec_fBounds">fBounds</a>, <a href="#SkCanvas_SaveLayerRec_fPaint">fPaint</a>, <a href="#SkCanvas_SaveLayerRec_fBackdrop">fBackdrop</a>, <a href="#SkCanvas_SaveLayerRec_fClipMask">fClipMask</a>, <a href="#SkCanvas_SaveLayerRec_fClipMatrix">fClipMatrix</a>, and <a href="#SkCanvas_SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>.
|
||||
<a href="#SkCanvas_SaveLayerRec_SaveLayerRec_4_clipMatrix">clipMatrix</a> uses <a href="undocumented#Alpha">Color Alpha</a> channel of image, transformed by <a href="#SkCanvas_SaveLayerRec_SaveLayerRec_4_clipMatrix">clipMatrix</a>, to clip
|
||||
<a href="#Layer">Layer</a> when drawn to <a href="#Canvas">Canvas</a>.
|
||||
|
||||
@ -1978,7 +2003,8 @@ depth of save state stack
|
||||
<div><fiddle-embed name="7d3751e82d1b6ec328ffa3d6f48ca831"><div>The example draws an image, and saves it into a <a href="#Layer">Layer</a> with <a href="#SkCanvas_kInitWithPrevious_SaveLayerFlag">kInitWithPrevious SaveLayerFlag</a>.
|
||||
Next it punches a hole in <a href="#Layer">Layer</a> and restore with <a href="undocumented#SkBlendMode_kPlus">SkBlendMode::kPlus</a>.
|
||||
Where <a href="#Layer">Layer</a> was cleared, the original image will draw unchanged.
|
||||
Outside of the circle the mandrill is brightened.</div></fiddle-embed></div>
|
||||
Outside of the circle the mandrill is brightened.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2020,7 +2046,8 @@ by <a href="#SkCanvas_scale">scale</a>.
|
||||
The blue stroke follows translate of (50, 50); a black
|
||||
fill follows scale of (2, 1/2.f). After restoring the clip, which resets
|
||||
<a href="#Matrix">Matrix</a>, a red frame follows the same scale of (2, 1/2.f); a gray fill
|
||||
follows translate of (50, 50).</div></fiddle-embed></div>
|
||||
follows translate of (50, 50).
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2087,7 +2114,8 @@ amount to rotate, in <a href="#SkCanvas_rotate_degrees">degrees</a></td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="caafb205771b714948e00dcd58ccaf1f"><div><a href="#Draw">Draw</a> clock hands at time 5:10. The hour hand and minute hand point up and
|
||||
are rotated clockwise.</div></fiddle-embed></div>
|
||||
are rotated clockwise.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2163,7 +2191,8 @@ amount to skew in y</td>
|
||||
shifts the geometry to the right as the y values decrease.
|
||||
<a href="undocumented#RGB_Red">Red</a> text uses a positive skew in y to shift the geometry down as the x values
|
||||
increase.
|
||||
<a href="undocumented#RGB_Blue">Blue</a> text combines x and y skew to rotate and scale.</div></fiddle-embed></div>
|
||||
<a href="undocumented#RGB_Blue">Blue</a> text combines x and y skew to rotate and scale.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2313,7 +2342,8 @@ and is unaffected by <a href="#Matrix">Matrix</a>.
|
||||
<div><fiddle-embed name="d2e60e5171f26ff9ddefae48387f889b"><div><a href="#Draw">Draw</a> a red circle with an <a href="undocumented#Alias">Aliased</a> clip and an Anti-aliased clip.
|
||||
Use an image filter to zoom into the pixels drawn.
|
||||
The edge of the <a href="undocumented#Alias">Aliased</a> clip fully draws pixels in the red circle.
|
||||
The edge of the Anti-aliased clip partially draws pixels in the red circle.</div></fiddle-embed></div>
|
||||
The edge of the Anti-aliased clip partially draws pixels in the red circle.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkCanvas_clipRect"></a>
|
||||
## clipRect
|
||||
@ -2400,7 +2430,8 @@ true if <a href="#Clip">Clip</a> is to be Anti-aliased</td>
|
||||
|
||||
<div><fiddle-embed name="1d4e0632c97e42692775d834fe10aa99"><div>A circle drawn in pieces looks uniform when drawn <a href="undocumented#Alias">Aliased</a>.
|
||||
The same circle pieces blend with pixels more than once when Anti-aliased,
|
||||
visible as a thin pair of lines through the right circle.</div></fiddle-embed></div>
|
||||
visible as a thin pair of lines through the right circle.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2554,7 +2585,8 @@ true if <a href="#Clip">Clip</a> is to be Anti-aliased</td>
|
||||
area outside clip is subtracted from circle.
|
||||
|
||||
Bottom figure uses <a href="SkPath_Reference#SkPath_kWinding_FillType">SkPath::kWinding FillType</a> and <a href="undocumented#SkClipOp_kIntersect">SkClipOp::kIntersect</a>;
|
||||
area inside clip is intersected with circle.</div></fiddle-embed></div>
|
||||
area inside clip is intersected with circle.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2589,7 +2621,8 @@ before it is combined with <a href="#Clip">Clip</a>.
|
||||
|
||||
<div><fiddle-embed name="7856755c1bf8431c286c734b353345ad"><div>Overlapping <a href="SkRect_Reference#Rect">Rects</a> form a clip. When clip <a href="SkPath_Reference#Fill_Type">Path Fill Type</a> is set to
|
||||
<a href="SkPath_Reference#SkPath_kWinding_FillType">SkPath::kWinding FillType</a>, the overlap is included. Set to
|
||||
<a href="SkPath_Reference#SkPath_kEvenOdd_FillType">SkPath::kEvenOdd FillType</a>, the overlap is excluded and forms a hole.</div></fiddle-embed></div>
|
||||
<a href="SkPath_Reference#SkPath_kEvenOdd_FillType">SkPath::kEvenOdd FillType</a>, the overlap is excluded and forms a hole.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2623,7 +2656,8 @@ true if <a href="#Clip">Clip</a> is to be Anti-aliased</td>
|
||||
|
||||
<div><fiddle-embed name="187a7ae77a8176e417181411988534b6"><div><a href="#Clip">Clip</a> loops over itself covering its center twice. When clip <a href="SkPath_Reference#Fill_Type">Path Fill Type</a>
|
||||
is set to <a href="SkPath_Reference#SkPath_kWinding_FillType">SkPath::kWinding FillType</a>, the overlap is included. Set to
|
||||
<a href="SkPath_Reference#SkPath_kEvenOdd_FillType">SkPath::kEvenOdd FillType</a>, the overlap is excluded and forms a hole.</div></fiddle-embed></div>
|
||||
<a href="SkPath_Reference#SkPath_kEvenOdd_FillType">SkPath::kEvenOdd FillType</a>, the overlap is excluded and forms a hole.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2638,7 +2672,8 @@ is set to <a href="SkPath_Reference#SkPath_kWinding_FillType">SkPath::kWinding F
|
||||
void setAllowSimplifyClip(bool allow)
|
||||
</pre>
|
||||
|
||||
Only used for testing.Set to simplify clip stack using <a href="undocumented#PathOps">PathOps</a>.
|
||||
Only used for testing.
|
||||
Set to simplify clip stack using <a href="undocumented#PathOps">PathOps</a>.
|
||||
|
||||
---
|
||||
|
||||
@ -2666,7 +2701,8 @@ Resulting <a href="#Clip">Clip</a> is <a href="undocumented#Alias">Aliased</a>;
|
||||
|
||||
<div><fiddle-embed name="7bb57c0e456c5fda2c2cca4abb68b19e"><div>region is unaffected by canvas rotation; iRect is affected by canvas rotation.
|
||||
Both clips are <a href="undocumented#Alias">Aliased</a>; this is not noticeable on <a href="undocumented#Region">Region</a> clip because it
|
||||
aligns to pixel boundaries.</div></fiddle-embed></div>
|
||||
aligns to pixel boundaries.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2778,7 +2814,8 @@ bounds of <a href="#Clip">Clip</a> in local coordinates
|
||||
|
||||
<div><fiddle-embed name="0b36ff64daf88c046b4ae6ed4ee64db9"><div>Initial bounds is device bounds outset by 1 on all sides.
|
||||
Clipped bounds is <a href="#SkCanvas_clipPath">clipPath</a> bounds outset by 1 on all sides.
|
||||
Scaling the canvas by two in x and y scales the local bounds by 1/2 in x and y.</div>
|
||||
Scaling the canvas by two in x and y scales the local bounds by 1/2 in x and y.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2858,7 +2895,8 @@ bounds of <a href="#Clip">Clip</a> in <a href="undocumented#Device">Device</a> c
|
||||
|
||||
<div><fiddle-embed name="5f4c910afa4a5a61702e5119eab2cac9"><div>Initial bounds is device bounds, not outset.
|
||||
Clipped bounds is <a href="#SkCanvas_clipPath">clipPath</a> bounds, not outset.
|
||||
Scaling the canvas by 1/2 in x and y scales the device bounds by 1/2 in x and y.</div>
|
||||
Scaling the canvas by 1/2 in x and y scales the device bounds by 1/2 in x and y.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -3082,7 +3120,8 @@ enum <a href="#SkCanvas_PointMode">PointMode</a> {
|
||||
<a href="#SkCanvas_kPoints_PointMode">kPoints PointMode</a>,
|
||||
<a href="#SkCanvas_kLines_PointMode">kLines PointMode</a>,
|
||||
<a href="#SkCanvas_kPolygon_PointMode">kPolygon PointMode</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Selects if an array of points are drawn as discrete points, as lines, or as
|
||||
an open polygon.
|
||||
@ -3091,13 +3130,16 @@ an open polygon.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kPoints_PointMode"> <code><strong>SkCanvas::kPoints_PointMode </strong></code> </a></td><td>0</td><td><a href="#Draw">Draw</a> each point separately.</td>
|
||||
<td><a name="SkCanvas_kPoints_PointMode"> <code><strong>SkCanvas::kPoints_PointMode </strong></code> </a></td><td>0</td><td><a href="#Draw">Draw</a> each point separately.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kLines_PointMode"> <code><strong>SkCanvas::kLines_PointMode </strong></code> </a></td><td>1</td><td><a href="#Draw">Draw</a> each pair of points as a line segment.</td>
|
||||
<td><a name="SkCanvas_kLines_PointMode"> <code><strong>SkCanvas::kLines_PointMode </strong></code> </a></td><td>1</td><td><a href="#Draw">Draw</a> each pair of points as a line segment.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kPolygon_PointMode"> <code><strong>SkCanvas::kPolygon_PointMode </strong></code> </a></td><td>2</td><td><a href="#Draw">Draw</a> the array of points as a open polygon.</td>
|
||||
<td><a name="SkCanvas_kPolygon_PointMode"> <code><strong>SkCanvas::kPolygon_PointMode </strong></code> </a></td><td>2</td><td><a href="#Draw">Draw</a> the array of points as a open polygon.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -3106,7 +3148,8 @@ an open polygon.
|
||||
<div><fiddle-embed name="292b4b2008961b6f612434d3121fc4ce"><div>The upper left corner shows three squares when drawn as points.
|
||||
The upper right corner shows one line; when drawn as lines, two points are required per line.
|
||||
The lower right corner shows two lines; when draw as polygon, no miter is drawn at the corner.
|
||||
The lower left corner shows two lines with a miter when path contains polygon.</div></fiddle-embed></div>
|
||||
The lower left corner shows two lines with a miter when path contains polygon.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3173,7 +3216,8 @@ stroke, blend, color, and so on, used to draw</td>
|
||||
</table>
|
||||
|
||||
The transparent color makes multiple line draws visible;
|
||||
the path is drawn all at once.</div></fiddle-embed></div>
|
||||
the path is drawn all at once.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3513,7 +3557,8 @@ concave and <a href="#SkCanvas_drawDRRect_outer">outer</a> contains <a href="#Sk
|
||||
|
||||
<div><fiddle-embed name="30823cb4edf884d330285ea161664931"><div>Outer <a href="SkRect_Reference#Rect">Rect</a> has no corner radii, but stroke join is rounded.
|
||||
Inner <a href="undocumented#Round_Rect">Round Rect</a> has corner radii; outset stroke increases radii of corners.
|
||||
Stroke join does not affect <a href="#SkCanvas_drawDRRect_inner">inner</a> <a href="undocumented#Round_Rect">Round Rect</a> since it has no sharp corners.</div></fiddle-embed></div>
|
||||
Stroke join does not affect <a href="#SkCanvas_drawDRRect_inner">inner</a> <a href="undocumented#Round_Rect">Round Rect</a> since it has no sharp corners.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3674,7 +3719,8 @@ stroke, blend, color, and so on, used to draw</td>
|
||||
<div><fiddle-embed name="199fe818c09026c114e165bff166a39f"><div>Top row has a zero radius a generates a rectangle.
|
||||
Second row radii sum to less than sides.
|
||||
Third row radii sum equals sides.
|
||||
Fourth row radii sum exceeds sides; radii are scaled to fit.</div></fiddle-embed></div>
|
||||
Fourth row radii sum exceeds sides; radii are scaled to fit.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3714,7 +3760,8 @@ is affected by caps; the closed contour is affected by joins.
|
||||
Bottom row draws fill the same for open and closed contour.
|
||||
First bottom column shows winding fills overlap.
|
||||
Second bottom column shows even odd fills exclude overlap.
|
||||
Third bottom column shows inverse winding fills area outside both contours.</div></fiddle-embed></div>
|
||||
Third bottom column shows inverse winding fills area outside both contours.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3815,7 +3862,8 @@ and so on; or nullptr</td>
|
||||
enum <a href="#SkCanvas_SrcRectConstraint">SrcRectConstraint</a> {
|
||||
<a href="#SkCanvas_kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a>,
|
||||
<a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkCanvas_SrcRectConstraint">SrcRectConstraint</a> controls the behavior at the edge of source <a href="SkRect_Reference#Rect">Rect</a>,
|
||||
provided to <a href="#SkCanvas_drawImageRect">drawImageRect</a>, trading off speed for precision.
|
||||
@ -3830,11 +3878,13 @@ outside source <a href="SkRect_Reference#Rect">Rect</a>.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kStrict_SrcRectConstraint"> <code><strong>SkCanvas::kStrict_SrcRectConstraint </strong></code> </a></td><td>Requires Image_Filter to respect source Rect,</td><td>sampling only inside of its bounds, possibly with a performance penalty.</td>
|
||||
<td><a name="SkCanvas_kStrict_SrcRectConstraint"> <code><strong>SkCanvas::kStrict_SrcRectConstraint </strong></code> </a></td><td>Requires Image_Filter to respect source Rect,</td><td>sampling only inside of its bounds, possibly with a performance penalty.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_kFast_SrcRectConstraint"> <code><strong>SkCanvas::kFast_SrcRectConstraint </strong></code> </a></td><td>Permits Image_Filter to sample outside of source Rect</td><td>by half the width of <a href="undocumented#Image_Filter">Image Filter</a>, permitting it to run faster but with
|
||||
error at the image edges.</td>
|
||||
error at the image edges.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -3844,7 +3894,8 @@ error at the image edges.</td>
|
||||
redBorder is drawn scaled by 16 on the left.
|
||||
The middle and right bitmaps are filtered checkerboards.
|
||||
Drawing the checkerboard with <a href="#SkCanvas_kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> shows only a blur of black and white.
|
||||
Drawing the checkerboard with <a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows red to bleed in the corners.</div></fiddle-embed></div>
|
||||
Drawing the checkerboard with <a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows red to bleed in the corners.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3897,7 +3948,8 @@ filter strictly within <a href="#SkCanvas_drawImageRect_src">src</a> or draw fas
|
||||
its bounds; there is no bleeding with <a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a>.
|
||||
the middle and right bitmaps draw with <a href="undocumented#kLow_SkFilterQuality">kLow_SkFilterQuality</a>; with
|
||||
<a href="#SkCanvas_kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a>, the filter remains within the checkerboard, and
|
||||
with <a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a> red bleeds on the edges.</div></fiddle-embed></div>
|
||||
with <a href="#SkCanvas_kFast_SrcRectConstraint">kFast SrcRectConstraint</a> red bleeds on the edges.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4042,7 +4094,8 @@ filter strictly within <a href="#SkCanvas_drawImageRect_4_src">src</a> or draw f
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="589999454db90c573f7facfb007253a7"><div><a href="#Canvas">Canvas</a> scales and translates; transformation from <a href="#SkCanvas_drawImageRect_4_src">src</a> to <a href="#SkCanvas_drawImageRect_4_dst">dst</a> also scales.
|
||||
The two matrices are concatenated to create the final transformation.</div></fiddle-embed></div>
|
||||
The two matrices are concatenated to create the final transformation.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4187,7 +4240,8 @@ and so on; or nullptr</td>
|
||||
<div><fiddle-embed name="47f78f3f70ccd9e6c40ee3203a5c71dd"><div>The leftmost <a href="#SkCanvas_drawImageNine_image">image</a> is smaller than <a href="#SkCanvas_drawImageNine_center">center</a>; only corners are drawn, all scaled to fit.
|
||||
The second <a href="#SkCanvas_drawImageNine_image">image</a> equals the size of <a href="#SkCanvas_drawImageNine_center">center</a>; only corners are drawn without scaling.
|
||||
The remaining images are larger than <a href="#SkCanvas_drawImageNine_center">center</a>. All corners draw without scaling.
|
||||
The sides and <a href="#SkCanvas_drawImageNine_center">center</a> are scaled if needed to take up the remaining space.</div></fiddle-embed></div>
|
||||
The sides and <a href="#SkCanvas_drawImageNine_center">center</a> are scaled if needed to take up the remaining space.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4238,7 +4292,8 @@ The leftmost <a href="#SkCanvas_drawImageNine_2_image">image</a> scales the widt
|
||||
The third and fourth <a href="#SkCanvas_drawImageNine_2_image">image</a> corners are not scaled; the sides and <a href="#SkCanvas_drawImageNine_2_center">center</a> are scaled to
|
||||
fill the remaining space.
|
||||
The rightmost <a href="#SkCanvas_drawImageNine_2_image">image</a> has four corners scaled vertically to fit, and uses sides above
|
||||
and below <a href="#SkCanvas_drawImageNine_2_center">center</a> to fill the remaining space.</div></fiddle-embed></div>
|
||||
and below <a href="#SkCanvas_drawImageNine_2_center">center</a> to fill the remaining space.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4483,7 +4538,8 @@ The leftmost <a href="#SkCanvas_drawBitmapNine_bitmap">bitmap</a> draw scales th
|
||||
The third and fourth draw corners are not scaled; the sides and <a href="#SkCanvas_drawBitmapNine_center">center</a> are scaled to
|
||||
fill the remaining space.
|
||||
The rightmost <a href="#SkCanvas_drawBitmapNine_bitmap">bitmap</a> draw has four corners scaled vertically to fit, and uses sides above
|
||||
and below <a href="#SkCanvas_drawBitmapNine_center">center</a> to fill the remaining space.</div></fiddle-embed></div>
|
||||
and below <a href="#SkCanvas_drawBitmapNine_center">center</a> to fill the remaining space.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4504,7 +4560,8 @@ int <a href="#SkCanvas_Lattice_fXCount">fXCount</a>;
|
||||
int <a href="#SkCanvas_Lattice_fYCount">fYCount</a>;
|
||||
const <a href="SkIRect_Reference#SkIRect">SkIRect</a>* <a href="#SkCanvas_Lattice_fBounds">fBounds</a>;
|
||||
const <a href="undocumented#SkColor">SkColor</a>* <a href="#SkCanvas_Lattice_fColors">fColors</a>;
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkCanvas_Lattice">Lattice</a> divides <a href="SkBitmap_Reference#Bitmap">Bitmap</a> or <a href="SkImage_Reference#Image">Image</a> into a rectangular grid.
|
||||
Grid entries on even columns and even rows are fixed; these entries are
|
||||
@ -4521,7 +4578,8 @@ enum <a href="#SkCanvas_Lattice_RectType">RectType</a> : uint8_t {
|
||||
<a href="#SkCanvas_Lattice_kDefault">kDefault</a> = 0,
|
||||
<a href="#SkCanvas_Lattice_kTransparent">kTransparent</a>,
|
||||
<a href="#SkCanvas_Lattice_kFixedColor">kFixedColor</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Optional setting per rectangular grid entry to make it transparent,
|
||||
or to fill the grid entry with a color.
|
||||
@ -4530,13 +4588,16 @@ or to fill the grid entry with a color.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_Lattice_kDefault"> <code><strong>SkCanvas::Lattice::kDefault </strong></code> </a></td><td>0</td><td>Draws <a href="SkBitmap_Reference#Bitmap">Bitmap</a> into lattice rectangle.</td>
|
||||
<td><a name="SkCanvas_Lattice_kDefault"> <code><strong>SkCanvas::Lattice::kDefault </strong></code> </a></td><td>0</td><td>Draws <a href="SkBitmap_Reference#Bitmap">Bitmap</a> into lattice rectangle.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_Lattice_kTransparent"> <code><strong>SkCanvas::Lattice::kTransparent </strong></code> </a></td><td>1</td><td>Skips lattice rectangle by making it transparent.</td>
|
||||
<td><a name="SkCanvas_Lattice_kTransparent"> <code><strong>SkCanvas::Lattice::kTransparent </strong></code> </a></td><td>1</td><td>Skips lattice rectangle by making it transparent.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkCanvas_Lattice_kFixedColor"> <code><strong>SkCanvas::Lattice::kFixedColor </strong></code> </a></td><td>2</td><td>Draws one of <a href="#SkCanvas_Lattice_fColors">fColors</a> into lattice rectangle.</td>
|
||||
<td><a name="SkCanvas_Lattice_kFixedColor"> <code><strong>SkCanvas::Lattice::kFixedColor </strong></code> </a></td><td>2</td><td>Draws one of <a href="#SkCanvas_Lattice_fColors">fColors</a> into lattice rectangle.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -4560,7 +4621,8 @@ grid entries.
|
||||
<a name="SkCanvas_Lattice_fRectTypes"> <code><strong>const RectType* fRectTypes</strong></code> </a>
|
||||
|
||||
Optional array of fill types, one per rectangular grid entry:
|
||||
array length must be( <a href="#SkCanvas_Lattice_fXCount">fXCount</a> + 1) * (<a href="#SkCanvas_Lattice_fYCount">fYCount</a> + 1).
|
||||
array length must be( <a href="#SkCanvas_Lattice_fXCount">fXCount</a> + 1) * (<a href="#SkCanvas_Lattice_fYCount">fYCount</a> + 1)
|
||||
.
|
||||
|
||||
Each <a href="#SkCanvas_Lattice_RectType">RectType</a> is one of: <a href="#SkCanvas_Lattice_kDefault">kDefault</a>, <a href="#SkCanvas_Lattice_kTransparent">kTransparent</a>, <a href="#SkCanvas_Lattice_kFixedColor">kFixedColor</a>.
|
||||
|
||||
@ -4585,7 +4647,8 @@ If nullptr, source bounds is dimensions of <a href="SkBitmap_Reference#Bitmap">B
|
||||
<a name="SkCanvas_Lattice_fColors"> <code><strong>const SkColor* fColors</strong></code> </a>
|
||||
|
||||
Optional array of colors, one per rectangular grid entry.
|
||||
Array length must be( <a href="#SkCanvas_Lattice_fXCount">fXCount</a> + 1) * (<a href="#SkCanvas_Lattice_fYCount">fYCount</a> + 1).
|
||||
Array length must be( <a href="#SkCanvas_Lattice_fXCount">fXCount</a> + 1) * (<a href="#SkCanvas_Lattice_fYCount">fYCount</a> + 1)
|
||||
.
|
||||
|
||||
Array entries correspond to the rectangular grid entries, ascending
|
||||
left to right, then top to bottom.
|
||||
@ -4638,7 +4701,8 @@ The leftmost <a href="#SkCanvas_drawBitmapLattice_bitmap">bitmap</a> draw scales
|
||||
The third and fourth draw corners are not scaled; the sides are scaled to
|
||||
fill the remaining space; the center is transparent.
|
||||
The rightmost <a href="#SkCanvas_drawBitmapLattice_bitmap">bitmap</a> draw has four corners scaled vertically to fit, and uses sides above
|
||||
and below center to fill the remaining space.</div></fiddle-embed></div>
|
||||
and below center to fill the remaining space.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4692,7 +4756,8 @@ and so on; or nullptr</td>
|
||||
<div><fiddle-embed name="75f43f11c6bd58175071b8b54ebec676"><div>The leftmost <a href="#SkCanvas_drawImageLattice_image">image</a> is smaller than center; only corners are drawn, all scaled to fit.
|
||||
The second <a href="#SkCanvas_drawImageLattice_image">image</a> equals the size of center; only corners are drawn without scaling.
|
||||
The remaining images are larger than center. All corners draw without scaling. The sides
|
||||
are scaled if needed to take up the remaining space; the center is transparent.</div></fiddle-embed></div>
|
||||
are scaled if needed to take up the remaining space; the center is transparent.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4755,7 +4820,8 @@ start of <a href="#SkCanvas_drawText_text">text</a> on <a href="#SkCanvas_drawTe
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a3365bd3044b13e8e0318ee8aefbdf91"><div>The same <a href="#SkCanvas_drawText_text">text</a> is drawn varying <a href="SkPaint_Reference#Text_Size">Paint Text Size</a> and varying
|
||||
<a href="#Matrix">Matrix</a>.</div></fiddle-embed></div>
|
||||
<a href="#Matrix">Matrix</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -5179,7 +5245,8 @@ blend, color, stroking, and so on, used to draw</td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="d88b17d85fa68c56b3c1ad02b69068bf"><div><a href="SkPaint_Reference#Paint">Paint</a> attributes unrelated to text, like color, have no effect on <a href="#SkCanvas_drawTextBlob_2_paint">paint</a> in allocated <a href="undocumented#Text_Blob">Text Blob</a>.
|
||||
<a href="SkPaint_Reference#Paint">Paint</a> attributes related to text, like text size, have no effect on <a href="#SkCanvas_drawTextBlob_2_paint">paint</a> passed to <a href="#SkCanvas_drawTextBlob">drawTextBlob</a>.</div></fiddle-embed></div>
|
||||
<a href="SkPaint_Reference#Paint">Paint</a> attributes related to text, like text size, have no effect on <a href="#SkCanvas_drawTextBlob_2_paint">paint</a> passed to <a href="#SkCanvas_drawTextBlob">drawTextBlob</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
|
@ -294,7 +294,8 @@ pt: -2147483648, -2147483648 negate: -2147483648, -2147483648
|
||||
void operator+=(const SkIVector& v)
|
||||
</pre>
|
||||
|
||||
Offsets <a href="#IPoint">IPoint</a> by <a href="#IVector">IVector</a> <a href="#SkIPoint_addto_operator_v">v</a>. Sets <a href="#IPoint">IPoint</a> to(<a href="#SkIPoint_fX">fX</a> + <a href="#SkIPoint_addto_operator_v">v</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_fY">fY</a> + <a href="#SkIPoint_addto_operator_v">v</a>.<a href="#SkIPoint_fY">fY</a>).
|
||||
Offsets <a href="#IPoint">IPoint</a> by <a href="#IVector">IVector</a> <a href="#SkIPoint_addto_operator_v">v</a>. Sets <a href="#IPoint">IPoint</a> to(<a href="#SkIPoint_fX">fX</a> + <a href="#SkIPoint_addto_operator_v">v</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_fY">fY</a> + <a href="#SkIPoint_addto_operator_v">v</a>.<a href="#SkIPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -321,7 +322,8 @@ void operator-=(const SkIVector& v)
|
||||
</pre>
|
||||
|
||||
Subtracts <a href="#IVector">IVector</a> <a href="#SkIPoint_subtractfrom_operator_v">v</a> from <a href="#IPoint">IPoint</a>. Sets <a href="#IPoint">IPoint</a> to:
|
||||
(<a href="#SkIPoint_fX">fX</a> - <a href="#SkIPoint_subtractfrom_operator_v">v</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_fY">fY</a> - <a href="#SkIPoint_subtractfrom_operator_v">v</a>.<a href="#SkIPoint_fY">fY</a>).
|
||||
(<a href="#SkIPoint_fX">fX</a> - <a href="#SkIPoint_subtractfrom_operator_v">v</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_fY">fY</a> - <a href="#SkIPoint_subtractfrom_operator_v">v</a>.<a href="#SkIPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -476,7 +478,8 @@ pt: -2147483648, -1 == pt
|
||||
SkIVector operator-(const SkIPoint& a, const SkIPoint& b)
|
||||
</pre>
|
||||
|
||||
Returns <a href="#IVector">IVector</a> from <a href="#SkIPoint_subtract_operator_b">b</a> to <a href="#SkIPoint_subtract_operator_a">a</a>; computed as(<a href="#SkIPoint_subtract_operator_a">a</a>.<a href="#SkIPoint_fX">fX</a> - <a href="#SkIPoint_subtract_operator_b">b</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_subtract_operator_a">a</a>.<a href="#SkIPoint_fY">fY</a> - <a href="#SkIPoint_subtract_operator_b">b</a>.<a href="#SkIPoint_fY">fY</a>).
|
||||
Returns <a href="#IVector">IVector</a> from <a href="#SkIPoint_subtract_operator_b">b</a> to <a href="#SkIPoint_subtract_operator_a">a</a>; computed as(<a href="#SkIPoint_subtract_operator_a">a</a>.<a href="#SkIPoint_fX">fX</a> - <a href="#SkIPoint_subtract_operator_b">b</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_subtract_operator_a">a</a>.<a href="#SkIPoint_fY">fY</a> - <a href="#SkIPoint_subtract_operator_b">b</a>.<a href="#SkIPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
Can also be used to subtract <a href="#IVector">IVector</a> from <a href="#IVector">IVector</a>, returning <a href="#IVector">IVector</a>.
|
||||
|
||||
@ -511,7 +514,8 @@ SkIPoint operator+(const SkIPoint& a, const SkIVector& b)
|
||||
</pre>
|
||||
|
||||
Returns <a href="#IPoint">IPoint</a> resulting from <a href="#IPoint">IPoint</a> <a href="#SkIPoint_add_operator_a">a</a> offset by <a href="#IVector">IVector</a> <a href="#SkIPoint_add_operator_b">b</a>, computed as:
|
||||
(<a href="#SkIPoint_add_operator_a">a</a>.<a href="#SkIPoint_fX">fX</a> + <a href="#SkIPoint_add_operator_b">b</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_add_operator_a">a</a>.<a href="#SkIPoint_fY">fY</a> + <a href="#SkIPoint_add_operator_b">b</a>.<a href="#SkIPoint_fY">fY</a>).
|
||||
(<a href="#SkIPoint_add_operator_a">a</a>.<a href="#SkIPoint_fX">fX</a> + <a href="#SkIPoint_add_operator_b">b</a>.<a href="#SkIPoint_fX">fX</a>, <a href="#SkIPoint_add_operator_a">a</a>.<a href="#SkIPoint_fY">fY</a> + <a href="#SkIPoint_add_operator_b">b</a>.<a href="#SkIPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
Can also be used to offset <a href="#IPoint">IPoint</a> <a href="#SkIPoint_add_operator_b">b</a> by <a href="#IVector">IVector</a> <a href="#SkIPoint_add_operator_a">a</a>, returning <a href="#IPoint">IPoint</a>.
|
||||
Can also be used to add <a href="#IVector">IVector</a> to <a href="#IVector">IVector</a>, returning <a href="#IVector">IVector</a>.
|
||||
|
@ -297,7 +297,8 @@ static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, in
|
||||
</pre>
|
||||
|
||||
Returns constructed <a href="#IRect">IRect</a> set to:
|
||||
(x, y, x + <a href="#SkIRect_MakeXYWH_w">w</a>, y + <a href="#SkIRect_MakeXYWH_h">h</a>).
|
||||
(x, y, x + <a href="#SkIRect_MakeXYWH_w">w</a>, y + <a href="#SkIRect_MakeXYWH_h">h</a>)
|
||||
.
|
||||
Does not validate input;
|
||||
<a href="#SkIRect_MakeXYWH_w">w</a> or <a href="#SkIRect_MakeXYWH_h">h</a> may be negative.
|
||||
|
||||
@ -732,7 +733,8 @@ midpoint in x
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="549b840a9ceaaf7cb4e604f9f3d7108d"><div>Dividing by two rounds towards zero. <a href="#SkIRect_centerX">centerX</a> uses a bit shift and rounds down.</div>
|
||||
<div><fiddle-embed name="549b840a9ceaaf7cb4e604f9f3d7108d"><div>Dividing by two rounds towards zero. <a href="#SkIRect_centerX">centerX</a> uses a bit shift and rounds down.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1108,7 +1110,8 @@ void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
</pre>
|
||||
|
||||
Sets <a href="#IRect">IRect</a> to:
|
||||
(x, y, x + width, y + height).
|
||||
(x, y, x + width, y + height)
|
||||
.
|
||||
Does not validate input;
|
||||
width or height may be negative.
|
||||
|
||||
@ -1498,7 +1501,8 @@ must describe area; <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#Sk
|
||||
empty() returns false. The intersection of <a href="#IRect">IRect</a> pair can be described by:
|
||||
|
||||
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
|
||||
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)).
|
||||
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))
|
||||
.
|
||||
|
||||
The intersection is only meaningful if the resulting <a href="#IRect">IRect</a> is not empty and
|
||||
describes an area: <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>.
|
||||
@ -1548,7 +1552,8 @@ true if construction and <a href="#IRect">IRect</a> have no area in common
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="f07146508efc516559d73853e6dadc78"><div><a href="#SkIRect_quickReject">quickReject</a> is the complement of <a href="#SkIRect_Intersects">Intersects</a>.</div>
|
||||
<div><fiddle-embed name="f07146508efc516559d73853e6dadc78"><div><a href="#SkIRect_quickReject">quickReject</a> is the complement of <a href="#SkIRect_Intersects">Intersects</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1579,7 +1584,8 @@ Returns true if:
|
||||
Returns false if <a href="#IRect">IRect</a> is empty.
|
||||
|
||||
Considers input to describe constructed <a href="#IRect">IRect</a>:
|
||||
(x, y, x + 1, y + 1)and
|
||||
(x, y, x + 1, y + 1)
|
||||
and
|
||||
returns true if constructed area is completely enclosed by <a href="#IRect">IRect</a> area.
|
||||
|
||||
### Parameters
|
||||
@ -1869,7 +1875,8 @@ true if <a href="#SkIRect_intersect_r">r</a> and <a href="#IRect">IRect</a> have
|
||||
|
||||
<div><fiddle-embed name="2be1302480e54a767e25cbeed5d41b41"><div>Two <a href="undocumented#SkDebugf">SkDebugf</a> calls are required. If the calls are combined, their arguments
|
||||
may not be evaluated in left to right order: the printed intersection may
|
||||
be before or after the call to intersect.</div>
|
||||
be before or after the call to intersect.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2005,7 +2012,8 @@ true if construction and <a href="#IRect">IRect</a> have area in common
|
||||
|
||||
<div><fiddle-embed name="4e6f580a3906c08a5faee524f7e72334"><div>Two <a href="undocumented#SkDebugf">SkDebugf</a> calls are required. If the calls are combined, their arguments
|
||||
may not be evaluated in left to right order: the printed intersection may
|
||||
be before or after the call to intersect.</div>
|
||||
be before or after the call to intersect.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
|
@ -39,7 +39,8 @@ enum <a href="#SkAlphaType">SkAlphaType</a> {
|
||||
<a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
|
||||
<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>,
|
||||
kLastEnum_SkAlphaType = <a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Describes how to interpret the alpha component of a pixel. A pixel may
|
||||
be opaque, or <a href="undocumented#Alpha">Color Alpha</a>, describing multiple levels of transparency.
|
||||
@ -47,7 +48,8 @@ be opaque, or <a href="undocumented#Alpha">Color Alpha</a>, describing multiple
|
||||
In simple blending, <a href="undocumented#Alpha">Color Alpha</a> weights the draw color and the destination
|
||||
color to create a new color. If alpha describes a weight from zero to one:
|
||||
|
||||
new color = draw color * alpha + destination color * (1 - alpha)In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
|
||||
new color = draw color * alpha + destination color * (1 - alpha)
|
||||
In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.
|
||||
|
||||
<a href="undocumented#RGB">Color RGB</a> may have <a href="undocumented#Alpha">Color Alpha</a> included in each component value; the stored
|
||||
value is the original <a href="undocumented#RGB">Color RGB</a> multiplied by <a href="undocumented#Alpha">Color Alpha</a>. <a href="undocumented#Premultiply">Premultiplied</a> color
|
||||
@ -57,21 +59,25 @@ components improve performance.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="kUnknown_SkAlphaType"> <code><strong>kUnknown_SkAlphaType </strong></code> </a></td><td>0</td><td><a href="#Alpha_Type">Alpha Type</a> is uninitialized.</td>
|
||||
<td><a name="kUnknown_SkAlphaType"> <code><strong>kUnknown_SkAlphaType </strong></code> </a></td><td>0</td><td><a href="#Alpha_Type">Alpha Type</a> is uninitialized.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kOpaque_SkAlphaType"> <code><strong>kOpaque_SkAlphaType </strong></code> </a></td><td>1</td><td>Pixels are opaque. The <a href="#Color_Type">Color Type</a> must have no explicit alpha
|
||||
component, or all alpha components must be set to their maximum value.</td>
|
||||
component, or all alpha components must be set to their maximum value.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kPremul_SkAlphaType"> <code><strong>kPremul_SkAlphaType </strong></code> </a></td><td>2</td><td>Pixels have alpha premultiplied into color components.
|
||||
<a href="SkSurface_Reference#Surface">Surface</a> pixels must be premultiplied.</td>
|
||||
<a href="SkSurface_Reference#Surface">Surface</a> pixels must be premultiplied.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kUnpremul_SkAlphaType"> <code><strong>kUnpremul_SkAlphaType </strong></code> </a></td><td>3</td><td><a href="undocumented#Pixel">Pixel</a> color component values are independent of alpha value.
|
||||
Images generated from encoded data like PNG do not premultiply pixel color
|
||||
components. <a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a> is supported for <a href="SkImage_Reference#Image">Image</a> pixels, but not for
|
||||
<a href="SkSurface_Reference#Surface">Surface</a> pixels.</td>
|
||||
<a href="SkSurface_Reference#Surface">Surface</a> pixels.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -95,7 +101,8 @@ as <a href="undocumented#Alpha">Color Alpha</a> of 1.0. <a href="#kOpaque_SkAlph
|
||||
If <a href="undocumented#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255,
|
||||
<a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a> must be used instead to avoid undefined results.
|
||||
The four displayed values are the original component values, though not necessarily
|
||||
in the same order.</div></fiddle-embed></div>
|
||||
in the same order.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Alpha_Type_Premul"></a> Alpha Type Premul
|
||||
|
||||
@ -113,7 +120,8 @@ interpreted as <a href="undocumented#Alpha">Color Alpha</a> of about 0.6. <a hre
|
||||
<a href="undocumented#SkPreMultiplyARGB">SkPreMultiplyARGB</a> parameter a is set to a value smaller than 255,
|
||||
to avoid undefined results.
|
||||
The four displayed values reflect that the alpha component has been multiplied
|
||||
by the original color.</div></fiddle-embed></div>
|
||||
by the original color.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Alpha_Type_Unpremul"></a> Alpha Type Unpremul
|
||||
|
||||
@ -126,10 +134,16 @@ Some drawing destinations may not support <a href="#Alpha_Type_Unpremul">Unpremu
|
||||
interpreted as <a href="undocumented#Alpha">Color Alpha</a> of about 0.6. color is not premultiplied;
|
||||
color components may have values greater than color alpha.
|
||||
The four displayed values are the original component values, though not necessarily
|
||||
in the same order.</div></fiddle-embed></div>
|
||||
in the same order.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Color_Type"></a> Color Type
|
||||
|
||||
<a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>
|
||||
|
||||
## <a name="Color_Type_Native"></a> Color Type Native
|
||||
|
||||
## <a name="SkColorType"></a> Enum SkColorType
|
||||
@ -150,7 +164,8 @@ enum <a href="#SkColorType">SkColorType</a> {
|
||||
kLastEnum_SkColorType = <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>,
|
||||
<a href="#kN32_SkColorType">kN32_SkColorType</a> = <a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="#kN32_SkColorType">kN32_SkColorType</a> = <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Describes how pixel bits encode color. A pixel may be an alpha mask, a
|
||||
gray level, <a href="undocumented#RGB">Color RGB</a>, or <a href="undocumented#ARGB">Color ARGB</a>.
|
||||
@ -167,34 +182,44 @@ processors, pixels containing 8-bit <a href="undocumented#ARGB">Color ARGB</a> c
|
||||
<td><a name="kUnknown_SkColorType"> <code><strong>kUnknown_SkColorType </strong></code> </a></td><td>0</td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kAlpha_8_SkColorType"> <code><strong>kAlpha_8_SkColorType </strong></code> </a></td><td>1</td><td>Encodes <a href="undocumented#Alpha">Color Alpha</a> as <a href="#Color_Type_Alpha_8">Alpha 8</a> pixel in an 8-bit byte.</td>
|
||||
<td><a name="kAlpha_8_SkColorType"> <code><strong>kAlpha_8_SkColorType </strong></code> </a></td><td>1</td><td>Encodes <a href="undocumented#Alpha">Color Alpha</a> as <a href="#Color_Type_Alpha_8">Alpha 8</a> pixel in an 8-bit byte.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRGB_565_SkColorType"> <code><strong>kRGB_565_SkColorType </strong></code> </a></td><td>2</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_BGR_565">BGR 565</a> pixel in a 16-bit word.</td>
|
||||
<td><a name="kRGB_565_SkColorType"> <code><strong>kRGB_565_SkColorType </strong></code> </a></td><td>2</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_BGR_565">BGR 565</a> pixel in a 16-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kARGB_4444_SkColorType"> <code><strong>kARGB_4444_SkColorType </strong></code> </a></td><td>3</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_ABGR_4444">ABGR 4444</a> pixel in a 16-bit word.</td>
|
||||
<td><a name="kARGB_4444_SkColorType"> <code><strong>kARGB_4444_SkColorType </strong></code> </a></td><td>3</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_ABGR_4444">ABGR 4444</a> pixel in a 16-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRGBA_8888_SkColorType"> <code><strong>kRGBA_8888_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_8888">RGBA 8888</a> pixel in a 32-bit word.</td>
|
||||
<td><a name="kRGBA_8888_SkColorType"> <code><strong>kRGBA_8888_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_8888">RGBA 8888</a> pixel in a 32-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRGB_888x_SkColorType"> <code><strong>kRGB_888x_SkColorType </strong></code> </a></td><td>5</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_RGB_888x">RGB 888x</a> pixel in a 32-bit word.</td>
|
||||
<td><a name="kRGB_888x_SkColorType"> <code><strong>kRGB_888x_SkColorType </strong></code> </a></td><td>5</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_RGB_888x">RGB 888x</a> pixel in a 32-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kBGRA_8888_SkColorType"> <code><strong>kBGRA_8888_SkColorType </strong></code> </a></td><td>6</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_BGRA_8888">BGRA 8888</a> pixel in a 32-bit word.</td>
|
||||
<td><a name="kBGRA_8888_SkColorType"> <code><strong>kBGRA_8888_SkColorType </strong></code> </a></td><td>6</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_BGRA_8888">BGRA 8888</a> pixel in a 32-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRGBA_1010102_SkColorType"> <code><strong>kRGBA_1010102_SkColorType </strong></code> </a></td><td>7</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_1010102">RGBA 1010102</a> pixel in a 32-bit word.</td>
|
||||
<td><a name="kRGBA_1010102_SkColorType"> <code><strong>kRGBA_1010102_SkColorType </strong></code> </a></td><td>7</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_1010102">RGBA 1010102</a> pixel in a 32-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRGB_101010x_SkColorType"> <code><strong>kRGB_101010x_SkColorType </strong></code> </a></td><td>8</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_RGB_101010x">RGB 101010x</a> pixel in a 32-bit word.</td>
|
||||
<td><a name="kRGB_101010x_SkColorType"> <code><strong>kRGB_101010x_SkColorType </strong></code> </a></td><td>8</td><td>Encodes <a href="undocumented#RGB">Color RGB</a> as <a href="#Color_Type_RGB_101010x">RGB 101010x</a> pixel in a 32-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kGray_8_SkColorType"> <code><strong>kGray_8_SkColorType </strong></code> </a></td><td>9</td><td>Encodes <a href="undocumented#Gray">Color Gray</a> as <a href="#Color_Type_Gray_8">Gray 8</a> in an 8-bit byte.</td>
|
||||
<td><a name="kGray_8_SkColorType"> <code><strong>kGray_8_SkColorType </strong></code> </a></td><td>9</td><td>Encodes <a href="undocumented#Gray">Color Gray</a> as <a href="#Color_Type_Gray_8">Gray 8</a> in an 8-bit byte.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRGBA_F16_SkColorType"> <code><strong>kRGBA_F16_SkColorType </strong></code> </a></td><td>10</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_F16">RGBA F16</a> in a 64-bit word.</td>
|
||||
<td><a name="kRGBA_F16_SkColorType"> <code><strong>kRGBA_F16_SkColorType </strong></code> </a></td><td>10</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as <a href="#Color_Type_RGBA_F16">RGBA F16</a> in a 64-bit word.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -203,7 +228,8 @@ processors, pixels containing 8-bit <a href="undocumented#ARGB">Color ARGB</a> c
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="kN32_SkColorType"> <code><strong>kN32_SkColorType </strong></code> </a></td><td>4</td><td>Encodes <a href="undocumented#ARGB">Color ARGB</a> as either <a href="#Color_Type_RGBA_8888">RGBA 8888</a> or <a href="#Color_Type_BGRA_8888">BGRA 8888</a>, whichever
|
||||
is native to the platform.</td>
|
||||
is native to the platform.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -223,7 +249,8 @@ The paired <a href="#SkAlphaType">SkAlphaType</a> is ignored.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="21ae21e4ce53d2018e042dd457997300"><div><a href="#Color_Type_Alpha_8">Alpha 8</a> pixels can modify another draw. orangePaint fills the bounds of bitmap,
|
||||
with its transparency set to alpha8 pixel value.</div></fiddle-embed></div>
|
||||
with its transparency set to alpha8 pixel value.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Color_Type_BGR_565"></a> Color Type BGR 565
|
||||
|
||||
@ -384,7 +411,8 @@ enum <a href="#SkYUVColorSpace">SkYUVColorSpace</a> {
|
||||
<a href="#kRec601_SkYUVColorSpace">kRec601_SkYUVColorSpace</a>,
|
||||
<a href="#kRec709_SkYUVColorSpace">kRec709_SkYUVColorSpace</a>,
|
||||
kLastEnum_SkYUVColorSpace = <a href="#kRec709_SkYUVColorSpace">kRec709_SkYUVColorSpace</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Describes the color space a YUV pixel.
|
||||
|
||||
@ -392,15 +420,18 @@ Describes the color space a YUV pixel.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="kJPEG_SkYUVColorSpace"> <code><strong>kJPEG_SkYUVColorSpace </strong></code> </a></td><td>0</td><td>Standard JPEG color space.</td>
|
||||
<td><a name="kJPEG_SkYUVColorSpace"> <code><strong>kJPEG_SkYUVColorSpace </strong></code> </a></td><td>0</td><td>Standard JPEG color space.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRec601_SkYUVColorSpace"> <code><strong>kRec601_SkYUVColorSpace </strong></code> </a></td><td>1</td><td>SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] color
|
||||
range. See http://en.wikipedia.org/wiki/Rec._601 for details.</td>
|
||||
range. See http://en.wikipedia.org/wiki/Rec._601 for details.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="kRec709_SkYUVColorSpace"> <code><strong>kRec709_SkYUVColorSpace </strong></code> </a></td><td>2</td><td>HDTV standard Rec. 709 color space. Uses "studio swing" [16, 235] color
|
||||
range. See http://en.wikipedia.org/wiki/Rec._709 for details.</td>
|
||||
range. See http://en.wikipedia.org/wiki/Rec._709 for details.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -420,7 +451,8 @@ incomplete
|
||||
enum class <a href="#SkDestinationSurfaceColorMode">SkDestinationSurfaceColorMode</a> {
|
||||
<a href="#SkDestinationSurfaceColorMode_kLegacy">kLegacy</a>,
|
||||
<a href="#SkDestinationSurfaceColorMode_kGammaAndColorSpaceAware">kGammaAndColorSpaceAware</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
@ -444,8 +476,14 @@ incomplete
|
||||
|
||||
|
||||
# <a name="SkImageInfo"></a> Struct SkImageInfo
|
||||
Describes <a href="SkImage_Reference#Image">Image</a> dimensions and pixel type.
|
||||
Used for both source images and render-targets (surfaces).
|
||||
Describes pixel dimensions and encoding. <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, <a href="SkImage_Reference#Image">Image</a>, PixMap, and <a href="SkSurface_Reference#Surface">Surface</a>
|
||||
can be created from <a href="#Image_Info">Image Info</a>. <a href="#Image_Info">Image Info</a> can be retrieved from <a href="SkBitmap_Reference#Bitmap">Bitmap</a> and
|
||||
<a href="SkPixmap_Reference#Pixmap">Pixmap</a>, but not from <a href="SkImage_Reference#Image">Image</a> and <a href="SkSurface_Reference#Surface">Surface</a>. For example, <a href="SkImage_Reference#Image">Image</a> and <a href="SkSurface_Reference#Surface">Surface</a>
|
||||
implementations may defer pixel depth, so may not completely specify <a href="#Image_Info">Image Info</a>.
|
||||
|
||||
<a href="#Image_Info">Image Info</a> contains dimensions, the pixel integral width and height. It encodes
|
||||
how pixel bits describe <a href="undocumented#Alpha">Color Alpha</a>, transparency; <a href="undocumented#Color">Color</a> components red, blue,
|
||||
and green; and <a href="undocumented#Color_Space">Color Space</a>, the range and linearity of colors.
|
||||
|
||||
## <a name="Member_Function"></a> Member Function
|
||||
|
||||
@ -469,7 +507,7 @@ Used for both source images and render-targets (surfaces).
|
||||
| <a href="#SkImageInfo_dimensions">dimensions</a> | incomplete |
|
||||
| <a href="#SkImageInfo_flatten">flatten</a> | incomplete |
|
||||
| <a href="#SkImageInfo_gammaCloseToSRGB">gammaCloseToSRGB</a> | incomplete |
|
||||
| <a href="#SkImageInfo_height">height</a> | incomplete |
|
||||
| <a href="#SkImageInfo_height">height</a> | returns pixel row count |
|
||||
| <a href="#SkImageInfo_isEmpty">isEmpty</a> | incomplete |
|
||||
| <a href="#SkImageInfo_isOpaque">isOpaque</a> | incomplete |
|
||||
| <a href="#SkImageInfo_makeAlphaType">makeAlphaType</a> | creates <a href="#Image_Info">Image Info</a> with changed <a href="#Alpha_Type">Alpha Type</a> |
|
||||
@ -484,7 +522,7 @@ Used for both source images and render-targets (surfaces).
|
||||
| <a href="#SkImageInfo_unflatten">unflatten</a> | incomplete |
|
||||
| <a href="#SkImageInfo_validRowBytes">validRowBytes</a> | incomplete |
|
||||
| <a href="#SkImageInfo_validate">validate</a> | incomplete |
|
||||
| <a href="#SkImageInfo_width">width</a> | incomplete |
|
||||
| <a href="#SkImageInfo_width">width</a> | returns pixel column count |
|
||||
|
||||
## <a name="Related_Function"></a> Related Function
|
||||
|
||||
@ -521,17 +559,22 @@ Used for both source images and render-targets (surfaces).
|
||||
SkImageInfo()
|
||||
</pre>
|
||||
|
||||
Creates an empty <a href="#Image_Info">Image Info</a> with <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>,
|
||||
a width and height of zero, and no <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
empty <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="20a156a9ca80ec081426b7e975383443"><div>An empty <a href="#Image_Info">Image Info</a> may be passed to <a href="SkCanvas_Reference#SkCanvas_accessTopLayerPixels">SkCanvas::accessTopLayerPixels</a> as storage
|
||||
for the <a href="SkCanvas_Reference#Canvas">Canvas</a> actual <a href="#Image_Info">Image Info</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_MakeA8">MakeA8</a>
|
||||
|
||||
---
|
||||
|
||||
@ -543,32 +586,45 @@ static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
|
||||
sk_sp<SkColorSpace> cs = nullptr)
|
||||
</pre>
|
||||
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#Color_Type">Color Type</a> <a href="#SkImageInfo_Make_ct">ct</a>,
|
||||
<a href="#Alpha_Type">Alpha Type</a> <a href="#SkImageInfo_Make_at">at</a>, and optionally <a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_Make_cs">cs</a>.
|
||||
|
||||
If <a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_Make_cs">cs</a> is nullptr and <a href="#Image_Info">Image Info</a> is part of drawing source: <a href="undocumented#Color_Space">Color Space</a>
|
||||
defaults to sRGB, mapping into <a href="SkSurface_Reference#Surface">Surface</a> <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_Make_width"> <code><strong>width </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel column count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_Make_height"> <code><strong>height </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel row count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_Make_ct"> <code><strong>ct </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_Make_at"> <code><strong>at </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
|
||||
<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_Make_cs"> <code><strong>cs </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
range of colors; may be nullptr</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="9f47f9c2a99473f5b1113db48096d586"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeN32Premul">MakeN32Premul</a><sup><a href="#SkImageInfo_MakeN32Premul_2">[2]</a></sup> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_MakeA8">MakeA8</a>
|
||||
|
||||
---
|
||||
|
||||
@ -579,32 +635,41 @@ incomplete
|
||||
static SkImageInfo MakeN32(int width, int height, SkAlphaType at, sk_sp<SkColorSpace> cs = nullptr)
|
||||
</pre>
|
||||
|
||||
Sets <a href="#Color_Type">Color Type</a> to <a href="#kN32_SkColorType">kN32_SkColorType</a>.
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#kN32_SkColorType">kN32_SkColorType</a>,
|
||||
<a href="#Alpha_Type">Alpha Type</a> <a href="#SkImageInfo_MakeN32_at">at</a>, and optionally <a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_MakeN32_cs">cs</a>. <a href="#kN32_SkColorType">kN32_SkColorType</a> will equal either
|
||||
<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a> or <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, whichever is optimal.
|
||||
|
||||
If <a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_MakeN32_cs">cs</a> is nullptr and <a href="#Image_Info">Image Info</a> is part of drawing source: <a href="undocumented#Color_Space">Color Space</a>
|
||||
defaults to sRGB, mapping into <a href="SkSurface_Reference#Surface">Surface</a> <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_MakeN32_width"> <code><strong>width </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel column count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeN32_height"> <code><strong>height </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel row count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeN32_at"> <code><strong>at </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
|
||||
<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeN32_cs"> <code><strong>cs </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
range of colors; may be nullptr</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="78cea0c4cac205b61ad6f6c982cbd888"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_MakeN32Premul">MakeN32Premul</a><sup><a href="#SkImageInfo_MakeN32Premul_2">[2]</a></sup> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_MakeA8">MakeA8</a>
|
||||
|
||||
---
|
||||
|
||||
@ -615,30 +680,40 @@ incomplete
|
||||
static SkImageInfo MakeS32(int width, int height, SkAlphaType at)
|
||||
</pre>
|
||||
|
||||
Creates <a href="#Image_Info">Image Info</a> marked as sRGB with <a href="#kN32_SkColorType">kN32_SkColorType</a> swizzle.
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#kN32_SkColorType">kN32_SkColorType</a>,
|
||||
<a href="#Alpha_Type">Alpha Type</a> <a href="#SkImageInfo_MakeS32_at">at</a>, with sRGB <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_MakeS32_width"> <code><strong>width </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel column count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeS32_height"> <code><strong>height </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel row count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeS32_at"> <code><strong>at </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
one of: <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>,
|
||||
<a href="#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="bb85fc8a82fe772e1d611f3ab8770a1d"><div>Top gradient is drawn to offscreen without <a href="undocumented#Color_Space">Color Space</a>. It is darker than middle
|
||||
gradient, drawn to offscreen with sRGB <a href="undocumented#Color_Space">Color Space</a>. Bottom gradient shares bits
|
||||
with middle, but does not specify the <a href="undocumented#Color_Space">Color Space</a> in noColorSpaceBitmap. A source
|
||||
without <a href="undocumented#Color_Space">Color Space</a> is treated as sRGB; the bottom gradient is identical to the
|
||||
middle gradient.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_Make">Make</a> <a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeN32Premul">MakeN32Premul</a><sup><a href="#SkImageInfo_MakeN32Premul_2">[2]</a></sup> <a href="#SkImageInfo_MakeA8">MakeA8</a>
|
||||
|
||||
---
|
||||
|
||||
@ -649,30 +724,37 @@ incomplete
|
||||
static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs = nullptr)
|
||||
</pre>
|
||||
|
||||
Sets <a href="#Color_Type">Color Type</a> to <a href="#kN32_SkColorType">kN32_SkColorType</a>, and the <a href="#Alpha_Type">Alpha Type</a> to <a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>.
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#kN32_SkColorType">kN32_SkColorType</a>,
|
||||
<a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, with optional <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
If <a href="undocumented#Color_Space">Color Space</a> <a href="#SkImageInfo_MakeN32Premul_cs">cs</a> is nullptr and <a href="#Image_Info">Image Info</a> is part of drawing source: <a href="undocumented#Color_Space">Color Space</a>
|
||||
defaults to sRGB, mapping into <a href="SkSurface_Reference#Surface">Surface</a> <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_MakeN32Premul_width"> <code><strong>width </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel column count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeN32Premul_height"> <code><strong>height </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel row count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeN32Premul_cs"> <code><strong>cs </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
range of colors; may be nullptr</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="077084c05471d6bbd54338d92ea799e3"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_MakeA8">MakeA8</a> <a href="#SkImageInfo_Make">Make</a>
|
||||
|
||||
---
|
||||
|
||||
@ -682,24 +764,33 @@ incomplete
|
||||
static SkImageInfo MakeN32Premul(const SkISize& size)
|
||||
</pre>
|
||||
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#kN32_SkColorType">kN32_SkColorType</a>,
|
||||
<a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, with <a href="undocumented#Color_Space">Color Space</a> set to nullptr.
|
||||
|
||||
If <a href="#Image_Info">Image Info</a> is part of drawing source: <a href="undocumented#Color_Space">Color Space</a> defaults to sRGB, mapping
|
||||
into <a href="SkSurface_Reference#Surface">Surface</a> <a href="undocumented#Color_Space">Color Space</a>.
|
||||
|
||||
Parameters are not validated to see if their values are legal, or that the
|
||||
combination is supported.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_MakeN32Premul_2_size"> <code><strong>size </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
width and height, each must be zero or greater</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="897f42eb3b27d749ec792435fb389a07"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_MakeA8">MakeA8</a> <a href="#SkImageInfo_Make">Make</a>
|
||||
|
||||
---
|
||||
|
||||
@ -710,18 +801,21 @@ incomplete
|
||||
static SkImageInfo MakeA8(int width, int height)
|
||||
</pre>
|
||||
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, with <a href="undocumented#Color_Space">Color Space</a> set to nullptr.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_MakeA8_width"> <code><strong>width </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel column count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeA8_height"> <code><strong>height </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel row count; must be zero or greater</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
@ -729,7 +823,7 @@ incomplete
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_Make">Make</a>
|
||||
|
||||
---
|
||||
|
||||
@ -740,26 +834,32 @@ incomplete
|
||||
static SkImageInfo MakeUnknown(int width, int height)
|
||||
</pre>
|
||||
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height, <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>,
|
||||
<a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, with <a href="undocumented#Color_Space">Color Space</a> set to nullptr.
|
||||
|
||||
Returned <a href="#Image_Info">Image Info</a> as part of source does not draw, and as part of destination
|
||||
can not be drawn to.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImageInfo_MakeUnknown_width"> <code><strong>width </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel column count; must be zero or greater</td>
|
||||
</tr> <tr> <td><a name="SkImageInfo_MakeUnknown_height"> <code><strong>height </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
pixel row count; must be zero or greater</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="75f13a78b28b08c72baf32b7d868de1c"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_empty_constructor">SkImageInfo()</a> <a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_Make">Make</a>
|
||||
|
||||
---
|
||||
|
||||
@ -769,17 +869,23 @@ incomplete
|
||||
static SkImageInfo MakeUnknown()
|
||||
</pre>
|
||||
|
||||
Creates <a href="#Image_Info">Image Info</a> from integral dimensions width and height set to zero,
|
||||
<a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, with <a href="undocumented#Color_Space">Color Space</a> set to nullptr.
|
||||
|
||||
Returned <a href="#Image_Info">Image Info</a> as part of source does not draw, and as part of destination
|
||||
can not be drawn to.
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
created <a href="#Image_Info">Image Info</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="a1af7696ae0cdd6f379546dd1f211b7a"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_empty_constructor">SkImageInfo()</a> <a href="#SkImageInfo_MakeN32">MakeN32</a> <a href="#SkImageInfo_MakeS32">MakeS32</a> <a href="#SkImageInfo_Make">Make</a>
|
||||
|
||||
---
|
||||
|
||||
@ -794,14 +900,14 @@ incomplete
|
||||
| <a href="#SkImageInfo_colorType">colorType</a> | incomplete |
|
||||
| <a href="#SkImageInfo_dimensions">dimensions</a> | incomplete |
|
||||
| <a href="#SkImageInfo_gammaCloseToSRGB">gammaCloseToSRGB</a> | incomplete |
|
||||
| <a href="#SkImageInfo_height">height</a> | incomplete |
|
||||
| <a href="#SkImageInfo_height">height</a> | returns pixel row count |
|
||||
| <a href="#SkImageInfo_isEmpty">isEmpty</a> | incomplete |
|
||||
| <a href="#SkImageInfo_isOpaque">isOpaque</a> | incomplete |
|
||||
| <a href="#SkImageInfo_minRowBytes">minRowBytes</a> | incomplete |
|
||||
| <a href="#SkImageInfo_minRowBytes64">minRowBytes64</a> | incomplete |
|
||||
| <a href="#SkImageInfo_refColorSpace">refColorSpace</a> | incomplete |
|
||||
| <a href="#SkImageInfo_shiftPerPixel">shiftPerPixel</a> | incomplete |
|
||||
| <a href="#SkImageInfo_width">width</a> | incomplete |
|
||||
| <a href="#SkImageInfo_width">width</a> | returns pixel column count |
|
||||
|
||||
<a name="SkImageInfo_width"></a>
|
||||
## width
|
||||
@ -810,17 +916,19 @@ incomplete
|
||||
int width() const
|
||||
</pre>
|
||||
|
||||
Returns pixel count in each row.
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
pixel width
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="588a0a763d78c1b3b3ea0b2a6e39fda6"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_height">height</a> <a href="SkBitmap_Reference#SkBitmap_width">SkBitmap::width</a> <a href="undocumented#SkPixelRef_width">SkPixelRef::width</a> <a href="SkImage_Reference#SkImage_width">SkImage::width</a> <a href="SkSurface_Reference#SkSurface_width">SkSurface::width</a>
|
||||
|
||||
---
|
||||
|
||||
@ -831,17 +939,19 @@ incomplete
|
||||
int height() const
|
||||
</pre>
|
||||
|
||||
Returns pixel row count.
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
pixel height
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="1719751fef7fd6040447619d4e66d416"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImageInfo_width">width</a> <a href="SkBitmap_Reference#SkBitmap_height">SkBitmap::height</a> <a href="undocumented#SkPixelRef_height">SkPixelRef::height</a> <a href="SkImage_Reference#SkImage_height">SkImage::height</a> <a href="SkSurface_Reference#SkSurface_height">SkSurface::height</a>
|
||||
|
||||
---
|
||||
|
||||
@ -852,9 +962,14 @@ incomplete
|
||||
SkColorType colorType() const
|
||||
</pre>
|
||||
|
||||
Returns <a href="#Color_Type">Color Type</a>, one of: <a href="#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>.
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
<a href="#Color_Type">Color Type</a>
|
||||
|
||||
### Example
|
||||
|
||||
|
@ -180,7 +180,8 @@ copy of <a href="SkPixmap_Reference#Pixmap">Pixmap</a> pixels, or nullptr
|
||||
|
||||
<div><fiddle-embed name="513afec5795a9504ebf6af5373d16b6b"><div>Draw a five by five bitmap, and draw a copy in an <a href="#Image">Image</a>. Editing the <a href="#SkImage_MakeRasterCopy_pixmap">pixmap</a>
|
||||
alters the bitmap draw, but does not alter the <a href="#Image">Image</a> draw since the <a href="#Image">Image</a>
|
||||
contains a copy of the pixels.</div></fiddle-embed></div>
|
||||
contains a copy of the pixels.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -333,7 +334,8 @@ created <a href="#Image">Image</a>, or nullptr
|
||||
<div><fiddle-embed name="cf2cf53321e4e6a77c2841bfbc0ef707"><div>The first <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is shared; writing to the pixel memory changes the first
|
||||
<a href="#Image">Image</a>.
|
||||
The second <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is marked immutable, and is copied; writing to the pixel
|
||||
memory does not alter the second <a href="#Image">Image</a>.</div></fiddle-embed></div>
|
||||
memory does not alter the second <a href="#Image">Image</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -375,7 +377,8 @@ created <a href="#Image">Image</a>, or nullptr
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="c2fec0746f88ca34d7dce59dd9bdef9e"><div>The generator returning <a href="undocumented#Picture">Picture</a> cannot be shared; std::move transfers ownership to generated <a href="#Image">Image</a>.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="c2fec0746f88ca34d7dce59dd9bdef9e"><div>The generator returning <a href="undocumented#Picture">Picture</a> cannot be shared; std::move transfers ownership to generated <a href="#Image">Image</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -466,10 +469,10 @@ texture residing on GPU</td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromTexture_3_origin"> <code><strong>origin </strong></code> </a></td> <td>
|
||||
one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromTexture_3_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a></td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromTexture_3_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
|
||||
<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
|
||||
@ -484,7 +487,8 @@ created <a href="#Image">Image</a>, or nullptr
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="fdc498de45b53569743ec13012bf476c" gpu="true"><div>A back-end texture has been created and uploaded to the GPU outside of this example.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="fdc498de45b53569743ec13012bf476c" gpu="true"><div>A back-end texture has been created and uploaded to the GPU outside of this example.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -518,10 +522,10 @@ texture residing on GPU</td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromTexture_4_origin"> <code><strong>origin </strong></code> </a></td> <td>
|
||||
one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromTexture_4_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a></td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromTexture_4_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
|
||||
<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
|
||||
@ -692,10 +696,10 @@ texture residing on GPU</td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_surfaceOrigin"> <code><strong>surfaceOrigin </strong></code> </a></td> <td>
|
||||
one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a></td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkImage_MakeFromAdoptedTexture_2_alphaType"> <code><strong>alphaType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkAlphaType">kUnknown_SkAlphaType</a>, <a href="SkImageInfo_Reference#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>,
|
||||
<a href="SkImageInfo_Reference#kPremul_SkAlphaType">kPremul_SkAlphaType</a>, <a href="SkImageInfo_Reference#kUnpremul_SkAlphaType">kUnpremul_SkAlphaType</a></td>
|
||||
@ -906,16 +910,19 @@ created <a href="#Image">Image</a>, or nullptr
|
||||
enum class <a href="#SkImage_BitDepth">BitDepth</a> {
|
||||
<a href="#SkImage_BitDepth_kU8">kU8</a>,
|
||||
<a href="#SkImage_BitDepth_kF16">kF16</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkImage_BitDepth_kU8"> <code><strong>SkImage::BitDepth::kU8 </strong></code> </a></td><td>0</td><td>Use 8 bits per <a href="undocumented#ARGB">Color ARGB</a> component using unsigned integer format.</td>
|
||||
<td><a name="SkImage_BitDepth_kU8"> <code><strong>SkImage::BitDepth::kU8 </strong></code> </a></td><td>0</td><td>Use 8 bits per <a href="undocumented#ARGB">Color ARGB</a> component using unsigned integer format.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkImage_BitDepth_kF16"> <code><strong>SkImage::BitDepth::kF16 </strong></code> </a></td><td>1</td><td>Use 16 bits per <a href="undocumented#ARGB">Color ARGB</a> component using half-precision floating point format.</td>
|
||||
<td><a name="SkImage_BitDepth_kF16"> <code><strong>SkImage::BitDepth::kF16 </strong></code> </a></td><td>1</td><td>Use 16 bits per <a href="undocumented#ARGB">Color ARGB</a> component using half-precision floating point format.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1539,7 +1546,8 @@ back-end API texture handle, or nullptr
|
||||
enum <a href="#SkImage_CachingHint">CachingHint</a> {
|
||||
<a href="#SkImage_kAllow_CachingHint">kAllow CachingHint</a>,
|
||||
<a href="#SkImage_kDisallow_CachingHint">kDisallow CachingHint</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkImage_CachingHint">CachingHint</a> selects whether Skia may internally cache <a href="SkBitmap_Reference#Bitmap">Bitmaps</a> generated by
|
||||
decoding <a href="#Image">Image</a>, or by copying <a href="#Image">Image</a> from GPU to CPU. The default behavior
|
||||
@ -1556,10 +1564,12 @@ pixels are not accessible.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkImage_kAllow_CachingHint"> <code><strong>SkImage::kAllow_CachingHint </strong></code> </a></td><td>0</td><td>Allows Skia to internally cache decoded and copied pixels.</td>
|
||||
<td><a name="SkImage_kAllow_CachingHint"> <code><strong>SkImage::kAllow_CachingHint </strong></code> </a></td><td>0</td><td>Allows Skia to internally cache decoded and copied pixels.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkImage_kDisallow_CachingHint"> <code><strong>SkImage::kDisallow_CachingHint </strong></code> </a></td><td>1</td><td>Disallows Skia from internally caching decoded and copied pixels.</td>
|
||||
<td><a name="SkImage_kDisallow_CachingHint"> <code><strong>SkImage::kDisallow_CachingHint </strong></code> </a></td><td>1</td><td>Disallows Skia from internally caching decoded and copied pixels.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -2064,7 +2074,8 @@ filtered <a href="#Image">Image</a>, or nullptr
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="eabb12543886ace5e1212af220a19c6d" gpu="true"><div>In each frame of the animation, filtered <a href="#Image">Image</a> is drawn in a different location.
|
||||
By translating canvas by returned <a href="#SkImage_makeWithFilter_offset">offset</a>, <a href="#Image">Image</a> appears stationary.</div></fiddle-embed></div>
|
||||
By translating canvas by returned <a href="#SkImage_makeWithFilter_offset">offset</a>, <a href="#Image">Image</a> appears stationary.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2132,13 +2143,15 @@ soon
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
enum <a href="#SkImage_LegacyBitmapMode">LegacyBitmapMode</a> {
|
||||
<a href="#SkImage_kRO_LegacyBitmapMode">kRO LegacyBitmapMode</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkImage_kRO_LegacyBitmapMode"> <code><strong>SkImage::kRO_LegacyBitmapMode </strong></code> </a></td><td>0</td><td>Returned bitmap is read-only and immutable.</td>
|
||||
<td><a name="SkImage_kRO_LegacyBitmapMode"> <code><strong>SkImage::kRO_LegacyBitmapMode </strong></code> </a></td><td>0</td><td>Returned bitmap is read-only and immutable.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -669,7 +669,8 @@ enum <a href="#Hinting">Hinting</a> {
|
||||
<a href="#SkPaint_kSlight_Hinting">kSlight Hinting</a> = 1,
|
||||
<a href="#SkPaint_kNormal_Hinting">kNormal Hinting</a> = 2,
|
||||
<a href="#SkPaint_kFull_Hinting">kFull Hinting</a> = 3,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#Hinting">Hinting</a> adjusts the glyph outlines so that the shape provides a uniform
|
||||
look at a given point size on font engines that support it. <a href="#Hinting">Hinting</a> may have a
|
||||
@ -686,27 +687,31 @@ as the <a href="undocumented#Engine">Font Engine</a>.
|
||||
With FreeType, this is equivalent to the FT_LOAD_NO_HINTING
|
||||
bit-field constant supplied to FT_Load_Glyph, which indicates that the vector
|
||||
outline being loaded should not be fitted to the pixel grid but simply scaled
|
||||
to 26.6 fractional pixels.</td>
|
||||
to 26.6 fractional pixels.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kSlight_Hinting"> <code><strong>SkPaint::kSlight_Hinting </strong></code> </a></td><td>1</td><td>Modifies glyph outlines minimally to improve constrast.
|
||||
With FreeType, this is equivalent in spirit to the
|
||||
FT_LOAD_TARGET_LIGHT value supplied to FT_Load_Glyph. It chooses a
|
||||
lighter hinting algorithm for non-monochrome modes.
|
||||
Generated <a href="undocumented#Glyph">Glyphs</a> may be fuzzy but better resemble their original shape.</td>
|
||||
Generated <a href="undocumented#Glyph">Glyphs</a> may be fuzzy but better resemble their original shape.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kNormal_Hinting"> <code><strong>SkPaint::kNormal_Hinting </strong></code> </a></td><td>2</td><td>Modifies glyph outlines to improve constrast. This is the default.
|
||||
With FreeType, this supplies FT_LOAD_TARGET_NORMAL to FT_Load_Glyph,
|
||||
choosing the default hinting algorithm, which is optimized for standard
|
||||
gray-level rendering.</td>
|
||||
gray-level rendering.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kFull_Hinting"> <code><strong>SkPaint::kFull_Hinting </strong></code> </a></td><td>3</td><td>Modifies glyph outlines for maxiumum constrast. With FreeType, this selects
|
||||
FT_LOAD_TARGET_LCD or FT_LOAD_TARGET_LCD_V if <a href="#SkPaint_kLCDRenderText_Flag">kLCDRenderText Flag</a> is set.
|
||||
FT_LOAD_TARGET_LCD is a variant of FT_LOAD_TARGET_NORMAL optimized for
|
||||
horizontally decimated LCD displays; FT_LOAD_TARGET_LCD_V is a
|
||||
variant of FT_LOAD_TARGET_NORMAL optimized for vertically decimated LCD displays.</td>
|
||||
variant of FT_LOAD_TARGET_NORMAL optimized for vertically decimated LCD displays.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -802,6 +807,7 @@ enum <a href="#Flags">Flags</a> {
|
||||
|
||||
<a href="#SkPaint_kAllFlags">kAllFlags</a> = 0xFFFF,
|
||||
};
|
||||
|
||||
</pre>
|
||||
|
||||
The bit values stored in <a href="#Flags">Flags</a>.
|
||||
@ -861,7 +867,8 @@ soonOnly valid for Android framework.
|
||||
enum <a href="#SkPaint_ReserveFlags">ReserveFlags</a> {
|
||||
<a href="#SkPaint_kUnderlineText_ReserveFlag">kUnderlineText ReserveFlag</a> = 0x08,
|
||||
<a href="#SkPaint_kStrikeThruText_ReserveFlag">kStrikeThruText ReserveFlag</a> = 0x10,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
@ -962,7 +969,8 @@ at compile time.
|
||||
<div><fiddle-embed name="a6575a49467ce8d28bb01cc7638fa04d"><div>A red line is drawn with transparency on the edges to make it look smoother.
|
||||
A blue line draws only where the pixel centers are contained.
|
||||
The lines are drawn into <a href="SkBitmap_Reference#Bitmap">Bitmap</a>, then drawn magnified to make the
|
||||
<a href="undocumented#Alias">Aliasing</a> easier to see.</div></fiddle-embed></div>
|
||||
<a href="undocumented#Alias">Aliasing</a> easier to see.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_isAntiAlias"></a>
|
||||
## isAntiAlias
|
||||
@ -1050,13 +1058,15 @@ Some platform implementations may ignore dithering. Setto ignore <a href="#Dithe
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="8b26507690b71462f44642b911890bbf"><div>Dithering in the bottom half more closely approximates the requested color by
|
||||
alternating nearby colors from pixel to pixel.</div></fiddle-embed></div>
|
||||
alternating nearby colors from pixel to pixel.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="76d4d4a7931a48495e4d5f54e073be53"><div>Dithering introduces subtle adjustments to color to smooth gradients.
|
||||
Drawing the gradient repeatedly with <a href="undocumented#SkBlendMode_kPlus">SkBlendMode::kPlus</a> exaggerates the
|
||||
dither, making it easier to see.</div></fiddle-embed></div>
|
||||
dither, making it easier to see.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_isDither"></a>
|
||||
## isDither
|
||||
@ -1151,7 +1161,8 @@ Either or both techniques can be enabled.
|
||||
|
||||
<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href="#LCD_Text">LCD Text</a> and <a href="#Subpixel_Text">Subpixel Text</a>.
|
||||
When <a href="#Subpixel_Text">Subpixel Text</a> is disabled, the comma <a href="undocumented#Glyph">Glyphs</a> are identical, but not evenly spaced.
|
||||
When <a href="#Subpixel_Text">Subpixel Text</a> is enabled, the comma <a href="undocumented#Glyph">Glyphs</a> are unique, but appear evenly spaced.</div></fiddle-embed></div>
|
||||
When <a href="#Subpixel_Text">Subpixel Text</a> is enabled, the comma <a href="undocumented#Glyph">Glyphs</a> are unique, but appear evenly spaced.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Linear_Text"></a> Linear Text
|
||||
|
||||
@ -1372,7 +1383,7 @@ Windows may select the bitmap glyph but is not required to do so.
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {<div>The "hintgasp" TrueType font in the Skia resources/fonts directory
|
||||
<div>The "hintgasp" TrueType font in the Skia resources/fonts directory
|
||||
includes an embedded bitmap Glyph at odd font sizes. This example works
|
||||
on platforms that use FreeType as their Font_Engine.
|
||||
Windows may, but is not required to, return a bitmap glyph if
|
||||
@ -1391,7 +1402,7 @@ void draw(SkCanvas* canvas) {<div>The "hintgasp" TrueType font in the Skia resou
|
||||
canvas->drawBitmap(bitmap, 0, 0);
|
||||
canvas->scale(10, 10);
|
||||
canvas->drawBitmap(bitmap, -2, 1);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
<a name="SkPaint_isEmbeddedBitmapText"></a>
|
||||
@ -2110,7 +2121,8 @@ enum <a href="#SkPaint_Style">Style</a> {
|
||||
<a href="#SkPaint_kFill_Style">kFill Style</a>,
|
||||
<a href="#SkPaint_kStroke_Style">kStroke Style</a>,
|
||||
<a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Set <a href="#SkPaint_Style">Style</a> to fill, stroke, or both fill and stroke geometry.
|
||||
The stroke and fill
|
||||
@ -2129,20 +2141,23 @@ Applies to <a href="SkRect_Reference#Rect">Rect</a>, <a href="undocumented#Regio
|
||||
<a href="#SkPaint_kFill_Style">kFill Style</a> is set, and ignore the set <a href="#SkPaint_Style">Style</a>.
|
||||
The <a href="SkPath_Reference#Fill_Type">Path Fill Type</a> specifies additional rules to fill the area outside the path edge,
|
||||
and to create an unfilled hole inside the shape.
|
||||
<a href="#SkPaint_Style">Style</a> is set to <a href="#SkPaint_kFill_Style">kFill Style</a> by default.</td>
|
||||
<a href="#SkPaint_Style">Style</a> is set to <a href="#SkPaint_kFill_Style">kFill Style</a> by default.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kStroke_Style"> <code><strong>SkPaint::kStroke_Style </strong></code> </a></td><td>1</td><td>Set to stroke geometry.
|
||||
Applies to <a href="SkRect_Reference#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="undocumented#Arc">Arcs</a>, <a href="undocumented#Circle">Circles</a>, <a href="undocumented#Oval">Ovals</a>, <a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</a>.
|
||||
<a href="undocumented#Arc">Arcs</a>, <a href="undocumented#Line">Lines</a>, and points, are always drawn as if <a href="#SkPaint_kStroke_Style">kStroke Style</a> is set,
|
||||
and ignore the set <a href="#SkPaint_Style">Style</a>.
|
||||
The stroke construction is unaffected by the <a href="SkPath_Reference#Fill_Type">Path Fill Type</a>.</td>
|
||||
The stroke construction is unaffected by the <a href="SkPath_Reference#Fill_Type">Path Fill Type</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kStrokeAndFill_Style"> <code><strong>SkPaint::kStrokeAndFill_Style </strong></code> </a></td><td>2</td><td>Set to stroke and fill geometry.
|
||||
Applies to <a href="SkRect_Reference#Rect">Rect</a>, <a href="undocumented#Region">Region</a>, <a href="undocumented#Round_Rect">Round Rect</a>, <a href="undocumented#Circle">Circles</a>, <a href="undocumented#Oval">Ovals</a>, <a href="SkPath_Reference#Path">Path</a>, and <a href="undocumented#Text">Text</a>.
|
||||
<a href="SkPath_Reference#Path">Path</a> is treated as if it is set to <a href="SkPath_Reference#SkPath_kWinding_FillType">SkPath::kWinding FillType</a>,
|
||||
and the set <a href="SkPath_Reference#Fill_Type">Path Fill Type</a> is ignored.</td>
|
||||
and the set <a href="SkPath_Reference#Fill_Type">Path Fill Type</a> is ignored.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -2152,14 +2167,16 @@ and the set <a href="SkPath_Reference#Fill_Type">Path Fill Type</a> is ignored.<
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
enum {
|
||||
<a href="#SkPaint_kStyleCount">kStyleCount</a> = <a href="#SkPaint_kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kStyleCount"> <code><strong>SkPaint::kStyleCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#SkPaint_Style">Style</a> values defined.
|
||||
May be used to verify that <a href="#SkPaint_Style">Style</a> is a legal value.</td>
|
||||
May be used to verify that <a href="#SkPaint_Style">Style</a> is a legal value.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -2244,7 +2261,8 @@ The default width for the paint is zero.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="01e3e08a3022a351628ff54e84887756" gpu="true"><div>The pixels hit to represent thin lines vary with the angle of the
|
||||
line and the platform implementation.</div></fiddle-embed></div>
|
||||
line and the platform implementation.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_getStrokeWidth"></a>
|
||||
## getStrokeWidth
|
||||
@ -2343,7 +2361,8 @@ Here are some miter limits and the angles that triggers them.
|
||||
|
||||
<div><fiddle-embed name="5de2de0f00354e59074a9bb1a42d5a63"><div>This example draws a stroked corner and the miter length beneath.
|
||||
When the miter limit is decreased slightly, the miter join is replaced
|
||||
by a bevel join.</div></fiddle-embed></div>
|
||||
by a bevel join.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_getStrokeMiter"></a>
|
||||
## getStrokeMiter
|
||||
@ -2426,7 +2445,8 @@ enum <a href="#SkPaint_Cap">Cap</a> {
|
||||
<a href="#SkPaint_kDefault_Cap">kDefault Cap</a> = <a href="#SkPaint_kButt_Cap">kButt Cap</a>,
|
||||
};
|
||||
|
||||
static constexpr int <a href="#SkPaint_kCapCount">kCapCount</a> = <a href="#SkPaint_kLast_Cap">kLast Cap</a> + 1;</pre>
|
||||
static constexpr int <a href="#SkPaint_kCapCount">kCapCount</a> = <a href="#SkPaint_kLast_Cap">kLast Cap</a> + 1;
|
||||
</pre>
|
||||
|
||||
<a href="#Stroke_Cap">Stroke Cap</a> draws at the beginning and end of an open <a href="SkPath_Reference#Contour">Path Contour</a>.
|
||||
|
||||
@ -2434,27 +2454,33 @@ static constexpr int <a href="#SkPaint_kCapCount">kCapCount</a> = <a href="#SkPa
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kButt_Cap"> <code><strong>SkPaint::kButt_Cap </strong></code> </a></td><td>0</td><td>Does not extend the stroke past the beginning or the end.</td>
|
||||
<td><a name="SkPaint_kButt_Cap"> <code><strong>SkPaint::kButt_Cap </strong></code> </a></td><td>0</td><td>Does not extend the stroke past the beginning or the end.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kRound_Cap"> <code><strong>SkPaint::kRound_Cap </strong></code> </a></td><td>1</td><td>Adds a circle with a diameter equal to <a href="#Stroke_Width">Stroke Width</a> at the beginning
|
||||
and end.</td>
|
||||
and end.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kSquare_Cap"> <code><strong>SkPaint::kSquare_Cap </strong></code> </a></td><td>2</td><td>Adds a square with sides equal to <a href="#Stroke_Width">Stroke Width</a> at the beginning
|
||||
and end. The square sides are parallel to the initial and final direction
|
||||
of the stroke.</td>
|
||||
of the stroke.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kLast_Cap"> <code><strong>SkPaint::kLast_Cap </strong></code> </a></td><td>2</td><td>Equivalent to the largest value for <a href="#Stroke_Cap">Stroke Cap</a>.</td>
|
||||
<td><a name="SkPaint_kLast_Cap"> <code><strong>SkPaint::kLast_Cap </strong></code> </a></td><td>2</td><td>Equivalent to the largest value for <a href="#Stroke_Cap">Stroke Cap</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kDefault_Cap"> <code><strong>SkPaint::kDefault_Cap </strong></code> </a></td><td>0</td><td>Equivalent to <a href="#SkPaint_kButt_Cap">kButt Cap</a>.
|
||||
<a href="#Stroke_Cap">Stroke Cap</a> is set to <a href="#SkPaint_kButt_Cap">kButt Cap</a> by default.</td>
|
||||
<a href="#Stroke_Cap">Stroke Cap</a> is set to <a href="#SkPaint_kButt_Cap">kButt Cap</a> by default.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kCapCount"> <code><strong>SkPaint::kCapCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#Stroke_Cap">Stroke Cap</a> values defined.
|
||||
May be used to verify that <a href="#Stroke_Cap">Stroke Cap</a> is a legal value.</td>
|
||||
May be used to verify that <a href="#Stroke_Cap">Stroke Cap</a> is a legal value.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Stroke describes the area covered by a pen of <a href="#Stroke_Width">Stroke Width</a> as it
|
||||
@ -2572,7 +2598,8 @@ enum <a href="#SkPaint_Join">Join</a> {
|
||||
<a href="#SkPaint_kDefault_Join">kDefault Join</a> = <a href="#SkPaint_kMiter_Join">kMiter Join</a>,
|
||||
};
|
||||
|
||||
static constexpr int <a href="#SkPaint_kJoinCount">kJoinCount</a> = <a href="#SkPaint_kLast_Join">kLast Join</a> + 1;</pre>
|
||||
static constexpr int <a href="#SkPaint_kJoinCount">kJoinCount</a> = <a href="#SkPaint_kLast_Join">kLast Join</a> + 1;
|
||||
</pre>
|
||||
|
||||
<a href="#SkPaint_Join">Join</a> specifies how corners are drawn when a shape is stroked. <a href="#SkPaint_Join">Join</a>
|
||||
affects the four corners of a stroked rectangle, and the connected segments in a
|
||||
@ -2591,24 +2618,30 @@ not necessarily include circles at each connected segment.
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kMiter_Join"> <code><strong>SkPaint::kMiter_Join </strong></code> </a></td><td>0</td><td>Extends the outside corner to the extent allowed by <a href="#Miter_Limit">Miter Limit</a>.
|
||||
If the extension exceeds <a href="#Miter_Limit">Miter Limit</a>, <a href="#SkPaint_kBevel_Join">kBevel Join</a> is used instead.</td>
|
||||
If the extension exceeds <a href="#Miter_Limit">Miter Limit</a>, <a href="#SkPaint_kBevel_Join">kBevel Join</a> is used instead.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kRound_Join"> <code><strong>SkPaint::kRound_Join </strong></code> </a></td><td>1</td><td>Adds a circle with a diameter of <a href="#Stroke_Width">Stroke Width</a> at the sharp corner.</td>
|
||||
<td><a name="SkPaint_kRound_Join"> <code><strong>SkPaint::kRound_Join </strong></code> </a></td><td>1</td><td>Adds a circle with a diameter of <a href="#Stroke_Width">Stroke Width</a> at the sharp corner.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kBevel_Join"> <code><strong>SkPaint::kBevel_Join </strong></code> </a></td><td>2</td><td>Connects the outside edges of the sharp corner.</td>
|
||||
<td><a name="SkPaint_kBevel_Join"> <code><strong>SkPaint::kBevel_Join </strong></code> </a></td><td>2</td><td>Connects the outside edges of the sharp corner.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kLast_Join"> <code><strong>SkPaint::kLast_Join </strong></code> </a></td><td>2</td><td>Equivalent to the largest value for <a href="#Stroke_Join">Stroke Join</a>.</td>
|
||||
<td><a name="SkPaint_kLast_Join"> <code><strong>SkPaint::kLast_Join </strong></code> </a></td><td>2</td><td>Equivalent to the largest value for <a href="#Stroke_Join">Stroke Join</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kDefault_Join"> <code><strong>SkPaint::kDefault_Join </strong></code> </a></td><td>1</td><td>Equivalent to <a href="#SkPaint_kMiter_Join">kMiter Join</a>.
|
||||
<a href="#Stroke_Join">Stroke Join</a> is set to <a href="#SkPaint_kMiter_Join">kMiter Join</a> by default.</td>
|
||||
<a href="#Stroke_Join">Stroke Join</a> is set to <a href="#SkPaint_kMiter_Join">kMiter Join</a> by default.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kJoinCount"> <code><strong>SkPaint::kJoinCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#Stroke_Join">Stroke Join</a> values defined.
|
||||
May be used to verify that <a href="#Stroke_Join">Stroke Join</a> is a legal value.</td>
|
||||
May be used to verify that <a href="#Stroke_Join">Stroke Join</a> is a legal value.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -2743,7 +2776,8 @@ true if the path represents <a href="#Style_Fill">Style Fill</a>, or false if it
|
||||
|
||||
<div><fiddle-embed name="cedd6233848198e1fca4d1e14816baaf"><div>A very small <a href="SkPath_Reference#Quad">Quad</a> stroke is turned into a filled path with increasing levels of precision.
|
||||
At the lowest precision, the <a href="SkPath_Reference#Quad">Quad</a> stroke is approximated by a rectangle.
|
||||
At the highest precision, the filled path has high fidelity compared to the original stroke.</div></fiddle-embed></div>
|
||||
At the highest precision, the filled path has high fidelity compared to the original stroke.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -3596,7 +3630,8 @@ enum <a href="#SkPaint_Align">Align</a> {
|
||||
<a href="#SkPaint_kLeft_Align">kLeft Align</a>,
|
||||
<a href="#SkPaint_kCenter_Align">kCenter Align</a>,
|
||||
<a href="#SkPaint_kRight_Align">kRight Align</a>,
|
||||
};</pre>
|
||||
};
|
||||
</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>,
|
||||
@ -3619,15 +3654,18 @@ using the metrics returned by the font.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kLeft_Align"> <code><strong>SkPaint::kLeft_Align </strong></code> </a></td><td>0</td><td>Leaves the glyph at the position computed by the font offset by the text position.</td>
|
||||
<td><a name="SkPaint_kLeft_Align"> <code><strong>SkPaint::kLeft_Align </strong></code> </a></td><td>0</td><td>Leaves the glyph at the position computed by the font offset by the text position.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kCenter_Align"> <code><strong>SkPaint::kCenter_Align </strong></code> </a></td><td>1</td><td>Moves the glyph half its width if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> clear, and
|
||||
half its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> set.</td>
|
||||
half its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> set.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kRight_Align"> <code><strong>SkPaint::kRight_Align </strong></code> </a></td><td>2</td><td>Moves the glyph by its width if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> clear,
|
||||
and by its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> set.</td>
|
||||
and by its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kVerticalText_Flag">kVerticalText Flag</a> set.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -3637,24 +3675,28 @@ and by its height if <a href="#SkPaint_Flags">Flags</a> has <a href="#SkPaint_kV
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
enum {
|
||||
<a href="#SkPaint_kAlignCount">kAlignCount</a> = 3,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kAlignCount"> <code><strong>SkPaint::kAlignCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#Text_Align">Text Align</a> values defined.</td>
|
||||
<td><a name="SkPaint_kAlignCount"> <code><strong>SkPaint::kAlignCount </strong></code> </a></td><td>3</td><td>The number of different <a href="#Text_Align">Text Align</a> values defined.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="702617fd9ebc3f12e30081b5db93e8a8"><div>Each position separately moves the glyph in drawPosText.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="702617fd9ebc3f12e30081b5db93e8a8"><div>Each position separately moves the glyph in drawPosText.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="f1cbbbafe6b3c52b81309cccbf96a308"><div><a href="#Vertical_Text">Vertical Text</a> treats <a href="#SkPaint_kLeft_Align">kLeft Align</a> as top align, and <a href="#SkPaint_kRight_Align">kRight Align</a> as bottom align.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="f1cbbbafe6b3c52b81309cccbf96a308"><div><a href="#Vertical_Text">Vertical Text</a> treats <a href="#SkPaint_kLeft_Align">kLeft Align</a> as top align, and <a href="#SkPaint_kRight_Align">kRight Align</a> as bottom align.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_getTextAlign"></a>
|
||||
## getTextAlign
|
||||
@ -3704,7 +3746,8 @@ text placement relative to position</td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="d37540afd918506ac2594665ca63979b"><div><a href="undocumented#Text">Text</a> is left-aligned by default, and then set to center. Setting the
|
||||
alignment out of range has no effect.</div></fiddle-embed></div>
|
||||
alignment out of range has no effect.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -3881,7 +3924,8 @@ enum <a href="#SkPaint_TextEncoding">TextEncoding</a> {
|
||||
<a href="#SkPaint_kUTF16_TextEncoding">kUTF16 TextEncoding</a>,
|
||||
<a href="#SkPaint_kUTF32_TextEncoding">kUTF32 TextEncoding</a>,
|
||||
<a href="#SkPaint_kGlyphID_TextEncoding">kGlyphID TextEncoding</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkPaint_TextEncoding">TextEncoding</a> determines whether text specifies character codes and their encoded
|
||||
size, or glyph indices. Characters are encoded as specified by the <a href="http://unicode.org/standard/standard.html">Unicode standard</a> .
|
||||
@ -3905,16 +3949,20 @@ A glyph index is a 16-bit word.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kUTF8_TextEncoding"> <code><strong>SkPaint::kUTF8_TextEncoding </strong></code> </a></td><td>0</td><td>Uses bytes to represent UTF-8 or ASCII.</td>
|
||||
<td><a name="SkPaint_kUTF8_TextEncoding"> <code><strong>SkPaint::kUTF8_TextEncoding </strong></code> </a></td><td>0</td><td>Uses bytes to represent UTF-8 or ASCII.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kUTF16_TextEncoding"> <code><strong>SkPaint::kUTF16_TextEncoding </strong></code> </a></td><td>1</td><td>Uses two byte words to represent most of Unicode.</td>
|
||||
<td><a name="SkPaint_kUTF16_TextEncoding"> <code><strong>SkPaint::kUTF16_TextEncoding </strong></code> </a></td><td>1</td><td>Uses two byte words to represent most of Unicode.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kUTF32_TextEncoding"> <code><strong>SkPaint::kUTF32_TextEncoding </strong></code> </a></td><td>2</td><td>Uses four byte words to represent all of Unicode.</td>
|
||||
<td><a name="SkPaint_kUTF32_TextEncoding"> <code><strong>SkPaint::kUTF32_TextEncoding </strong></code> </a></td><td>2</td><td>Uses four byte words to represent all of Unicode.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_kGlyphID_TextEncoding"> <code><strong>SkPaint::kGlyphID_TextEncoding </strong></code> </a></td><td>3</td><td>Uses two byte words to represent glyph indices.</td>
|
||||
<td><a name="SkPaint_kGlyphID_TextEncoding"> <code><strong>SkPaint::kGlyphID_TextEncoding </strong></code> </a></td><td>3</td><td>Uses two byte words to represent glyph indices.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -3924,7 +3972,8 @@ A glyph index is a 16-bit word.
|
||||
<div><fiddle-embed name="b29294e7f29d160a1b46abf2dcec9d2a"><div>First line is encoded in UTF-8.
|
||||
Second line is encoded in UTF-16.
|
||||
Third line is encoded in UTF-32.
|
||||
Fourth line has 16 bit glyph indices.</div></fiddle-embed></div>
|
||||
Fourth line has 16 bit glyph indices.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPaint_getTextEncoding"></a>
|
||||
## getTextEncoding
|
||||
@ -4038,7 +4087,8 @@ bool <a href="#SkPaint_FontMetrics_hasUnderlineThickness">hasUnderlineThickness(
|
||||
bool <a href="#SkPaint_FontMetrics_hasUnderlinePosition">hasUnderlinePosition(SkScalar* position)</a> const;
|
||||
bool <a href="#SkPaint_FontMetrics_hasStrikeoutThickness">hasStrikeoutThickness(SkScalar* thickness)</a> const;
|
||||
bool <a href="#SkPaint_FontMetrics_hasStrikeoutPosition">hasStrikeoutPosition(SkScalar* position)</a> const;
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkPaint_FontMetrics">FontMetrics</a> is filled out by <a href="#SkPaint_getFontMetrics">getFontMetrics</a>. <a href="#SkPaint_FontMetrics">FontMetrics</a> contents reflect the values
|
||||
computed by <a href="undocumented#Font_Manager">Font Manager</a> using <a href="undocumented#Typeface">Typeface</a>. Values are set to zero if they are
|
||||
@ -4062,7 +4112,8 @@ enum <a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> {
|
||||
<a href="#SkPaint_FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1,
|
||||
<a href="#SkPaint_FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> = 1 << 2,
|
||||
<a href="#SkPaint_FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkPaint_FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="#SkPaint_FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid;
|
||||
the underline or strikeout metric may be valid and zero.
|
||||
@ -4072,16 +4123,20 @@ Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPaint_FontMetrics_kUnderlineThicknessIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag </strong></code> </a></td><td>0x0001</td><td>Set if <a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> is valid.</td>
|
||||
<td><a name="SkPaint_FontMetrics_kUnderlineThicknessIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag </strong></code> </a></td><td>0x0001</td><td>Set if <a href="#SkPaint_FontMetrics_fUnderlineThickness">fUnderlineThickness</a> is valid.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_FontMetrics_kUnderlinePositionIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag </strong></code> </a></td><td>0x0002</td><td>Set if <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> is valid.</td>
|
||||
<td><a name="SkPaint_FontMetrics_kUnderlinePositionIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag </strong></code> </a></td><td>0x0002</td><td>Set if <a href="#SkPaint_FontMetrics_fUnderlinePosition">fUnderlinePosition</a> is valid.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_FontMetrics_kStrikeoutThicknessIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag </strong></code> </a></td><td>0x0004</td><td>Set if <a href="#SkPaint_FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> is valid.</td>
|
||||
<td><a name="SkPaint_FontMetrics_kStrikeoutThicknessIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag </strong></code> </a></td><td>0x0004</td><td>Set if <a href="#SkPaint_FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> is valid.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPaint_FontMetrics_kStrikeoutPositionIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag </strong></code> </a></td><td>0x0008</td><td>Set if <a href="#SkPaint_FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> is valid.</td>
|
||||
<td><a name="SkPaint_FontMetrics_kStrikeoutPositionIsValid_Flag"> <code><strong>SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag </strong></code> </a></td><td>0x0008</td><td>Set if <a href="#SkPaint_FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> is valid.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -4491,7 +4546,8 @@ true if all <a href="#SkPaint_containsText_text">text</a> corresponds to a non-z
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9202369019552f09cd4bec7f3046fee4"><div><a href="#SkPaint_containsText">containsText</a> succeeds for degree symbol, but cannot find a glyph index
|
||||
corresponding to the Unicode surrogate code point.</div>
|
||||
corresponding to the Unicode surrogate code point.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -4505,7 +4561,8 @@ corresponding to the Unicode surrogate code point.</div>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="904227febfd1c2e264955da0ef66da73"><div><a href="#SkPaint_containsText">containsText</a> returns true that glyph index is greater than zero, not
|
||||
that it corresponds to an entry in <a href="undocumented#Typeface">Typeface</a>.</div>
|
||||
that it corresponds to an entry in <a href="undocumented#Typeface">Typeface</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -4550,7 +4607,8 @@ storage for character codes, one per glyph</td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="c12686b0b3e0a87d0a248bbfc57e9492"><div>Convert UTF-8 <a href="#SkPaint_glyphsToUnichars_text">text</a> to <a href="#SkPaint_glyphsToUnichars_glyphs">glyphs</a>; then convert <a href="#SkPaint_glyphsToUnichars_glyphs">glyphs</a> to Unichar code points.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="c12686b0b3e0a87d0a248bbfc57e9492"><div>Convert UTF-8 <a href="#SkPaint_glyphsToUnichars_text">text</a> to <a href="#SkPaint_glyphsToUnichars_glyphs">glyphs</a>; then convert <a href="#SkPaint_glyphsToUnichars_glyphs">glyphs</a> to Unichar code points.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4673,7 +4731,8 @@ bytes of <a href="#SkPaint_breakText_text">text</a> that fit, always less than o
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="fd0033470ccbd5c7059670fdbf96cffc"><div><a href="undocumented#Line">Line</a> under "" shows desired width, shorter than available characters.
|
||||
<a href="undocumented#Line">Line</a> under "" shows measured width after breaking <a href="#SkPaint_breakText_text">text</a>.</div></fiddle-embed></div>
|
||||
<a href="undocumented#Line">Line</a> under "" shows measured width after breaking <a href="#SkPaint_breakText_text">text</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4716,7 +4775,8 @@ glyph count in <a href="#SkPaint_getTextWidths_text">text</a>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="6b9e101f49e9c2c28755c5bdcef64dfb"><div>Bounds of <a href="undocumented#Glyph">Glyphs</a> increase for stroked <a href="#SkPaint_getTextWidths_text">text</a>, but <a href="#SkPaint_getTextWidths_text">text</a> advance remains the same.
|
||||
The underlines show the <a href="#SkPaint_getTextWidths_text">text</a> advance, spaced to keep them distinct.</div></fiddle-embed></div>
|
||||
The underlines show the <a href="#SkPaint_getTextWidths_text">text</a> advance, spaced to keep them distinct.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4755,7 +4815,8 @@ geometry of the <a href="undocumented#Glyph">Glyphs</a></td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="7c9e6a399f898d68026c1f0865e6f73e"><div><a href="undocumented#Text">Text</a> is added to <a href="SkPath_Reference#Path">Path</a>, offset, and subtracted from <a href="SkPath_Reference#Path">Path</a>, then added at
|
||||
the offset location. The result is rendered with one draw call.</div></fiddle-embed></div>
|
||||
the offset location. The result is rendered with one draw call.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4788,7 +4849,8 @@ geometry of the <a href="undocumented#Glyph">Glyphs</a></td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three <a href="undocumented#Glyph">Glyphs</a> to eliminate overlaps, and strokes the result.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three <a href="undocumented#Glyph">Glyphs</a> to eliminate overlaps, and strokes the result.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4839,7 +4901,8 @@ number of intersections; may be zero
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="2a0b80ed20d193c688085b79deb5bdc9"><div>Underline uses intercepts to draw on either side of the glyph Descender.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="2a0b80ed20d193c688085b79deb5bdc9"><div>Underline uses intercepts to draw on either side of the glyph Descender.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4882,7 +4945,8 @@ number of intersections; may be zero
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href="undocumented#Text">Text</a> intercepts draw on either side of, but not inside, <a href="undocumented#Glyph">Glyphs</a> in a run.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href="undocumented#Text">Text</a> intercepts draw on either side of, but not inside, <a href="undocumented#Glyph">Glyphs</a> in a run.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
@ -4927,7 +4991,8 @@ number of intersections; may be zero
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="dc9851c43acc3716aca8c9a4d40d452d"><div><a href="undocumented#Text">Text</a> intercepts do not take stroke thickness into consideration.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="dc9851c43acc3716aca8c9a4d40d452d"><div><a href="undocumented#Text">Text</a> intercepts do not take stroke thickness into consideration.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
---
|
||||
|
||||
|
@ -36,7 +36,8 @@ identity; although <a href="#Path">Path</a> can be inspected to determine if it
|
||||
|
||||
<div><fiddle-embed name="93887af0c1dac49521972698cf04069c"><div><a href="#Path">Path</a> contains three <a href="#Contour">Contours</a>: <a href="undocumented#Line">Line</a>, <a href="undocumented#Circle">Circle</a>, and <a href="#Quad">Quad</a>. <a href="undocumented#Line">Line</a> is stroked but
|
||||
not filled. <a href="undocumented#Circle">Circle</a> is stroked and filled; <a href="undocumented#Circle">Circle</a> stroke forms a loop. <a href="#Quad">Quad</a>
|
||||
is stroked and filled, but since it is not closed, <a href="#Quad">Quad</a> does not stroke a loop.</div></fiddle-embed></div>
|
||||
is stroked and filled, but since it is not closed, <a href="#Quad">Quad</a> does not stroke a loop.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a href="#Path">Path</a> contains a <a href="#Fill_Type">Fill Type</a> which determines whether overlapping <a href="#Contour">Contours</a>
|
||||
form fills or holes. <a href="#Fill_Type">Fill Type</a> also determines whether area inside or outside
|
||||
@ -44,7 +45,8 @@ form fills or holes. <a href="#Fill_Type">Fill Type</a> also determines whether
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="36a995442c081ee779ecab2962d36e69"><div><a href="#Path">Path</a> is drawn filled, then stroked, then stroked and filled.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="36a995442c081ee779ecab2962d36e69"><div><a href="#Path">Path</a> is drawn filled, then stroked, then stroked and filled.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a href="#Path">Path</a> contents are never shared. Copying <a href="#Path">Path</a> by value effectively creates
|
||||
a new <a href="#Path">Path</a> independent of the original. Internally, the copy does not duplicate
|
||||
@ -61,7 +63,8 @@ are required to satisfy <a href="#Verb_Array">Verb Array</a>. First <a href="#Ve
|
||||
<div><fiddle-embed name="0374f2dcd7effeb1dd435205a6c2de6f"><div>Each <a href="#SkPath_moveTo">SkPath::moveTo</a> starts a new <a href="#Contour">Contour</a>, and content after <a href="#SkPath_close">SkPath::close()</a>
|
||||
also starts a new <a href="#Contour">Contour</a>. Since <a href="#SkPath_conicTo">SkPath::conicTo</a> is not preceded by
|
||||
<a href="#SkPath_moveTo">SkPath::moveTo</a>, the first <a href="SkPoint_Reference#Point">Point</a> of the third <a href="#Contour">Contour</a> starts at the last <a href="SkPoint_Reference#Point">Point</a>
|
||||
of the second <a href="#Contour">Contour</a>.</div></fiddle-embed></div>
|
||||
of the second <a href="#Contour">Contour</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
If final <a href="#Verb">Verb</a> in <a href="#Contour">Contour</a> is <a href="#SkPath_kClose_Verb">SkPath::kClose Verb</a>, <a href="undocumented#Line">Line</a> connects <a href="#Last_Point">Last Point</a> in
|
||||
<a href="#Contour">Contour</a> with first <a href="SkPoint_Reference#Point">Point</a>. A closed <a href="#Contour">Contour</a>, stroked, draws
|
||||
@ -72,7 +75,8 @@ remains open. An open <a href="#Contour">Contour</a>, stroked, draws <a href="Sk
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="7a1f39b12d2cd8b7f5b1190879259cb2"><div><a href="#Path">Path</a> is drawn stroked, with an open <a href="#Contour">Contour</a> and a closed <a href="#Contour">Contour</a>.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="7a1f39b12d2cd8b7f5b1190879259cb2"><div><a href="#Path">Path</a> is drawn stroked, with an open <a href="#Contour">Contour</a> and a closed <a href="#Contour">Contour</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
## <a name="Contour_Zero_Length"></a> Contour Zero Length
|
||||
|
||||
@ -257,7 +261,8 @@ enum <a href="#Verb">Verb</a> {
|
||||
<a href="#SkPath_kCubic_Verb">kCubic Verb</a>,
|
||||
<a href="#SkPath_kClose_Verb">kClose Verb</a>,
|
||||
<a href="#SkPath_kDone_Verb">kDone Verb</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#Verb">Verb</a> instructs <a href="#Path">Path</a> how to interpret one or more <a href="SkPoint_Reference#Point">Point</a> and optional <a href="#Conic_Weight">Conic Weight</a>;
|
||||
manage <a href="#Contour">Contour</a>, and terminate <a href="#Path">Path</a>.
|
||||
@ -266,34 +271,41 @@ manage <a href="#Contour">Contour</a>, and terminate <a href="#Path">Path</a>.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPath_kMove_Verb"> <code><strong>SkPath::kMove_Verb </strong></code> </a></td><td>0</td><td>Starts new <a href="#Contour">Contour</a> at next <a href="SkPoint_Reference#Point">Point</a>.</td>
|
||||
<td><a name="SkPath_kMove_Verb"> <code><strong>SkPath::kMove_Verb </strong></code> </a></td><td>0</td><td>Starts new <a href="#Contour">Contour</a> at next <a href="SkPoint_Reference#Point">Point</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kLine_Verb"> <code><strong>SkPath::kLine_Verb </strong></code> </a></td><td>1</td><td>Adds <a href="undocumented#Line">Line</a> from <a href="#Last_Point">Last Point</a> to next <a href="SkPoint_Reference#Point">Point</a>.
|
||||
<a href="undocumented#Line">Line</a> is a straight segment from <a href="SkPoint_Reference#Point">Point</a> to <a href="SkPoint_Reference#Point">Point</a>.</td>
|
||||
<a href="undocumented#Line">Line</a> is a straight segment from <a href="SkPoint_Reference#Point">Point</a> to <a href="SkPoint_Reference#Point">Point</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kQuad_Verb"> <code><strong>SkPath::kQuad_Verb </strong></code> </a></td><td>2</td><td>Adds <a href="#Quad">Quad</a> from <a href="#Last_Point">Last Point</a>, using control <a href="SkPoint_Reference#Point">Point</a>, and end <a href="SkPoint_Reference#Point">Point</a>.
|
||||
<a href="#Quad">Quad</a> is a parabolic section within tangents from <a href="#Last_Point">Last Point</a> to control <a href="SkPoint_Reference#Point">Point</a>,
|
||||
and control <a href="SkPoint_Reference#Point">Point</a> to end <a href="SkPoint_Reference#Point">Point</a>.</td>
|
||||
and control <a href="SkPoint_Reference#Point">Point</a> to end <a href="SkPoint_Reference#Point">Point</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kConic_Verb"> <code><strong>SkPath::kConic_Verb </strong></code> </a></td><td>3</td><td>Adds <a href="#Conic">Conic</a> from <a href="#Last_Point">Last Point</a>, using control <a href="SkPoint_Reference#Point">Point</a>, end <a href="SkPoint_Reference#Point">Point</a>, and <a href="#Conic_Weight">Conic Weight</a>.
|
||||
<a href="#Conic">Conic</a> is a elliptical, parabolic, or hyperbolic section within tangents
|
||||
from <a href="#Last_Point">Last Point</a> to control <a href="SkPoint_Reference#Point">Point</a>, and control <a href="SkPoint_Reference#Point">Point</a> to end <a href="SkPoint_Reference#Point">Point</a>, constrained
|
||||
by <a href="#Conic_Weight">Conic Weight</a>. <a href="#Conic_Weight">Conic Weight</a> less than one is elliptical; equal to one is
|
||||
parabolic (and identical to <a href="#Quad">Quad</a>); greater than one hyperbolic.</td>
|
||||
parabolic (and identical to <a href="#Quad">Quad</a>); greater than one hyperbolic.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kCubic_Verb"> <code><strong>SkPath::kCubic_Verb </strong></code> </a></td><td>4</td><td>Adds <a href="#Cubic">Cubic</a> from <a href="#Last_Point">Last Point</a>, using two control <a href="SkPoint_Reference#Point">Points</a>, and end <a href="SkPoint_Reference#Point">Point</a>.
|
||||
<a href="#Cubic">Cubic</a> is a third-order Bezier_Curve section within tangents from <a href="#Last_Point">Last Point</a>
|
||||
to first control <a href="SkPoint_Reference#Point">Point</a>, and from second control <a href="SkPoint_Reference#Point">Point</a> to end <a href="SkPoint_Reference#Point">Point</a>.</td>
|
||||
to first control <a href="SkPoint_Reference#Point">Point</a>, and from second control <a href="SkPoint_Reference#Point">Point</a> to end <a href="SkPoint_Reference#Point">Point</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kClose_Verb"> <code><strong>SkPath::kClose_Verb </strong></code> </a></td><td>5</td><td>Closes <a href="#Contour">Contour</a>, connecting <a href="#Last_Point">Last Point</a> to <a href="#SkPath_kMove_Verb">kMove Verb</a> <a href="SkPoint_Reference#Point">Point</a>.</td>
|
||||
<td><a name="SkPath_kClose_Verb"> <code><strong>SkPath::kClose_Verb </strong></code> </a></td><td>5</td><td>Closes <a href="#Contour">Contour</a>, connecting <a href="#Last_Point">Last Point</a> to <a href="#SkPath_kMove_Verb">kMove Verb</a> <a href="SkPoint_Reference#Point">Point</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kDone_Verb"> <code><strong>SkPath::kDone_Verb </strong></code> </a></td><td>6</td><td>Terminates <a href="#Path">Path</a>. Not in <a href="#Verb_Array">Verb Array</a>, but returned by <a href="#Path">Path</a> iterator.</td>
|
||||
<td><a name="SkPath_kDone_Verb"> <code><strong>SkPath::kDone_Verb </strong></code> </a></td><td>6</td><td>Terminates <a href="#Path">Path</a>. Not in <a href="#Verb_Array">Verb Array</a>, but returned by <a href="#Path">Path</a> iterator.
|
||||
</td>
|
||||
</tr>
|
||||
Each <a href="#Verb">Verb</a> has zero or more <a href="SkPoint_Reference#Point">Points</a> stored in <a href="#Path">Path</a>.
|
||||
<a href="#Path">Path</a> iterator returns complete curve descriptions, duplicating shared <a href="SkPoint_Reference#Point">Points</a>
|
||||
@ -334,7 +346,8 @@ verbs: kMove_Verb kLine_Verb kQuad_Verb kClose_Verb kMove_Verb kCubic_Verb kConi
|
||||
enum <a href="#Direction">Direction</a> {
|
||||
<a href="#SkPath_kCW_Direction">kCW Direction</a>,
|
||||
<a href="#SkPath_kCCW_Direction">kCCW Direction</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#Direction">Direction</a> describes whether <a href="#Contour">Contour</a> is clockwise or counterclockwise.
|
||||
When <a href="#Path">Path</a> contains multiple overlapping <a href="#Contour">Contours</a>, <a href="#Direction">Direction</a> together with
|
||||
@ -430,7 +443,8 @@ copy of <a href="#Path">Path</a>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="647312aacd946c8a6eabaca797140432"><div>Modifying one <a href="#SkPath_copy_const_SkPath_path">path</a> does not effect another, even if they started as copies
|
||||
of each other.</div>
|
||||
of each other.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -461,7 +475,8 @@ Releases ownership of any shared data and deletes data if <a href="#Path">Path</
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href="#Path">Path</a> Destructor, but copy of original in path2 is unaffected.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href="#Path">Path</a> Destructor, but copy of original in path2 is unaffected.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -540,7 +555,8 @@ true if <a href="#Path">Path</a> pair are equivalent
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="31883f51bb357f2ac5990d88f8b82e02"><div>Rewind removes <a href="#Verb_Array">Verb Array</a> but leaves storage; since storage is not compared,
|
||||
<a href="#Path">Path</a> pair are equivalent.</div>
|
||||
<a href="#Path">Path</a> pair are equivalent.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -580,7 +596,8 @@ true if <a href="#Path">Path</a> pair are not equivalent
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="0c6870ba1cea85ce6da5abd489c23d83"><div><a href="#Path">Path</a> pair are equal though their convexity is not equal.</div>
|
||||
<div><fiddle-embed name="0c6870ba1cea85ce6da5abd489c23d83"><div><a href="#Path">Path</a> pair are equal though their convexity is not equal.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -679,7 +696,8 @@ bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const
|
||||
<a href="#Interpolate">Interpolate</a> between <a href="#Path">Paths</a> with <a href="#Point_Array">Point Array</a> of equal size.
|
||||
Copy <a href="#Verb_Array">Verb Array</a> and <a href="#Conic_Weight">Weights</a> to <a href="#SkPath_interpolate_out">out</a>, and set <a href="#SkPath_interpolate_out">out</a> <a href="#Point_Array">Point Array</a> to a weighted
|
||||
average of this <a href="#Point_Array">Point Array</a> and <a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>, using the formula:
|
||||
(<a href="#Path">Path</a> <a href="SkPoint_Reference#Point">Point</a> * <a href="#SkPath_interpolate_weight">weight</a>) + <a href="#SkPath_interpolate_ending">ending</a> <a href="SkPoint_Reference#Point">Point</a> * (1 - <a href="#SkPath_interpolate_weight">weight</a>).
|
||||
(<a href="#Path">Path</a> <a href="SkPoint_Reference#Point">Point</a> * <a href="#SkPath_interpolate_weight">weight</a>) + <a href="#SkPath_interpolate_ending">ending</a> <a href="SkPoint_Reference#Point">Point</a> * (1 - <a href="#SkPath_interpolate_weight">weight</a>)
|
||||
.
|
||||
|
||||
<a href="#SkPath_interpolate_weight">weight</a> is most useful when between zero (<a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>) and
|
||||
one (this <a href="#Point_Array">Point Array</a>); will work with values outside of this
|
||||
@ -736,7 +754,8 @@ enum <a href="#SkPath_FillType">FillType</a> {
|
||||
<a href="#SkPath_kEvenOdd_FillType">kEvenOdd FillType</a>,
|
||||
<a href="#SkPath_kInverseWinding_FillType">kInverseWinding FillType</a>,
|
||||
<a href="#SkPath_kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#Fill_Type">Fill Type</a> selects the rule used to fill <a href="#Path">Path</a>. <a href="#Path">Path</a> set to <a href="#SkPath_kWinding_FillType">kWinding FillType</a>
|
||||
fills if the sum of <a href="#Contour">Contour</a> edges is not zero, where clockwise edges add one, and
|
||||
@ -751,22 +770,27 @@ reverses the rule:
|
||||
<div><fiddle-embed name="525ed591c31960de23068dba8ea11a75"><div>The top row has two clockwise rectangles. The second row has one clockwise and
|
||||
one counterclockwise rectangle. The even-odd variants draw the same. The
|
||||
winding variants draw the top rectangle overlap, which has a winding of 2, the
|
||||
same as the outer parts of the top rectangles, which have a winding of 1.</div></fiddle-embed></div>
|
||||
same as the outer parts of the top rectangles, which have a winding of 1.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPath_kWinding_FillType"> <code><strong>SkPath::kWinding_FillType </strong></code> </a></td><td>0</td><td>Specifies fill as area is enclosed by a non-zero sum of <a href="#Contour">Contour</a> <a href="#Direction">Directions</a>.</td>
|
||||
<td><a name="SkPath_kWinding_FillType"> <code><strong>SkPath::kWinding_FillType </strong></code> </a></td><td>0</td><td>Specifies fill as area is enclosed by a non-zero sum of <a href="#Contour">Contour</a> <a href="#Direction">Directions</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kEvenOdd_FillType"> <code><strong>SkPath::kEvenOdd_FillType </strong></code> </a></td><td>1</td><td>Specifies fill as area enclosed by an odd number of <a href="#Contour">Contours</a>.</td>
|
||||
<td><a name="SkPath_kEvenOdd_FillType"> <code><strong>SkPath::kEvenOdd_FillType </strong></code> </a></td><td>1</td><td>Specifies fill as area enclosed by an odd number of <a href="#Contour">Contours</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kInverseWinding_FillType"> <code><strong>SkPath::kInverseWinding_FillType </strong></code> </a></td><td>2</td><td>Specifies fill as area is enclosed by a zero sum of <a href="#Contour">Contour</a> <a href="#Direction">Directions</a>.</td>
|
||||
<td><a name="SkPath_kInverseWinding_FillType"> <code><strong>SkPath::kInverseWinding_FillType </strong></code> </a></td><td>2</td><td>Specifies fill as area is enclosed by a zero sum of <a href="#Contour">Contour</a> <a href="#Direction">Directions</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kInverseEvenOdd_FillType"> <code><strong>SkPath::kInverseEvenOdd_FillType </strong></code> </a></td><td>3</td><td>Specifies fill as area enclosed by an even number of <a href="#Contour">Contours</a>.</td>
|
||||
<td><a name="SkPath_kInverseEvenOdd_FillType"> <code><strong>SkPath::kInverseEvenOdd_FillType </strong></code> </a></td><td>3</td><td>Specifies fill as area enclosed by an even number of <a href="#Contour">Contours</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -833,7 +857,8 @@ one of: <a href="#SkPath_kWinding_FillType">kWinding FillType</a>, <a href="#SkP
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="b4a91cd7f50b2a0a0d1bec6d0ac823d2"><div>If empty <a href="#Path">Path</a> is set to inverse <a href="#SkPath_FillType">FillType</a>, it fills all pixels.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="b4a91cd7f50b2a0a0d1bec6d0ac823d2"><div>If empty <a href="#Path">Path</a> is set to inverse <a href="#SkPath_FillType">FillType</a>, it fills all pixels.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -892,7 +917,8 @@ unmodified by the original <a href="#SkPath_FillType">FillType</a>.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="400facce23d417bc5043c5f58404afbd"><div><a href="#Path">Path</a> drawn normally and through its inverse touches every pixel once.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="400facce23d417bc5043c5f58404afbd"><div><a href="#Path">Path</a> drawn normally and through its inverse touches every pixel once.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -909,7 +935,8 @@ enum <a href="#Convexity">Convexity</a> : uint8_t {
|
||||
<a href="#SkPath_kUnknown_Convexity">kUnknown Convexity</a>,
|
||||
<a href="#SkPath_kConvex_Convexity">kConvex Convexity</a>,
|
||||
<a href="#SkPath_kConcave_Convexity">kConcave Convexity</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#Path">Path</a> is convex if it contains one <a href="#Contour">Contour</a> and <a href="#Contour">Contour</a> loops no more than
|
||||
360 degrees, and <a href="#Contour">Contour</a> angles all have same <a href="#SkPath_Direction">Direction</a>. Convex <a href="#Path">Path</a>
|
||||
@ -926,13 +953,16 @@ if needed by destination <a href="SkSurface_Reference#Surface">Surface</a>.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPath_kUnknown_Convexity"> <code><strong>SkPath::kUnknown_Convexity </strong></code> </a></td><td>0</td><td>Indicates <a href="#Convexity">Convexity</a> has not been determined.</td>
|
||||
<td><a name="SkPath_kUnknown_Convexity"> <code><strong>SkPath::kUnknown_Convexity </strong></code> </a></td><td>0</td><td>Indicates <a href="#Convexity">Convexity</a> has not been determined.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kConvex_Convexity"> <code><strong>SkPath::kConvex_Convexity </strong></code> </a></td><td>1</td><td><a href="#Path">Path</a> has one <a href="#Contour">Contour</a> made of a simple geometry without indentations.</td>
|
||||
<td><a name="SkPath_kConvex_Convexity"> <code><strong>SkPath::kConvex_Convexity </strong></code> </a></td><td>1</td><td><a href="#Path">Path</a> has one <a href="#Contour">Contour</a> made of a simple geometry without indentations.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kConcave_Convexity"> <code><strong>SkPath::kConcave_Convexity </strong></code> </a></td><td>2</td><td><a href="#Path">Path</a> has more than one <a href="#Contour">Contour</a>, or a geometry with indentations.</td>
|
||||
<td><a name="SkPath_kConcave_Convexity"> <code><strong>SkPath::kConcave_Convexity </strong></code> </a></td><td>2</td><td><a href="#Path">Path</a> has more than one <a href="#Contour">Contour</a>, or a geometry with indentations.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -988,7 +1018,8 @@ stored <a href="#Convexity">Convexity</a>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="bc19da9de880e3f339707247686efc0a"><div><a href="#Convexity">Convexity</a> is unknown unless <a href="#SkPath_getConvexity">getConvexity</a> is called without a subsequent call
|
||||
that alters the path.</div></fiddle-embed></div>
|
||||
that alters the path.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1049,7 +1080,8 @@ true if <a href="#Convexity">Convexity</a> stored or computed is <a href="#SkPat
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="dfd2c40e1c2a7b539a94aec8d040d349"><div>Concave shape is erroneously considered convex after a forced call to
|
||||
<a href="#SkPath_setConvexity">setConvexity</a>.</div></fiddle-embed></div>
|
||||
<a href="#SkPath_setConvexity">setConvexity</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1117,7 +1149,8 @@ true if <a href="#Path">Path</a> contains only <a href="undocumented#Round_Rect"
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="2aa939b90d96aff436b145a96305132c"><div>Draw rounded rectangle and its bounds.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="2aa939b90d96aff436b145a96305132c"><div>Draw rounded rectangle and its bounds.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1163,7 +1196,8 @@ is critical.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="f1fedbb89da9c2a33a91805175663012"><div>Although path1 retains its internal storage, it is indistinguishable from
|
||||
a newly initialized path.</div></fiddle-embed></div>
|
||||
a newly initialized path.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1224,7 +1258,8 @@ true if the last <a href="#Contour">Contour</a> ends with a <a href="#SkPath_kCl
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="03b740ab94b9017800a52e30b5e7fee7"><div><a href="#SkPath_close">close</a> has no effect if <a href="#Path">Path</a> is empty; <a href="#SkPath_isLastContourClosed">isLastContourClosed</a> returns
|
||||
false until <a href="#Path">Path</a> has geometry followed by <a href="#SkPath_close">close</a>.</div>
|
||||
false until <a href="#Path">Path</a> has geometry followed by <a href="#SkPath_close">close</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1388,7 +1423,8 @@ true if <a href="undocumented#Line">Line</a> is degenerate; its length is effect
|
||||
|
||||
<div><fiddle-embed name="97a031f9186ade586928563840ce9116"><div>As single precision floats, 100 and 100.000001 have the same bit representation,
|
||||
and are exactly equal. 100 and 100.0001 have different bit representations, and
|
||||
are not exactly equal, but are nearly equal.</div>
|
||||
are not exactly equal, but are nearly equal.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1440,7 +1476,8 @@ true if <a href="#Quad">Quad</a> is degenerate; its length is effectively zero
|
||||
|
||||
<div><fiddle-embed name="1d50896c528cd4581966646b7d96acff"><div>As single precision floats: 100, 100.00001, and 100.00002 have different bit representations
|
||||
but nearly the same value. Translating all three by 1000 gives them the same bit representation;
|
||||
the fractional portion of the number can not be represented by the float and is lost.</div>
|
||||
the fractional portion of the number can not be represented by the float and is lost.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1828,7 +1865,8 @@ bounds of all <a href="SkPoint_Reference#Point">Points</a> in <a href="#Point_Ar
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9160aa6d1476bd87d927cfc8a4bf25e7"><div>Bounds of upright <a href="undocumented#Circle">Circle</a> can be predicted from center and radius.
|
||||
Bounds of rotated <a href="undocumented#Circle">Circle</a> includes control <a href="SkPoint_Reference#Point">Points</a> outside of filled area.</div>
|
||||
Bounds of rotated <a href="undocumented#Circle">Circle</a> includes control <a href="SkPoint_Reference#Point">Points</a> outside of filled area.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1972,7 +2010,8 @@ true if <a href="#SkPath_conservativelyContainsRect_rect">rect</a> is contained
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="41638d13e40fa449ece354dde5fb1941"><div><a href="SkRect_Reference#Rect">Rect</a> is drawn in blue if it is contained by red <a href="#Path">Path</a>.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="41638d13e40fa449ece354dde5fb1941"><div><a href="SkRect_Reference#Rect">Rect</a> is drawn in blue if it is contained by red <a href="#Path">Path</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2380,7 +2419,8 @@ parabolic segment.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="2aadded3d20dfef34d1c8abe28c7bc8d"><div>When <a href="#Conic_Weight">Conic Weight</a> is one, <a href="#Quad">Quad</a> is added to path; the two are identical.</div>
|
||||
<div><fiddle-embed name="2aadded3d20dfef34d1c8abe28c7bc8d"><div>When <a href="#Conic_Weight">Conic Weight</a> is one, <a href="#Quad">Quad</a> is added to path; the two are identical.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2396,7 +2436,8 @@ If weight is less than one, <a href="#Conic">Conic</a> is an elliptical segment.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="e88f554efacfa9f75f270fb1c0add5b4"><div>A 90 degree circular arc has the weight1 / sqrt(2).</div>
|
||||
<div><fiddle-embed name="e88f554efacfa9f75f270fb1c0add5b4"><div>A 90 degree circular arc has the weight1 / sqrt(2).
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2468,7 +2509,8 @@ weight of added <a href="#Conic">Conic</a></td>
|
||||
|
||||
<div><fiddle-embed name="358d9b6060b528b0923c007420f09c13"><div>As weight increases, curve is pulled towards control point.
|
||||
The bottom two curves are elliptical; the next is parabolic; the
|
||||
top curve is hyperbolic.</div></fiddle-embed></div>
|
||||
top curve is hyperbolic.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2511,7 +2553,8 @@ weight of added <a href="#Conic">Conic</a></td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="22d25e03b19d5bae92118877e462361b"><div><a href="#Conic">Conics</a> and arcs use identical representations. As the arc sweep increases
|
||||
the <a href="#Conic_Weight">Conic Weight</a> also increases, but remains smaller than one.</div></fiddle-embed></div>
|
||||
the <a href="#Conic_Weight">Conic Weight</a> also increases, but remains smaller than one.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2753,7 +2796,8 @@ Direction sweep, SkScalar x, SkScalar y)</a></td> </tr>
|
||||
3 is similar to 1, but always begins new <a href="#Contour">Contour</a>.
|
||||
4 describes an arc from a pair of tangent lines and a radius.
|
||||
5 describes an arc from <a href="undocumented#Oval">Oval</a> center, arc start <a href="SkPoint_Reference#Point">Point</a> and arc end <a href="SkPoint_Reference#Point">Point</a>.
|
||||
6 describes an arc from a pair of tangent lines and a <a href="#Conic_Weight">Conic Weight</a>.</div></fiddle-embed></div>
|
||||
6 describes an arc from a pair of tangent lines and a <a href="#Conic_Weight">Conic Weight</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
<a name="SkPath_arcTo"></a>
|
||||
## arcTo
|
||||
@ -2787,7 +2831,8 @@ true to start a new contour with <a href="#Arc">Arc</a></td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="5f02890edaa10cb5e1a4243a82b6a382"><div><a href="#SkPath_arcTo">arcTo</a> continues a previous contour when <a href="#SkPath_arcTo_forceMoveTo">forceMoveTo</a> is false and when <a href="#Path">Path</a>
|
||||
is not empty.</div></fiddle-embed></div>
|
||||
is not empty.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -2840,7 +2885,8 @@ distance from <a href="#Arc">Arc</a> to <a href="undocumented#Circle">Circle</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="498360fa0a201cc5db04b1c27256358f"><div><a href="#SkPath_arcTo">arcTo</a> is represented by <a href="undocumented#Line">Line</a> and circular <a href="#Conic">Conic</a> in <a href="#Path">Path</a>.</div>
|
||||
<div><fiddle-embed name="498360fa0a201cc5db04b1c27256358f"><div><a href="#SkPath_arcTo">arcTo</a> is represented by <a href="undocumented#Line">Line</a> and circular <a href="#Conic">Conic</a> in <a href="#Path">Path</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2892,7 +2938,8 @@ distance from <a href="#Arc">Arc</a> to <a href="undocumented#Circle">Circle</a>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="0c056264a361579c18e5d02d3172d4d4"><div>Because tangent lines are parallel, <a href="#SkPath_arcTo">arcTo</a> appends line from last <a href="#Path">Path</a> <a href="SkPoint_Reference#Point">Point</a> to
|
||||
<a href="#SkPath_arcTo_3_p1">p1</a>, but does not append a circular <a href="#Conic">Conic</a>.</div>
|
||||
<a href="#SkPath_arcTo_3_p1">p1</a>, but does not append a circular <a href="#Conic">Conic</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2915,7 +2962,8 @@ line (156,20),(200,20)
|
||||
enum <a href="#SkPath_ArcSize">ArcSize</a> {
|
||||
<a href="#SkPath_kSmall_ArcSize">kSmall ArcSize</a>,
|
||||
<a href="#SkPath_kLarge_ArcSize">kLarge ArcSize</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
Four <a href="undocumented#Oval">Oval</a> parts with radii (rx, ry) start at last <a href="#Path">Path</a> <a href="SkPoint_Reference#Point">Point</a> and ends at (x, y).
|
||||
<a href="#SkPath_ArcSize">ArcSize</a> and <a href="#SkPath_Direction">Direction</a> select one of the four <a href="undocumented#Oval">Oval</a> parts.
|
||||
@ -2935,7 +2983,8 @@ Four <a href="undocumented#Oval">Oval</a> parts with radii (rx, ry) start at las
|
||||
|
||||
<div><fiddle-embed name="8e40c546eecd9cc213200717240898ba"><div><a href="#Arc">Arc</a> begins at top of <a href="undocumented#Oval">Oval</a> pair and ends at bottom. <a href="#Arc">Arc</a> can take four routes to get there.
|
||||
Two routes are large, and two routes are counterclockwise. The one route both large
|
||||
and counterclockwise is blue.</div></fiddle-embed></div>
|
||||
and counterclockwise is blue.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3051,7 +3100,8 @@ Append <a href="#Arc">Arc</a> to <a href="#Path">Path</a>, relative to last <a h
|
||||
more <a href="#Conic">Conic</a>, weighted to describe part of <a href="undocumented#Oval">Oval</a> with radii (<a href="#SkPath_rArcTo_rx">rx</a>, <a href="#SkPath_rArcTo_ry">ry</a>) rotated by
|
||||
<a href="#SkPath_rArcTo_xAxisRotate">xAxisRotate</a> degrees. <a href="#Arc">Arc</a> curves from last <a href="#Path">Path</a> <a href="SkPoint_Reference#Point">Point</a> (x0, y0) to end <a href="SkPoint_Reference#Point">Point</a>:
|
||||
|
||||
(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>),
|
||||
(x0 + <a href="#SkPath_rArcTo_dx">dx</a>, y0 + <a href="#SkPath_rArcTo_dy">dy</a>)
|
||||
,
|
||||
choosing one of four possible routes: clockwise or
|
||||
counterclockwise, and smaller or larger. If <a href="#Path">Path</a> is empty, the start <a href="#Arc">Arc</a> <a href="SkPoint_Reference#Point">Point</a>
|
||||
is (0, 0).
|
||||
@ -3268,7 +3318,8 @@ number of <a href="#Quad">Quad</a> curves written to <a href="#SkPath_ConvertCon
|
||||
|
||||
<div><fiddle-embed name="3ba94448a4ba48f926e643baeb5b1016"><div>A pair of <a href="#Quad">Quad</a> curves are drawn in red on top of the elliptical <a href="#Conic">Conic</a> curve in black.
|
||||
The middle curve is nearly circular. The top-right curve is parabolic, which can
|
||||
be drawn exactly with a single <a href="#Quad">Quad</a>.</div></fiddle-embed></div>
|
||||
be drawn exactly with a single <a href="#Quad">Quad</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3309,7 +3360,8 @@ true if <a href="#Path">Path</a> contains <a href="SkRect_Reference#Rect">Rect</
|
||||
|
||||
<div><fiddle-embed name="063a5f0a8de1fe998d227393e0866557"><div>After <a href="#SkPath_addRect">addRect</a>, <a href="#SkPath_isRect">isRect</a> returns true. Following <a href="#SkPath_moveTo">moveTo</a> permits <a href="#SkPath_isRect">isRect</a> to return true, but
|
||||
following <a href="#SkPath_lineTo">lineTo</a> does not. <a href="#SkPath_addPoly">addPoly</a> returns true even though <a href="#SkPath_isRect_rect">rect</a> is not closed, and one
|
||||
side of <a href="#SkPath_isRect_rect">rect</a> is made up of consecutive line segments.</div>
|
||||
side of <a href="#SkPath_isRect_rect">rect</a> is made up of consecutive line segments.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -3399,7 +3451,8 @@ bottom-right, and top-right if <a href="#SkPath_addRect_dir">dir</a> is <a href=
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="0f841e4eaebb613b5069800567917c2d"><div>The left <a href="SkRect_Reference#Rect">Rect</a> dashes starting at the top-left corner, to the right.
|
||||
The right <a href="SkRect_Reference#Rect">Rect</a> dashes starting at the top-left corner, towards the bottom.</div></fiddle-embed></div>
|
||||
The right <a href="SkRect_Reference#Rect">Rect</a> dashes starting at the top-left corner, towards the bottom.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3439,7 +3492,8 @@ initial corner of <a href="SkRect_Reference#Rect">Rect</a> to add</td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9202430b3f4f5275af8eec5cc9d7baa8"><div>The arrow is just after the initial corner and points towards the next
|
||||
corner appended to <a href="#Path">Path</a>.</div></fiddle-embed></div>
|
||||
corner appended to <a href="#Path">Path</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3478,7 +3532,8 @@ larger y of <a href="SkRect_Reference#Rect">Rect</a></td>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="3837827310e8b88b8c2e128ef9fbbd65"><div>The <a href="#SkPath_addRect_3_left">left</a> <a href="SkRect_Reference#Rect">Rect</a> dashes start at the <a href="#SkPath_addRect_3_top">top</a>-<a href="#SkPath_addRect_3_left">left</a> corner, and continue to the <a href="#SkPath_addRect_3_right">right</a>.
|
||||
The <a href="#SkPath_addRect_3_right">right</a> <a href="SkRect_Reference#Rect">Rect</a> dashes start at the <a href="#SkPath_addRect_3_top">top</a>-<a href="#SkPath_addRect_3_left">left</a> corner, and continue down.</div></fiddle-embed></div>
|
||||
The <a href="#SkPath_addRect_3_right">right</a> <a href="SkRect_Reference#Rect">Rect</a> dashes start at the <a href="#SkPath_addRect_3_top">top</a>-<a href="#SkPath_addRect_3_left">left</a> corner, and continue down.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3567,7 +3622,8 @@ void addCircle(SkScalar x, SkScalar y, SkScalar radius, Direction dir = kCW_Dire
|
||||
|
||||
Add <a href="undocumented#Circle">Circle</a> centered at (<a href="#SkPath_addCircle_x">x</a>, <a href="#SkPath_addCircle_y">y</a>) of size <a href="#SkPath_addCircle_radius">radius</a> to <a href="#Path">Path</a>, appending <a href="#SkPath_kMove_Verb">kMove Verb</a>,
|
||||
four <a href="#SkPath_kConic_Verb">kConic Verb</a>, and <a href="#SkPath_kClose_Verb">kClose Verb</a>. <a href="undocumented#Circle">Circle</a> begins at:
|
||||
(<a href="#SkPath_addCircle_x">x</a> + <a href="#SkPath_addCircle_radius">radius</a>, <a href="#SkPath_addCircle_y">y</a>),
|
||||
(<a href="#SkPath_addCircle_x">x</a> + <a href="#SkPath_addCircle_radius">radius</a>, <a href="#SkPath_addCircle_y">y</a>)
|
||||
,
|
||||
continuing
|
||||
clockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCW_Direction">kCW Direction</a>, and counterclockwise if <a href="#SkPath_addCircle_dir">dir</a> is <a href="#SkPath_kCCW_Direction">kCCW Direction</a>.
|
||||
|
||||
@ -3627,7 +3683,8 @@ sweep, in degrees. Positive is clockwise; treated modulo 360</td>
|
||||
|
||||
<div><fiddle-embed name="9cf5122475624e4cf39f06c698f80b1a"><div>The middle row of the left and right columns draw differently from the entries
|
||||
above and below because <a href="#SkPath_addArc_sweepAngle">sweepAngle</a> is outside of the range of +/-360,
|
||||
and <a href="#SkPath_addArc_startAngle">startAngle</a> modulo 90 is not zero.</div></fiddle-embed></div>
|
||||
and <a href="#SkPath_addArc_startAngle">startAngle</a> modulo 90 is not zero.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3673,7 +3730,8 @@ y-radius of rounded corners on the <a href="undocumented#Round_Rect">Round Rect<
|
||||
If sides are only radii, path contains <a href="undocumented#Oval">Oval</a> and is drawn blue.
|
||||
All remaining path draws are convex, and are drawn in gray; no
|
||||
paths constructed from <a href="#SkPath_addRoundRect">addRoundRect</a> are concave, so none are
|
||||
drawn in green.</div></fiddle-embed></div>
|
||||
drawn in green.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -3852,7 +3910,8 @@ true to add <a href="undocumented#Line">Line</a> connecting <a href="#Contour">C
|
||||
enum <a href="#SkPath_AddPathMode">AddPathMode</a> {
|
||||
<a href="#SkPath_kAppend_AddPathMode">kAppend AddPathMode</a>,
|
||||
<a href="#SkPath_kExtend_AddPathMode">kExtend AddPathMode</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkPath_AddPathMode">AddPathMode</a> chooses how <a href="#SkPath_addPath">addPath</a> appends. Adding one <a href="#Path">Path</a> to another can extend
|
||||
the last <a href="#Contour">Contour</a> or start a new <a href="#Contour">Contour</a>.
|
||||
@ -3862,11 +3921,13 @@ the last <a href="#Contour">Contour</a> or start a new <a href="#Contour">Contou
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPath_kAppend_AddPathMode"> <code><strong>SkPath::kAppend_AddPathMode </strong></code> </a></td><td>Path Verbs, Points, and Conic_Weights are appended to destination unaltered.</td><td>Since <a href="#Path">Path</a> <a href="#Verb_Array">Verb Array</a> begins with <a href="#SkPath_kMove_Verb">kMove Verb</a> if src is not empty, this
|
||||
starts a new <a href="#Contour">Contour</a>.</td>
|
||||
starts a new <a href="#Contour">Contour</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kExtend_AddPathMode"> <code><strong>SkPath::kExtend_AddPathMode </strong></code> </a></td><td>If destination is closed or empty, start a new Contour. If destination</td><td>is not empty, add <a href="undocumented#Line">Line</a> from <a href="#Last_Point">Last Point</a> to added <a href="#Path">Path</a> first <a href="SkPoint_Reference#Point">Point</a>. Skip added
|
||||
<a href="#Path">Path</a> initial <a href="#SkPath_kMove_Verb">kMove Verb</a>, then append remining <a href="#Verb">Verbs</a>, <a href="SkPoint_Reference#Point">Points</a>, and <a href="#Conic_Weight">Conic Weights</a>.</td>
|
||||
<a href="#Path">Path</a> initial <a href="#SkPath_kMove_Verb">kMove Verb</a>, then append remining <a href="#Verb">Verbs</a>, <a href="SkPoint_Reference#Point">Points</a>, and <a href="#Conic_Weight">Conic Weights</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -3874,7 +3935,8 @@ starts a new <a href="#Contour">Contour</a>.</td>
|
||||
|
||||
<div><fiddle-embed name="801b02e74c64aafdb734f2e5cf3e5ab0"><div>test is built from path, open on the top row, and closed on the bottom row.
|
||||
The left column uses <a href="#SkPath_kAppend_AddPathMode">kAppend AddPathMode</a>; the right uses <a href="#SkPath_kExtend_AddPathMode">kExtend AddPathMode</a>.
|
||||
The top right composition is made up of one contour; the other three have two.</div></fiddle-embed></div>
|
||||
The top right composition is made up of one contour; the other three have two.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4244,7 +4306,8 @@ enum <a href="#SkPath_SegmentMask">SegmentMask</a> {
|
||||
<a href="#SkPath_kQuad_SegmentMask">kQuad SegmentMask</a> = 1 << 1,
|
||||
<a href="#SkPath_kConic_SegmentMask">kConic SegmentMask</a> = 1 << 2,
|
||||
<a href="#SkPath_kCubic_SegmentMask">kCubic SegmentMask</a> = 1 << 3,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkPath_SegmentMask">SegmentMask</a> constants correspond to each drawing <a href="#SkPath_Verb">Verb</a> type in <a href="#Path">Path</a>; for
|
||||
instance, if <a href="#Path">Path</a> only contains <a href="undocumented#Line">Lines</a>, only the <a href="#SkPath_kLine_SegmentMask">kLine SegmentMask</a> bit is set.
|
||||
@ -4253,22 +4316,27 @@ instance, if <a href="#Path">Path</a> only contains <a href="undocumented#Line">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkPath_kLine_SegmentMask"> <code><strong>SkPath::kLine_SegmentMask </strong></code> </a></td><td>1</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kLine_Verb">kLine Verb</a>.</td>
|
||||
<td><a name="SkPath_kLine_SegmentMask"> <code><strong>SkPath::kLine_SegmentMask </strong></code> </a></td><td>1</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kLine_Verb">kLine Verb</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kQuad_SegmentMask"> <code><strong>SkPath::kQuad_SegmentMask </strong></code> </a></td><td>2</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kQuad_Verb">kQuad Verb</a>. Note that <a href="#SkPath_conicTo">conicTo</a> may add a <a href="#Quad">Quad</a>.</td>
|
||||
<td><a name="SkPath_kQuad_SegmentMask"> <code><strong>SkPath::kQuad_SegmentMask </strong></code> </a></td><td>2</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kQuad_Verb">kQuad Verb</a>. Note that <a href="#SkPath_conicTo">conicTo</a> may add a <a href="#Quad">Quad</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kConic_SegmentMask"> <code><strong>SkPath::kConic_SegmentMask </strong></code> </a></td><td>4</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kConic_Verb">kConic Verb</a>.</td>
|
||||
<td><a name="SkPath_kConic_SegmentMask"> <code><strong>SkPath::kConic_SegmentMask </strong></code> </a></td><td>4</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kConic_Verb">kConic Verb</a>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkPath_kCubic_SegmentMask"> <code><strong>SkPath::kCubic_SegmentMask </strong></code> </a></td><td>8</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kCubic_Verb">kCubic Verb</a>.</td>
|
||||
<td><a name="SkPath_kCubic_SegmentMask"> <code><strong>SkPath::kCubic_SegmentMask </strong></code> </a></td><td>8</td><td>Set if <a href="#Verb_Array">Verb Array</a> contains <a href="#SkPath_kCubic_Verb">kCubic Verb</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="0972a1bd6e012c7519d3998afc32e69f"><div>When <a href="#SkPath_conicTo">conicTo</a> has a weight of one, <a href="#Quad">Quad</a> is added to <a href="#Path">Path</a>.</div>
|
||||
<div><fiddle-embed name="0972a1bd6e012c7519d3998afc32e69f"><div>When <a href="#SkPath_conicTo">conicTo</a> has a weight of one, <a href="#Quad">Quad</a> is added to <a href="#Path">Path</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -4705,12 +4773,14 @@ void <a href="#SkPath_Iter_setPath">setPath(const SkPath& path, bool forceClose)
|
||||
<a href="undocumented#SkScalar">SkScalar</a> <a href="#SkPath_Iter_conicWeight">conicWeight</a> const;
|
||||
bool <a href="#SkPath_Iter_isCloseLine">isCloseLine</a> const;
|
||||
bool <a href="#SkPath_Iter_isClosedContour">isClosedContour</a> const;
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="3ca8417e2a1466bf5b3ac97780a8070c"><div>Ignoring the actual <a href="#Verb">Verbs</a> and replacing them with <a href="#Quad">Quads</a> rounds the
|
||||
path of the glyph.</div></fiddle-embed></div>
|
||||
path of the glyph.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -4887,7 +4957,8 @@ followed by the <a href="#SkPath_kClose_Verb">kClose Verb</a>, the zero length <
|
||||
skip degenerate if <a href="#SkPath_Iter_next_exact">exact</a> skips the same as skip degenerate, but shows
|
||||
the very small <a href="undocumented#Line">Line</a>.
|
||||
|
||||
skip none shows all of the <a href="#Verb">Verbs</a> and <a href="SkPoint_Reference#Point">Points</a> in <a href="#Path">Path</a>.</div>
|
||||
skip none shows all of the <a href="#Verb">Verbs</a> and <a href="SkPoint_Reference#Point">Points</a> in <a href="#Path">Path</a>.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -5051,7 +5122,8 @@ void <a href="#SkPath_RawIter_setPath">setPath(const SkPath& path)</a>;
|
||||
<a href="#SkPath_Verb">Verb</a> <a href="#SkPath_RawIter_next">next(SkPoint pts[4])</a>;
|
||||
<a href="#SkPath_Verb">Verb</a> <a href="#SkPath_RawIter_peek">peek</a> const;
|
||||
<a href="undocumented#SkScalar">SkScalar</a> <a href="#SkPath_RawIter_conicWeight">conicWeight</a> const;
|
||||
}</pre>
|
||||
}
|
||||
</pre>
|
||||
|
||||
<a name="SkPath_RawIter_RawIter"></a>
|
||||
## RawIter
|
||||
|
@ -155,7 +155,8 @@ initialized <a href="#Pixmap">Pixmap</a>
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="9a00774be57d7308313b3a9073e6e696"><div><a href="SkImage_Reference#SkImage_MakeRasterCopy">SkImage::MakeRasterCopy</a> takes const <a href="#SkPixmap">SkPixmap</a>& as an argument. The example
|
||||
constructs a <a href="#SkPixmap">SkPixmap</a> from the brace-delimited parameters.</div>
|
||||
constructs a <a href="#SkPixmap">SkPixmap</a> from the brace-delimited parameters.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -501,10 +502,10 @@ pixmap height: 32 info height: 32
|
||||
SkColorType colorType() const
|
||||
</pre>
|
||||
|
||||
Returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>, <a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>.
|
||||
Returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a>, one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a>.
|
||||
|
||||
### Return Value
|
||||
|
||||
@ -578,7 +579,8 @@ immutable.
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="34c71f803b8edb48eaf1cd0c55bb212e"><div><a href="undocumented#SkColorSpace_MakeSRGBLinear">SkColorSpace::MakeSRGBLinear</a> creates <a href="undocumented#Color_Space">Color Space</a> with linear gamma
|
||||
and an sRGB gamut. This <a href="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.</div>
|
||||
and an sRGB gamut. This <a href="undocumented#Color_Space">Color Space</a> gamma is not close to sRGB gamma.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -611,7 +613,8 @@ true if <a href="SkImageInfo_Reference#Image_Info">Image Info</a> has opaque <a
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="efd083f121e888a523455ea8a49e50d1"><div><a href="#SkPixmap_isOpaque">isOpaque</a> ignores whether all pixels are opaque or not.</div>
|
||||
<div><fiddle-embed name="efd083f121e888a523455ea8a49e50d1"><div><a href="#SkPixmap_isOpaque">isOpaque</a> ignores whether all pixels are opaque or not.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1449,7 +1452,8 @@ writable unsigned 8-bit pointer to pixels
|
||||
|
||||
<div><fiddle-embed name="809284db136748208b3efc31cd89de29"><div>Altering pixels after drawing <a href="SkBitmap_Reference#Bitmap">Bitmap</a> is not guaranteed to affect subsequent
|
||||
drawing on all platforms. Adding a second <a href="SkBitmap_Reference#SkBitmap_installPixels">SkBitmap::installPixels</a> after editing
|
||||
pixel memory is safer.</div></fiddle-embed></div>
|
||||
pixel memory is safer.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1486,7 +1490,8 @@ writable unsigned 16-bit pointer to pixel
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="6da54774f6432b46b47ea9013c15f280"><div>Draw a five by five bitmap, and draw it again with a center black pixel.
|
||||
The low nibble of the 16-bit word is <a href="undocumented#Alpha">Alpha</a>.</div></fiddle-embed></div>
|
||||
The low nibble of the 16-bit word is <a href="undocumented#Alpha">Alpha</a>.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1597,7 +1602,8 @@ writable unsigned 16-bit pointer to first component of pixel
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="7822d78f5cacf5c04267cbbc6c6d0b80"><div>Left bitmap is drawn with two pixels defined in half float format. Right bitmap
|
||||
is drawn after overwriting bottom half float color with top half float color.</div></fiddle-embed></div>
|
||||
is drawn after overwriting bottom half float color with top half float color.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1727,7 +1733,8 @@ true if pixels are copied to <a href="#SkPixmap_readPixels_2_dstPixels">dstPixel
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="df4e355c4845350daede833b4fd21ec1"><div>Transferring the gradient from 8 bits per component to 4 bits per component
|
||||
creates visible banding.</div></fiddle-embed></div>
|
||||
creates visible banding.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
|
@ -496,7 +496,8 @@ SkScalar length() const
|
||||
Returns the Euclidean_Distance from origin, computed as:
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
sqrt(fX * fX + fY * fY)</pre>
|
||||
sqrt(fX * fX + fY * fY)
|
||||
</pre>
|
||||
|
||||
.
|
||||
|
||||
@ -524,7 +525,8 @@ SkScalar distanceToOrigin() const
|
||||
Returns the Euclidean_Distance from origin, computed as:
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
sqrt(fX * fX + fY * fY)</pre>
|
||||
sqrt(fX * fX + fY * fY)
|
||||
</pre>
|
||||
|
||||
.
|
||||
|
||||
@ -813,7 +815,8 @@ void operator+=(const SkVector& v)
|
||||
</pre>
|
||||
|
||||
Adds <a href="#Vector">Vector</a> <a href="#SkPoint_addto_operator_v">v</a> to <a href="#Point">Point</a>. Sets <a href="#Point">Point</a> to:
|
||||
(<a href="#SkPoint_fX">fX</a> + <a href="#SkPoint_addto_operator_v">v</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a> + <a href="#SkPoint_addto_operator_v">v</a>.<a href="#SkPoint_fY">fY</a>).
|
||||
(<a href="#SkPoint_fX">fX</a> + <a href="#SkPoint_addto_operator_v">v</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a> + <a href="#SkPoint_addto_operator_v">v</a>.<a href="#SkPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -840,7 +843,8 @@ void operator-=(const SkVector& v)
|
||||
</pre>
|
||||
|
||||
Subtracts <a href="#Vector">Vector</a> <a href="#SkPoint_subtractfrom_operator_v">v</a> from <a href="#Point">Point</a>. Sets <a href="#Point">Point</a> to:
|
||||
(<a href="#SkPoint_fX">fX</a> - <a href="#SkPoint_subtractfrom_operator_v">v</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a> - <a href="#SkPoint_subtractfrom_operator_v">v</a>.<a href="#SkPoint_fY">fY</a>).
|
||||
(<a href="#SkPoint_fX">fX</a> - <a href="#SkPoint_subtractfrom_operator_v">v</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a> - <a href="#SkPoint_subtractfrom_operator_v">v</a>.<a href="#SkPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
### Parameters
|
||||
|
||||
@ -1090,7 +1094,8 @@ pt: nan, -1 != pt
|
||||
SkVector operator-(const SkPoint& a, const SkPoint& b)
|
||||
</pre>
|
||||
|
||||
Returns <a href="#Vector">Vector</a> from <a href="#SkPoint_subtract_operator_b">b</a> to <a href="#SkPoint_subtract_operator_a">a</a>, computed as(<a href="#SkPoint_subtract_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> - <a href="#SkPoint_subtract_operator_b">b</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_subtract_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> - <a href="#SkPoint_subtract_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>).
|
||||
Returns <a href="#Vector">Vector</a> from <a href="#SkPoint_subtract_operator_b">b</a> to <a href="#SkPoint_subtract_operator_a">a</a>, computed as(<a href="#SkPoint_subtract_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> - <a href="#SkPoint_subtract_operator_b">b</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_subtract_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> - <a href="#SkPoint_subtract_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
Can also be used to subtract <a href="#Vector">Vector</a> from <a href="#Point">Point</a>, returning <a href="#Point">Point</a>.
|
||||
Can also be used to subtract <a href="#Vector">Vector</a> from <a href="#Vector">Vector</a>, returning <a href="#Vector">Vector</a>.
|
||||
@ -1126,7 +1131,8 @@ SkPoint operator+(const SkPoint& a, const SkVector& b)
|
||||
</pre>
|
||||
|
||||
Returns <a href="#Point">Point</a> resulting from <a href="#Point">Point</a> <a href="#SkPoint_add_operator_a">a</a> offset by <a href="#Vector">Vector</a> <a href="#SkPoint_add_operator_b">b</a>, computed as:
|
||||
(<a href="#SkPoint_add_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> + <a href="#SkPoint_add_operator_b">b</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_add_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> + <a href="#SkPoint_add_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>).
|
||||
(<a href="#SkPoint_add_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> + <a href="#SkPoint_add_operator_b">b</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_add_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> + <a href="#SkPoint_add_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>)
|
||||
.
|
||||
|
||||
Can also be used to offset <a href="#Point">Point</a> <a href="#SkPoint_add_operator_b">b</a> by <a href="#Vector">Vector</a> <a href="#SkPoint_add_operator_a">a</a>, returning <a href="#Point">Point</a>.
|
||||
Can also be used to add <a href="#Vector">Vector</a> to <a href="#Vector">Vector</a>, returning <a href="#Vector">Vector</a>.
|
||||
@ -1164,7 +1170,8 @@ static SkScalar Length(SkScalar x, SkScalar y)
|
||||
Returns the Euclidean_Distance from origin, computed as:
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
sqrt(x * x + y * y)</pre>
|
||||
sqrt(x * x + y * y)
|
||||
</pre>
|
||||
|
||||
.
|
||||
|
||||
|
@ -360,7 +360,8 @@ rect: 5, 25, 15, 35 isEmpty: false
|
||||
static constexpr SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w, SkScalar h)
|
||||
</pre>
|
||||
|
||||
Returns constructed <a href="#Rect">Rect</a> set to(x, y, x + <a href="#SkRect_MakeXYWH_w">w</a>, y + <a href="#SkRect_MakeXYWH_h">h</a>).
|
||||
Returns constructed <a href="#Rect">Rect</a> set to(x, y, x + <a href="#SkRect_MakeXYWH_w">w</a>, y + <a href="#SkRect_MakeXYWH_h">h</a>)
|
||||
.
|
||||
Does not validate input;
|
||||
<a href="#SkRect_MakeXYWH_w">w</a> or <a href="#SkRect_MakeXYWH_h">h</a> may be negative.
|
||||
|
||||
@ -822,7 +823,8 @@ result fits in 32-bit float; result may be negative or infinity.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="11f8f0efe6291019fee0ac17844f6c1a"><div>Compare with <a href="SkIRect_Reference#SkIRect_width">SkIRect::width()</a> example.</div>
|
||||
<div><fiddle-embed name="11f8f0efe6291019fee0ac17844f6c1a"><div>Compare with <a href="SkIRect_Reference#SkIRect_width">SkIRect::width()</a> example.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -855,7 +857,8 @@ result fits in 32-bit float; result may be negative or infinity.
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="39429e45f05240218ecd511443ab3e44"><div>Compare with <a href="SkIRect_Reference#SkIRect_height">SkIRect::height()</a> example.</div>
|
||||
<div><fiddle-embed name="39429e45f05240218ecd511443ab3e44"><div>Compare with <a href="SkIRect_Reference#SkIRect_height">SkIRect::height()</a> example.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -1401,7 +1404,8 @@ corner to include</td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="ee72450381f768f3869153cdbeccdc3e"><div><a href="#SkRect_set_4_p0">p0</a> and <a href="#SkRect_set_4_p1">p1</a> may be swapped and have the same effect unless one contains NaN.</div></fiddle-embed></div>
|
||||
<div><fiddle-embed name="ee72450381f768f3869153cdbeccdc3e"><div><a href="#SkRect_set_4_p0">p0</a> and <a href="#SkRect_set_4_p1">p1</a> may be swapped and have the same effect unless one contains NaN.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1416,7 +1420,8 @@ corner to include</td>
|
||||
void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height)
|
||||
</pre>
|
||||
|
||||
Sets <a href="#Rect">Rect</a> to(x, y, x + width, y + height).
|
||||
Sets <a href="#Rect">Rect</a> to(x, y, x + width, y + height)
|
||||
.
|
||||
Does not validate input;
|
||||
width or height may be negative.
|
||||
|
||||
@ -1934,7 +1939,8 @@ must describe area; <a href="#SkRect_fLeft">fLeft</a> is less than <a href="#SkR
|
||||
empty() returns false. The intersection of <a href="#Rect">Rect</a> pair can be described by:
|
||||
|
||||
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
|
||||
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)).
|
||||
min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))
|
||||
.
|
||||
|
||||
The intersection is only meaningful if the resulting <a href="#Rect">Rect</a> is not empty and
|
||||
describes an area: <a href="#SkRect_fLeft">fLeft</a> is less than <a href="#SkRect_fRight">fRight</a>, and <a href="#SkRect_fTop">fTop</a> is less than <a href="#SkRect_fBottom">fBottom</a>.
|
||||
@ -2103,7 +2109,8 @@ true if <a href="#SkRect_intersect_r">r</a> and <a href="#Rect">Rect</a> have ar
|
||||
|
||||
<div><fiddle-embed name="70e5b3979fc8a31eda070cfed91bc271"><div>Two <a href="undocumented#SkDebugf">SkDebugf</a> calls are required. If the calls are combined, their arguments
|
||||
may not be evaluated in left to right order: the printed intersection may
|
||||
be before or after the call to intersect.</div>
|
||||
be before or after the call to intersect.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2154,7 +2161,8 @@ true if construction and <a href="#Rect">Rect</a> have area in common
|
||||
|
||||
<div><fiddle-embed name="9f06dad5e6c712f7a2c149d075e816d2"><div>Two <a href="undocumented#SkDebugf">SkDebugf</a> calls are required. If the calls are combined, their arguments
|
||||
may not be evaluated in left to right order: the printed intersection may
|
||||
be before or after the call to intersect.</div>
|
||||
be before or after the call to intersect.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2453,7 +2461,8 @@ expansion <a href="#Rect">Rect</a></td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="88439de2aa0911262c60c0eb506396cb"><div>Since <a href="#Rect">Rect</a> is not sorted, first result is copy of toJoin.</div>
|
||||
<div><fiddle-embed name="88439de2aa0911262c60c0eb506396cb"><div>Since <a href="#Rect">Rect</a> is not sorted, first result is copy of toJoin.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
@ -2490,7 +2499,8 @@ expansion <a href="#Rect">Rect</a></td>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="a476548d0001296afd8e58c1eba1b70b"><div>Since <a href="#Rect">Rect</a> is not sorted, first result is not useful.</div>
|
||||
<div><fiddle-embed name="a476548d0001296afd8e58c1eba1b70b"><div>Since <a href="#Rect">Rect</a> is not sorted, first result is not useful.
|
||||
</div>
|
||||
|
||||
#### Example Output
|
||||
|
||||
|
@ -413,7 +413,7 @@ fonts; may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {
|
||||
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
GrContext* context = canvas->getGrContext();
|
||||
@ -428,7 +428,7 @@ void draw(SkCanvas* canvas) {
|
||||
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
|
||||
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
|
||||
canvas->drawImage(image, 0, 0);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
### See Also
|
||||
@ -472,10 +472,10 @@ one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurface
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTexture_2_sampleCnt"> <code><strong>sampleCnt </strong></code> </a></td> <td>
|
||||
samples per pixel, or 0 to disable full scene anti-aliasing</td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTexture_2_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a></td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTexture_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
|
||||
range of colors</td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTexture_2_surfaceProps"> <code><strong>surfaceProps </strong></code> </a></td> <td>
|
||||
@ -491,7 +491,7 @@ fonts; may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {
|
||||
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
GrContext* context = canvas->getGrContext();
|
||||
@ -507,7 +507,7 @@ void draw(SkCanvas* canvas) {
|
||||
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
|
||||
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
|
||||
canvas->drawImage(image, 0, 0);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
### See Also
|
||||
@ -562,7 +562,7 @@ fonts; may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {
|
||||
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
GrContext* context = canvas->getGrContext();
|
||||
@ -577,7 +577,7 @@ void draw(SkCanvas* canvas) {
|
||||
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
|
||||
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
|
||||
canvas->drawImage(image, 0, 0);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
### See Also
|
||||
@ -617,10 +617,10 @@ GPU intermediate memory buffer</td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendRenderTarget_2_origin"> <code><strong>origin </strong></code> </a></td> <td>
|
||||
one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>, <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a></td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendRenderTarget_2_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a></td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendRenderTarget_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
|
||||
range of colors</td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendRenderTarget_2_surfaceProps"> <code><strong>surfaceProps </strong></code> </a></td> <td>
|
||||
@ -636,7 +636,7 @@ fonts; may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {
|
||||
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
GrContext* context = canvas->getGrContext();
|
||||
@ -652,7 +652,7 @@ void draw(SkCanvas* canvas) {
|
||||
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
|
||||
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
|
||||
canvas->drawImage(image, 0, 0);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
### See Also
|
||||
@ -705,7 +705,7 @@ fonts; may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {SkPaint paint;
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
GrContext* context = canvas->getGrContext();
|
||||
if (!context) {
|
||||
@ -720,7 +720,7 @@ void draw(SkCanvas* canvas) {SkPaint paint;
|
||||
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
|
||||
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
|
||||
canvas->drawImage(image, 0, 0);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
### See Also
|
||||
@ -758,10 +758,10 @@ one of: <a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurface
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTextureAsRenderTarget_2_sampleCnt"> <code><strong>sampleCnt </strong></code> </a></td> <td>
|
||||
samples per pixel, or 0 to disable full scene anti-aliasing</td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTextureAsRenderTarget_2_colorType"> <code><strong>colorType </strong></code> </a></td> <td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>, <a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a></td>
|
||||
one of: <a href="SkImageInfo_Reference#kUnknown_SkColorType">kUnknown_SkColorType</a>, <a href="SkImageInfo_Reference#kAlpha_8_SkColorType">kAlpha_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_565_SkColorType">kRGB_565_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kARGB_4444_SkColorType">kARGB_4444_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_8888_SkColorType">kRGBA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_888x_SkColorType">kRGB_888x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kBGRA_8888_SkColorType">kBGRA_8888_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_1010102_SkColorType">kRGBA_1010102_SkColorType</a>, <a href="SkImageInfo_Reference#kRGB_101010x_SkColorType">kRGB_101010x_SkColorType</a>,
|
||||
<a href="SkImageInfo_Reference#kGray_8_SkColorType">kGray_8_SkColorType</a>, <a href="SkImageInfo_Reference#kRGBA_F16_SkColorType">kRGBA_F16_SkColorType</a> </td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTextureAsRenderTarget_2_colorSpace"> <code><strong>colorSpace </strong></code> </a></td> <td>
|
||||
range of colors</td>
|
||||
</tr> <tr> <td><a name="SkSurface_MakeFromBackendTextureAsRenderTarget_2_surfaceProps"> <code><strong>surfaceProps </strong></code> </a></td> <td>
|
||||
@ -777,7 +777,7 @@ fonts; may be nullptr</td>
|
||||
### Example
|
||||
|
||||
<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0">
|
||||
void draw(SkCanvas* canvas) {SkPaint paint;
|
||||
SkPaint paint;
|
||||
paint.setTextSize(32);
|
||||
GrContext* context = canvas->getGrContext();
|
||||
if (!context) {
|
||||
@ -792,7 +792,7 @@ void draw(SkCanvas* canvas) {SkPaint paint;
|
||||
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
|
||||
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
|
||||
canvas->drawImage(image, 0, 0);
|
||||
}
|
||||
|
||||
</pre>
|
||||
|
||||
### See Also
|
||||
@ -911,7 +911,8 @@ fonts; may be nullptr</td>
|
||||
<div><fiddle-embed name="640321e8ecfb3f9329f3bc6e1f02485f" gpu="true" cpu="true"><div>LCD text takes advantage of raster striping to improve resolution. Only one of
|
||||
the four combinations is correct, depending on whether monitor LCD striping is
|
||||
horizontal or vertical, and whether the order of the stripes is red blue green
|
||||
or red green blue.</div></fiddle-embed></div>
|
||||
or red green blue.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1117,7 +1118,8 @@ surface generationID: 3
|
||||
enum <a href="#SkSurface_ContentChangeMode">ContentChangeMode</a> {
|
||||
<a href="#SkSurface_kDiscard_ContentChangeMode">kDiscard ContentChangeMode</a>,
|
||||
<a href="#SkSurface_kRetain_ContentChangeMode">kRetain ContentChangeMode</a>,
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a href="#SkSurface_ContentChangeMode">ContentChangeMode</a> members are parameters to <a href="#SkSurface_notifyContentWillChange">notifyContentWillChange</a>.
|
||||
|
||||
@ -1125,10 +1127,12 @@ enum <a href="#SkSurface_ContentChangeMode">ContentChangeMode</a> {
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkSurface_kDiscard_ContentChangeMode"> <code><strong>SkSurface::kDiscard_ContentChangeMode </strong></code> </a></td><td>Pass to notifyContentWillChange to discard surface contents when</td><td>the surface is cleared or overwritten.</td>
|
||||
<td><a name="SkSurface_kDiscard_ContentChangeMode"> <code><strong>SkSurface::kDiscard_ContentChangeMode </strong></code> </a></td><td>Pass to notifyContentWillChange to discard surface contents when</td><td>the surface is cleared or overwritten.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkSurface_kRetain_ContentChangeMode"> <code><strong>SkSurface::kRetain_ContentChangeMode </strong></code> </a></td><td>Pass to notifyContentWillChange when to preserve surface contents.</td><td>If a snapshot has been generated, this copies the <a href="#Surface">Surface</a> contents.</td>
|
||||
<td><a name="SkSurface_kRetain_ContentChangeMode"> <code><strong>SkSurface::kRetain_ContentChangeMode </strong></code> </a></td><td>Pass to notifyContentWillChange when to preserve surface contents.</td><td>If a snapshot has been generated, this copies the <a href="#Surface">Surface</a> contents.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1187,19 +1191,23 @@ static const <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> <a
|
||||
static const <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> <a href="#SkSurface_kFlushWrite_TextureHandleAccess">kFlushWrite TextureHandleAccess</a> =
|
||||
<a href="#SkSurface_kFlushWrite_BackendHandleAccess">kFlushWrite BackendHandleAccess</a>;
|
||||
static const <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> <a href="#SkSurface_kDiscardWrite_TextureHandleAccess">kDiscardWrite TextureHandleAccess</a> =
|
||||
<a href="#SkSurface_kDiscardWrite_BackendHandleAccess">kDiscardWrite BackendHandleAccess</a>;</pre>
|
||||
<a href="#SkSurface_kDiscardWrite_BackendHandleAccess">kDiscardWrite BackendHandleAccess</a>;
|
||||
</pre>
|
||||
|
||||
### Constants
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="SkSurface_kFlushRead_BackendHandleAccess"> <code><strong>SkSurface::kFlushRead_BackendHandleAccess </strong></code> </a></td><td>0</td><td>Caller may read from the back-end object.</td>
|
||||
<td><a name="SkSurface_kFlushRead_BackendHandleAccess"> <code><strong>SkSurface::kFlushRead_BackendHandleAccess </strong></code> </a></td><td>0</td><td>Caller may read from the back-end object.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkSurface_kFlushWrite_BackendHandleAccess"> <code><strong>SkSurface::kFlushWrite_BackendHandleAccess </strong></code> </a></td><td>1</td><td>Caller may write to the back-end object.</td>
|
||||
<td><a name="SkSurface_kFlushWrite_BackendHandleAccess"> <code><strong>SkSurface::kFlushWrite_BackendHandleAccess </strong></code> </a></td><td>1</td><td>Caller may write to the back-end object.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkSurface_kDiscardWrite_BackendHandleAccess"> <code><strong>SkSurface::kDiscardWrite_BackendHandleAccess </strong></code> </a></td><td>2</td><td>Caller must overwrite the entire back-end object.</td>
|
||||
<td><a name="SkSurface_kDiscardWrite_BackendHandleAccess"> <code><strong>SkSurface::kDiscardWrite_BackendHandleAccess </strong></code> </a></td><td>2</td><td>Caller must overwrite the entire back-end object.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkSurface_kFlushRead_TextureHandleAccess"> <code><strong>SkSurface::kFlushRead_TextureHandleAccess </strong></code> </a></td><td>0</td><td></td>
|
||||
@ -1582,7 +1590,8 @@ true if pixels were copied
|
||||
|
||||
<div><fiddle-embed name="d141d6c662d201d191fb1eea26d014fd"><div>A black oval drawn on a red background provides an image to copy.
|
||||
<a href="#SkSurface_readPixels">readPixels</a> copies one quarter of the <a href="#Surface">Surface</a> into each of the four corners.
|
||||
The copied quarter ovals overdraw the original oval.</div></fiddle-embed></div>
|
||||
The copied quarter ovals overdraw the original oval.
|
||||
</div></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
@ -1657,7 +1666,8 @@ void writePixels(const SkPixmap& src, int dstX, int dstY)
|
||||
Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from the <a href="#SkSurface_writePixels_src">src</a> <a href="SkPixmap_Reference#Pixmap">Pixmap</a> to the <a href="#Surface">Surface</a>.
|
||||
|
||||
Source <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkSurface_writePixels_src">src</a>.<a href="#SkSurface_width">width</a>, <a href="#SkSurface_writePixels_src">src</a>.<a href="#SkSurface_height">height</a>).
|
||||
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_writePixels_dstX">dstX</a>, <a href="#SkSurface_writePixels_dstY">dstY</a>) and(<a href="#SkSurface_writePixels_dstX">dstX</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_width">width</a>, <a href="#SkSurface_writePixels_dstY">dstY</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_height">height</a>).
|
||||
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_writePixels_dstX">dstX</a>, <a href="#SkSurface_writePixels_dstY">dstY</a>) and(<a href="#SkSurface_writePixels_dstX">dstX</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_width">width</a>, <a href="#SkSurface_writePixels_dstY">dstY</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_height">height</a>)
|
||||
.
|
||||
|
||||
Copies each readable pixel intersecting both rectangles, without scaling,
|
||||
converting to <a href="#Surface">Surface</a> colorType() and <a href="#Surface">Surface</a> alphaType() if required.
|
||||
@ -1692,7 +1702,8 @@ void writePixels(const SkBitmap& src, int dstX, int dstY)
|
||||
Copies <a href="SkRect_Reference#Rect">Rect</a> of pixels from the <a href="#SkSurface_writePixels_2_src">src</a> <a href="SkBitmap_Reference#Bitmap">Bitmap</a> to the <a href="#Surface">Surface</a>.
|
||||
|
||||
Source <a href="SkRect_Reference#Rect">Rect</a> corners are (0, 0) and (<a href="#SkSurface_writePixels_2_src">src</a>.<a href="#SkSurface_width">width</a>, <a href="#SkSurface_writePixels_2_src">src</a>.<a href="#SkSurface_height">height</a>).
|
||||
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_writePixels_2_dstX">dstX</a>, <a href="#SkSurface_writePixels_2_dstY">dstY</a>) and(<a href="#SkSurface_writePixels_2_dstX">dstX</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_width">width</a>, <a href="#SkSurface_writePixels_2_dstY">dstY</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_height">height</a>).
|
||||
Destination <a href="SkRect_Reference#Rect">Rect</a> corners are (<a href="#SkSurface_writePixels_2_dstX">dstX</a>, <a href="#SkSurface_writePixels_2_dstY">dstY</a>) and(<a href="#SkSurface_writePixels_2_dstX">dstX</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_width">width</a>, <a href="#SkSurface_writePixels_2_dstY">dstY</a> + <a href="#Surface">Surface</a> <a href="#SkSurface_height">height</a>)
|
||||
.
|
||||
|
||||
Copies each readable pixel intersecting both rectangles, without scaling,
|
||||
converting to <a href="#Surface">Surface</a> colorType() and <a href="#Surface">Surface</a> alphaType() if required.
|
||||
@ -1864,9 +1875,15 @@ array of semaphore containers</td>
|
||||
|
||||
true if GPU is waiting on semaphores
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="c9033080af68efc0f270d748f1c0e011"></fiddle-embed></div>
|
||||
# gpu<a href="SkPaint_Reference#SkPaint">SkPaint</a> paint;
|
||||
paint.setTextSize(32);
|
||||
<a href="undocumented#GrContext">GrContext</a>* context = canvas->getGrContext();
|
||||
if (!context) {
|
||||
canvas->drawString("GPU only!", 20, 40, paint);
|
||||
return;
|
||||
}
|
||||
<a href="undocumented#GrBackendSemaphore">GrBackendSemaphore</a> semaphore;
|
||||
<a href="undocumented#sk_sp">sk sp</a><<a href="#SkSurface">SkSurface</a>> surface =
|
||||
|
||||
### See Also
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
"hash": "fe79a9c1ec350264eb9c7b2509dd3638",
|
||||
"file": "SkBitmap_Reference",
|
||||
"name": "SkBitmap::HeapAllocator::allocPixelRef",
|
||||
"stdout": "pixel address = (nil)\\npixel address = 0x560ddd0ac670\\n"
|
||||
"stdout": "pixel address = (nil)\\npixel address = 0x560ddd0ac670\\n\\n"
|
||||
},
|
||||
"SkBitmap_alphaType": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n SkPixmap pixmap(SkImageInfo::MakeA8(16, 32), nullptr, 64);\n SkDebugf(\"alpha type: k\" \"%s\" \"_SkAlphaType\\n\", alphas[pixmap.alphaType()]);\n}",
|
||||
@ -57,11 +57,11 @@
|
||||
"stdout": "alpha type: kPremul_SkAlphaType\\n"
|
||||
},
|
||||
"SkBitmap_bytesPerPixel": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkImageInfo info = SkImageInfo::MakeA8(1, 1);\n SkBitmap bitmap;\n for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,\n kRGB_565_SkColorType, kARGB_4444_SkColorType, \n kRGBA_8888_SkColorType,\n kBGRA_8888_SkColorType, kGray_8_SkColorType,\n kRGBA_F16_SkColorType } ) {\n bitmap.setInfo(info.makeColorType(colorType));\n SkDebugf(\"color: k\" \"%s\" \"_SkColorType\" \"%*s\" \"bytesPerPixel: %d\\n\",\n colors[colorType], 13 - strlen(colors[colorType]), \" \",\n bitmap.bytesPerPixel());\n }\n}",
|
||||
"hash": "4bfe28ea3f70f3bfd73d956e913c1a20",
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkImageInfo info = SkImageInfo::MakeA8(1, 1);\n SkBitmap bitmap;\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n bitmap.setInfo(info.makeColorType(colorType));\n SkDebugf(\"color: k\" \"%s\" \"_SkColorType\" \"%*s\" \"bytesPerPixel: %d\\n\",\n colors[colorType], 13 - strlen(colors[colorType]), \" \",\n bitmap.bytesPerPixel());\n }\n}",
|
||||
"hash": "2a688e6f0a516c0d44a826381e9d637f",
|
||||
"file": "SkBitmap_Reference",
|
||||
"name": "SkBitmap::bytesPerPixel",
|
||||
"stdout": "color: kUnknown_SkColorType bytesPerPixel: 0\\ncolor: kAlpha_8_SkColorType bytesPerPixel: 1\\ncolor: kRGB_565_SkColorType bytesPerPixel: 2\\ncolor: kARGB_4444_SkColorType bytesPerPixel: 2\\ncolor: kRGBA_8888_SkColorType bytesPerPixel: 4\\ncolor: kBGRA_8888_SkColorType bytesPerPixel: 4\\ncolor: kGray_8_SkColorType bytesPerPixel: 1\\ncolor: kRGBA_F16_SkColorType bytesPerPixel: 8\\n"
|
||||
"stdout": "color: kUnknown_SkColorType bytesPerPixel: 0\\ncolor: kAlpha_8_SkColorType bytesPerPixel: 1\\ncolor: kRGB_565_SkColorType bytesPerPixel: 2\\ncolor: kARGB_4444_SkColorType bytesPerPixel: 2\\ncolor: kRGBA_8888_SkColorType bytesPerPixel: 4\\ncolor: kRGB_888x_SkColorType bytesPerPixel: 4\\ncolor: kBGRA_8888_SkColorType bytesPerPixel: 4\\ncolor: kRGBA_1010102_SkColorType bytesPerPixel: 4\\ncolor: kRGB_101010x_SkColorType bytesPerPixel: 4\\ncolor: kGray_8_SkColorType bytesPerPixel: 1\\ncolor: kRGBA_F16_SkColorType bytesPerPixel: 8\\n"
|
||||
},
|
||||
"SkBitmap_colorSpace": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType, \n SkColorSpace::MakeSRGBLinear()));\n SkColorSpace* colorSpace = bitmap.colorSpace();\n SkDebugf(\"gammaCloseToSRGB: %s gammaIsLinear: %s isSRGB: %s\\n\",\n colorSpace->gammaCloseToSRGB() ? \"true\" : \"false\",\n colorSpace->gammaIsLinear() ? \"true\" : \"false\",\n colorSpace->isSRGB() ? \"true\" : \"false\");\n}",
|
||||
@ -173,7 +173,7 @@
|
||||
"hash": "db9dd91e0207c3941c09538555817b4b",
|
||||
"file": "SkBitmap_Reference",
|
||||
"name": "SkBitmap::getGenerationID",
|
||||
"stdout": "empty id 0\\nalloc id 4\\nerase id 6\\n"
|
||||
"stdout": "empty id 0\\nalloc id 4\\nerase id 6\\n\\n"
|
||||
},
|
||||
"SkBitmap_getPixels": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType));\n bitmap.allocPixels();\n bitmap.eraseColor(0x00000000);\n void* baseAddr = bitmap.getPixels();\n *(SkPMColor*)baseAddr = 0xFFFFFFFF;\n SkDebugf(\"bitmap.getColor(0, 1) %c= 0x00000000\\n\",\n bitmap.getColor(0, 1) == 0x00000000 ? '=' : '!');\n SkDebugf(\"bitmap.getColor(0, 0) %c= 0xFFFFFFFF\\n\",\n bitmap.getColor(0, 0) == 0xFFFFFFFF ? '=' : '!');\n}",
|
||||
@ -309,11 +309,11 @@
|
||||
"stdout": "rowBytes: 4 rowBytesAsPixels: 1\\nrowBytes: 5 rowBytesAsPixels: 1\\nrowBytes: 6 rowBytesAsPixels: 1\\nrowBytes: 7 rowBytesAsPixels: 1\\nrowBytes: 8 rowBytesAsPixels: 2\\n"
|
||||
},
|
||||
"SkBitmap_setAlphaType": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n const char* alphas[] = {\"Unknown \", \"Opaque \", \"Premul \", \"Unpremul\"}; \n SkBitmap bitmap;\n SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,\n kPremul_SkAlphaType, kUnpremul_SkAlphaType };\n SkDebugf(\"%88s\", \"Canonical Unknown Opaque Premul Unpremul\\n\");\n for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType, \n kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {\n for (SkAlphaType canonicalAlphaType : alphaTypes) {\n SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );\n SkDebugf(\"%10s %10s \", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);\n for (SkAlphaType alphaType : alphaTypes) {\n bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));\n bool result = bitmap.setAlphaType(alphaType);\n SkDebugf(\"%s %s \", result ? \"true \" : \"false\", alphas[(int) bitmap.alphaType()]);\n }\n SkDebugf(\"\\n\");\n }\n }\n}\n",
|
||||
"hash": "9394975fa8a13204a5cc2e94f86737e5",
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* colors[] = { \"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\" };\n const char* alphas[] = {\"Unknown \", \"Opaque \", \"Premul \", \"Unpremul\"}; \n SkBitmap bitmap;\n SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,\n kPremul_SkAlphaType, kUnpremul_SkAlphaType };\n SkDebugf(\"%88s\", \"Canonical Unknown Opaque Premul Unpremul\\n\");\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n for (SkAlphaType canonicalAlphaType : alphaTypes) {\n SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );\n SkDebugf(\"%10s %10s \", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);\n for (SkAlphaType alphaType : alphaTypes) {\n bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));\n bool result = bitmap.setAlphaType(alphaType);\n SkDebugf(\"%s %s \", result ? \"true \" : \"false\", alphas[(int) bitmap.alphaType()]);\n }\n SkDebugf(\"\\n\");\n }\n }\n}\n",
|
||||
"hash": "38cec6acbba80274232a85539ab34af1",
|
||||
"file": "SkBitmap_Reference",
|
||||
"name": "SkBitmap::setAlphaType",
|
||||
"stdout": "Canonical Unknown Opaque Premul Unpremul\\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Alpha_8 Unknown true Unknown true Unknown true Unknown true Unknown \\n Alpha_8 Opaque false Opaque true Opaque true Premul true Premul \\n Alpha_8 Premul false Premul true Opaque true Premul true Premul \\n Alpha_8 Unpremul false Premul true Opaque true Premul true Premul \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n ARGB_4444 Unknown true Unknown true Unknown true Unknown true Unknown \\n ARGB_4444 Opaque false Opaque true Opaque true Premul true Unpremul \\n ARGB_4444 Premul false Premul true Opaque true Premul true Unpremul \\n ARGB_4444 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n RGBA_8888 Unknown true Unknown true Unknown true Unknown true Unknown \\n RGBA_8888 Opaque false Opaque true Opaque true Premul true Unpremul \\n RGBA_8888 Premul false Premul true Opaque true Premul true Unpremul \\n RGBA_8888 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n BGRA_8888 Unknown true Unknown true Unknown true Unknown true Unknown \\n BGRA_8888 Opaque false Opaque true Opaque true Premul true Unpremul \\n BGRA_8888 Premul false Premul true Opaque true Premul true Unpremul \\n BGRA_8888 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGBA_F16 Unknown true Unknown true Unknown true Unknown true Unknown \\n RGBA_F16 Opaque false Opaque true Opaque true Premul true Unpremul \\n RGBA_F16 Premul false Premul true Opaque true Premul true Unpremul \\n RGBA_F16 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n"
|
||||
"stdout": "Canonical Unknown Opaque Premul Unpremul\\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Unknown Unknown true Unknown true Unknown true Unknown true Unknown \\n Alpha_8 Unknown true Unknown true Unknown true Unknown true Unknown \\n Alpha_8 Opaque false Opaque true Opaque true Premul true Premul \\n Alpha_8 Premul false Premul true Opaque true Premul true Premul \\n Alpha_8 Unpremul false Premul true Opaque true Premul true Premul \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_565 Opaque true Opaque true Opaque true Opaque true Opaque \\n ARGB_4444 Unknown true Unknown true Unknown true Unknown true Unknown \\n ARGB_4444 Opaque false Opaque true Opaque true Premul true Unpremul \\n ARGB_4444 Premul false Premul true Opaque true Premul true Unpremul \\n ARGB_4444 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n RGBA_8888 Unknown true Unknown true Unknown true Unknown true Unknown \\n RGBA_8888 Opaque false Opaque true Opaque true Premul true Unpremul \\n RGBA_8888 Premul false Premul true Opaque true Premul true Unpremul \\n RGBA_8888 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n RGB_888x Opaque true Opaque true Opaque true Opaque true Opaque \\n BGRA_8888 Unknown true Unknown true Unknown true Unknown true Unknown \\n BGRA_8888 Opaque false Opaque true Opaque true Premul true Unpremul \\n BGRA_8888 Premul false Premul true Opaque true Premul true Unpremul \\n BGRA_8888 Unpremul false Unpremul true Opaque true Premul true Unpremul \\nRGBA_1010102 Unknown true Unknown true Unknown true Unknown true Unknown \\nRGBA_1010102 Opaque false Opaque true Opaque true Premul true Unpremul \\nRGBA_1010102 Premul false Premul true Opaque true Premul true Unpremul \\nRGBA_1010102 Unpremul false Unpremul true Opaque true Premul true Unpremul \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\nRGB_101010x Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n Gray_8 Opaque true Opaque true Opaque true Opaque true Opaque \\n RGBA_F16 Unknown true Unknown true Unknown true Unknown true Unknown \\n RGBA_F16 Opaque false Opaque true Opaque true Premul true Unpremul \\n RGBA_F16 Premul false Premul true Opaque true Premul true Unpremul \\n RGBA_F16 Unpremul false Unpremul true Opaque true Premul true Unpremul \\n"
|
||||
},
|
||||
"SkBitmap_setImmutable": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType));\n bitmap.allocPixels();\n SkCanvas offscreen(bitmap);\n SkDebugf(\"draw white\\n\");\n offscreen.clear(SK_ColorWHITE);\n bitmap.setImmutable();\n SkDebugf(\"draw black\\n\");\n offscreen.clear(SK_ColorBLACK);\n}",
|
||||
@ -323,11 +323,11 @@
|
||||
"stdout": "draw white\\ndraw black\\n"
|
||||
},
|
||||
"SkBitmap_shiftPerPixel": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkImageInfo info = SkImageInfo::MakeA8(1, 1);\n SkBitmap bitmap;\n for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType,\n kRGB_565_SkColorType, kARGB_4444_SkColorType, \n kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {\n bitmap.setInfo(info.makeColorType(colorType));\n SkDebugf(\"color: k\" \"%s\" \"_SkColorType\" \"%*s\" \"shiftPerPixel: %d\\n\",\n colors[colorType], 10 - strlen(colors[colorType]), \" \",\n bitmap.shiftPerPixel());\n }\n}",
|
||||
"hash": "2c77d92f20b950154b9444d3b639b36c",
|
||||
"code": "void draw(SkCanvas* canvas) {\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkImageInfo info = SkImageInfo::MakeA8(1, 1);\n SkBitmap bitmap;\n for (SkColorType colorType : {\n kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,\n kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,\n kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,\n kGray_8_SkColorType, kRGBA_F16_SkColorType\n } ) {\n bitmap.setInfo(info.makeColorType(colorType));\n SkDebugf(\"color: k\" \"%s\" \"_SkColorType\" \"%*s\" \"shiftPerPixel: %d\\n\",\n colors[colorType], 14 - strlen(colors[colorType]), \" \",\n bitmap.shiftPerPixel());\n }\n}",
|
||||
"hash": "56ede4b7d45c15d5936f81ac3d74f070",
|
||||
"file": "SkBitmap_Reference",
|
||||
"name": "SkBitmap::shiftPerPixel",
|
||||
"stdout": "color: kUnknown_SkColorType shiftPerPixel: 0\\ncolor: kAlpha_8_SkColorType shiftPerPixel: 0\\ncolor: kRGB_565_SkColorType shiftPerPixel: 1\\ncolor: kARGB_4444_SkColorType shiftPerPixel: 1\\ncolor: kRGBA_8888_SkColorType shiftPerPixel: 2\\ncolor: kBGRA_8888_SkColorType shiftPerPixel: 2\\ncolor: kGray_8_SkColorType shiftPerPixel: 0\\ncolor: kRGBA_F16_SkColorType shiftPerPixel: 3\\n"
|
||||
"stdout": "color: kUnknown_SkColorType shiftPerPixel: 0\\ncolor: kAlpha_8_SkColorType shiftPerPixel: 0\\ncolor: kRGB_565_SkColorType shiftPerPixel: 1\\ncolor: kARGB_4444_SkColorType shiftPerPixel: 1\\ncolor: kRGBA_8888_SkColorType shiftPerPixel: 2\\ncolor: kRGB_888x_SkColorType shiftPerPixel: 2\\ncolor: kBGRA_8888_SkColorType shiftPerPixel: 2\\ncolor: kRGBA_1010102_SkColorType shiftPerPixel: 2\\ncolor: kRGB_101010x_SkColorType shiftPerPixel: 2\\ncolor: kGray_8_SkColorType shiftPerPixel: 0\\ncolor: kRGBA_F16_SkColorType shiftPerPixel: 3\\n"
|
||||
},
|
||||
"SkBitmap_swap": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkBitmap& b) -> void {\n const char* alphas[] = {\"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\"};\n const char* colors[] = {\"Unknown\", \"Alpha_8\", \"RGB_565\", \"ARGB_4444\", \"RGBA_8888\", \"RGB_888x\",\n \"BGRA_8888\", \"RGBA_1010102\", \"RGB_101010x\", \"Gray_8\", \"RGBA_F16\"};\n SkDebugf(\"%s width:%d height:%d colorType:k%s_SkColorType alphaType:k%s_SkAlphaType\\n\",\n prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]);\n };\n SkBitmap one, two;\n one.tryAllocPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));\n two.tryAllocPixels(SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType));\n for (int index = 0; index < 2; ++index) {\n debugster(\"one\", one);\n debugster(\"two\", two);\n one.swap(two);\n }\n}\n",
|
||||
@ -1986,7 +1986,7 @@
|
||||
"hash": "eb5fa5bea23059ce538e883502f828f5",
|
||||
"file": "SkPath_Reference",
|
||||
"name": "SkPath::RawIter::peek()",
|
||||
"stdout": "peek Move == verb Move\\npeek Quad == verb Quad\\npeek Conic == verb Conic\\npeek Cubic == verb Cubic\\npeek Done == verb Done\\npeek Done == verb Done\\n"
|
||||
"stdout": "peek Move == verb Move\\npeek Quad == verb Quad\\npeek Conic == verb Conic\\npeek Cubic == verb Cubic\\npeek Done == verb Done\\npeek Done == verb Done\\n\\n"
|
||||
},
|
||||
"SkPath_SegmentMask": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPath path;\n path.conicTo(10, 10, 20, 30, 1);\n SkDebugf(\"Path kConic_SegmentMask is %s\\n\", path.getSegmentMasks() & \n SkPath::kConic_SegmentMask ? \"set\" : \"clear\");\n SkDebugf(\"Path kQuad_SegmentMask is %s\\n\", path.getSegmentMasks() & \n SkPath::kQuad_SegmentMask ? \"set\" : \"clear\");\n}",
|
||||
@ -2280,7 +2280,7 @@
|
||||
"hash": "bb761cd858e6d0ca05627262cd22ff5e",
|
||||
"file": "SkPath_Reference",
|
||||
"name": "SkPath::updateBoundsCache",
|
||||
"stdout": "uncached avg: 0.18048 ms\\ncached avg: 0.182784 ms\\n"
|
||||
"stdout": "uncached avg: 0.18048 ms\\ncached avg: 0.182784 ms\\n\\n"
|
||||
},
|
||||
"SkPath_writeToMemory": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPath path, copy;\n path.lineTo(6.f / 7, 2.f / 3);\n size_t size = path.writeToMemory(nullptr);\n SkTDArray<char> storage;\n storage.setCount(size);\n path.writeToMemory(storage.begin());\n copy.readFromMemory(storage.begin(), size);\n SkDebugf(\"path is \" \"%s\" \"equal to copy\\n\", path == copy ? \"\" : \"not \");\n}\n",
|
||||
@ -2294,7 +2294,7 @@
|
||||
"hash": "17bcabaaee2dbb7beba562e9ca50b55e",
|
||||
"file": "SkPixmap_Reference",
|
||||
"name": "SkPixmap::addr()",
|
||||
"stdout": "pixels address: 0x7f2a440bb010\\ninset address: 0x7f2a440fb210\\n"
|
||||
"stdout": "pixels address: 0x7f2a440bb010\\ninset address: 0x7f2a440fb210\\n\\n"
|
||||
},
|
||||
"SkPixmap_addr16": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n const int w = 4;\n const int h = 4;\n uint16_t storage[w * h];\n SkPixmap pixmap(SkImageInfo::Make(w, h, kARGB_4444_SkColorType, kPremul_SkAlphaType),\n storage, w * sizeof(storage[0]));\n SkDebugf(\"pixmap.addr16() %c= storage\\n\",\n pixmap.addr16() == storage ? '=' : '!');\n}",
|
||||
@ -4806,10 +4806,10 @@
|
||||
"name": "SkImageInfo::ByteSizeOverflowed"
|
||||
},
|
||||
"SkImageInfo_Make": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },\n { 0xAC, 0xA8, 0x89, 0xA7, 0x87 },\n { 0x9B, 0xB5, 0xE5, 0x95, 0x46 },\n { 0x90, 0x81, 0xC5, 0x71, 0x33 },\n { 0x75, 0x55, 0x44, 0x40, 0x30 }};\n SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);\n SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);\n SkBitmap bitmap;\n bitmap.installPixels(pixmap);\n canvas->scale(8, 8);\n canvas->drawBitmap(bitmap, 0, 0);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"height": 48,
|
||||
"hash": "9f47f9c2a99473f5b1113db48096d586",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::Make"
|
||||
},
|
||||
@ -4822,50 +4822,50 @@
|
||||
"name": "SkImageInfo::MakeA8"
|
||||
},
|
||||
"SkImageInfo_MakeN32": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType));\n SkCanvas offscreen(bitmap);\n offscreen.clear(SK_ColorWHITE);\n SkPaint paint;\n offscreen.drawString(\"g\", 0, 10, paint);\n canvas->scale(8, 8);\n canvas->drawBitmap(bitmap, 0, 0);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"height": 128,
|
||||
"hash": "78cea0c4cac205b61ad6f6c982cbd888",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::MakeN32"
|
||||
},
|
||||
"SkImageInfo_MakeN32Premul": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul(18, 18));\n SkCanvas offscreen(bitmap);\n offscreen.clear(SK_ColorWHITE);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(15);\n offscreen.drawString(\"\\xF0\\x9F\\x98\\xB8\", 1, 15, paint);\n canvas->scale(6, 6);\n canvas->drawBitmap(bitmap, 0, 0);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"hash": "077084c05471d6bbd54338d92ea799e3",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::MakeN32Premul"
|
||||
},
|
||||
"SkImageInfo_MakeN32Premul_2": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32Premul({18, 18}));\n SkCanvas offscreen(bitmap);\n offscreen.clear(SK_ColorWHITE);\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextSize(15);\n offscreen.drawString(\"\\xF0\\x9F\\x98\\xB9\", 1, 15, paint);\n canvas->scale(6, 6);\n canvas->drawBitmap(bitmap, 0, 0);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"hash": "897f42eb3b27d749ec792435fb389a07",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::MakeN32Premul_2"
|
||||
},
|
||||
"SkImageInfo_MakeS32": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n const int width = 256;\n const int height = 32;\n SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);\n SkColor gradColors[] = { 0xFFAA0055, 0xFF11CC88 };\n SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };\n SkPaint gradPaint;\n gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,\n SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));\n SkBitmap bitmap;\n bitmap.allocPixels(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType));\n SkCanvas offscreen(bitmap);\n offscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);\n canvas->drawBitmap(bitmap, 0, 0);\n bitmap.allocPixels(SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType));\n SkCanvas sRGBOffscreen(bitmap);\n sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);\n canvas->drawBitmap(bitmap, 0, 48);\n SkBitmap noColorSpaceBitmap;\n noColorSpaceBitmap.setInfo(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType));\n noColorSpaceBitmap.setPixels(bitmap.getAddr(0, 0));\n canvas->drawBitmap(noColorSpaceBitmap, 0, 96);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"height": 128,
|
||||
"hash": "bb85fc8a82fe772e1d611f3ab8770a1d",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::MakeS32"
|
||||
},
|
||||
"SkImageInfo_MakeUnknown": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkImageInfo info; // default constructor\n SkString string;\n string.printf(\"SkImageInfo() %c= SkImageInfo::MakeUnknown(0, 0)\",\n info == SkImageInfo::MakeUnknown(0, 0) ? '=' : '!');\n SkPaint paint;\n canvas->drawString(string, 0, 12, paint);\n}",
|
||||
"width": 384,
|
||||
"height": 32,
|
||||
"hash": "75f13a78b28b08c72baf32b7d868de1c",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::MakeUnknown"
|
||||
},
|
||||
"SkImageInfo_MakeUnknown_2": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkImageInfo info; // default constructor\n SkString string;\n string.printf(\"SkImageInfo() %c= SkImageInfo::MakeUnknown()\",\n info == SkImageInfo::MakeUnknown() ? '=' : '!');\n SkPaint paint;\n canvas->drawString(string, 0, 12, paint);\n}",
|
||||
"width": 384,
|
||||
"height": 32,
|
||||
"hash": "a1af7696ae0cdd6f379546dd1f211b7a",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::MakeUnknown_2"
|
||||
},
|
||||
@ -4942,10 +4942,10 @@
|
||||
"name": "SkImageInfo::dimensions()"
|
||||
},
|
||||
"SkImageInfo_empty_constructor": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkImageInfo imageInfo;\n size_t rowBytes;\n SkIPoint origin;\n uint32_t* access = (uint32_t*) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);\n const char* alphaType[] = { \"Unknown\", \"Opaque\", \"Premul\", \"Unpremul\" };\n SkString string;\n string.printf(\"k%s_SkAlphaType\", alphaType[(int) imageInfo.alphaType()]);\n SkPaint paint;\n canvas->drawString(string, 20, 20, paint);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"height": 32,
|
||||
"hash": "20a156a9ca80ec081426b7e975383443",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::SkImageInfo()"
|
||||
},
|
||||
@ -4974,10 +4974,10 @@
|
||||
"name": "SkImageInfo::gammaCloseToSRGB"
|
||||
},
|
||||
"SkImageInfo_height": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 20);\n canvas->drawBitmap(source, 0, 0);\n SkImageInfo imageInfo = source.info();\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n paint.setVerticalText(true);\n canvas->drawLine(imageInfo.width() + 10, 0, imageInfo.width() + 10, imageInfo.height(), paint);\n canvas->drawString(\"height\", imageInfo.width() + 25, imageInfo.height() / 2, paint);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"height": 96,
|
||||
"hash": "1719751fef7fd6040447619d4e66d416",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::height()"
|
||||
},
|
||||
@ -5102,10 +5102,10 @@
|
||||
"name": "SkImageInfo::validate()"
|
||||
},
|
||||
"SkImageInfo_width": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 10);\n canvas->drawBitmap(source, 0, 0);\n SkImageInfo imageInfo = source.info();\n canvas->translate(0, imageInfo.height());\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawLine(0, 10, imageInfo.width(), 10, paint);\n canvas->drawString(\"width\", imageInfo.width() / 2, 25, paint);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"height": 96,
|
||||
"hash": "588a0a763d78c1b3b3ea0b2a6e39fda6",
|
||||
"file": "SkImageInfo_Reference",
|
||||
"name": "SkImageInfo::width()"
|
||||
},
|
||||
@ -7148,14 +7148,6 @@
|
||||
"hash": "dcbd4af9151820f63de45a35f3a8d110",
|
||||
"file": "SkSurface_Reference",
|
||||
"name": "SkSurface::readPixels_3"
|
||||
},
|
||||
"SkSurface_wait": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n GrBackendSemaphore semaphore;\n sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(64, 64));\n surface->flushAndSignalSemaphores(1, &semaphore);\n sk_sp<SkImage> image = surface->makeImageSnapshot();\n GrBackendObject backendImage = image->getTextureHandle(false); // unused\n SkASSERT(backendImage);\n const SkImageInfo childImageInfo = SkImageInfo::Make(64, 64,\n kRGBA_8888_SkColorType, kPremul_SkAlphaType);\n sk_sp<SkSurface> childSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo,\n childImageInfo, 0, kTopLeft_GrSurfaceOrigin, nullptr));\n GrBackendTexture backendTexture;\n sk_sp<SkImage> childImage = SkImage::MakeFromTexture(context,\n backendTexture, // undefined\n kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, nullptr);\n SkCanvas* childCanvas = childSurface->getCanvas();\n childCanvas->clear(SK_ColorRED);\n childSurface->wait(1, &semaphore);\n childCanvas->drawImage(childImage, 32, 0);\n childSurface->draw(canvas, 0, 0, nullptr);\n}",
|
||||
"width": 256,
|
||||
"height": 64,
|
||||
"hash": "c9033080af68efc0f270d748f1c0e011",
|
||||
"file": "SkSurface_Reference",
|
||||
"name": "SkSurface::wait()"
|
||||
},
|
||||
"SkSurface_writePixels": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
|
@ -877,7 +877,8 @@ static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, TileMode tmx,
|
||||
<td><a name="SkSurfaceProps_kLegacyFontHost_InitType"> <code><strong>SkSurfaceProps::kLegacyFontHost_InitType </strong></code> </a></td><td>0</td><td></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
#
|
||||
Topic</table>
|
||||
|
||||
# <a name="Text"></a> Text
|
||||
|
||||
|
@ -21,7 +21,8 @@ documentation to be deprecated as well.
|
||||
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
|
||||
# void someMethodThatIsNowDeprecated()
|
||||
#Deprecated
|
||||
##</pre>
|
||||
##
|
||||
</pre>
|
||||
|
||||
Use
|
||||
|
||||
@ -239,3 +240,4 @@ any of the above commands with -a docs/status.json in place of
|
||||
## <a name="Bugs"></a> Bugs
|
||||
|
||||
<a href="#Bookmaker">Bookmaker</a> bugs are tracked <a href="bug.skia.org/6898">here</a> .
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "bookmaker.h"
|
||||
#include "SkOSPath.h"
|
||||
|
||||
#ifdef SK_BUILD_FOR_WIN
|
||||
#include <Windows.h>
|
||||
@ -189,7 +190,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
if (!typeNameBuilder.size()) {
|
||||
return this->reportError<bool>("unnamed topic");
|
||||
}
|
||||
fTopics.emplace_front(markType, defStart, fLineCount, fParent);
|
||||
fTopics.emplace_front(markType, defStart, fLineCount, fParent, fMC);
|
||||
RootDefinition* rootDefinition = &fTopics.front();
|
||||
definition = rootDefinition;
|
||||
definition->fFileName = fFileName;
|
||||
@ -277,6 +278,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
// may be one-liner
|
||||
case MarkType::kNoExample:
|
||||
case MarkType::kParam:
|
||||
case MarkType::kPhraseDef:
|
||||
case MarkType::kReturn:
|
||||
case MarkType::kToDo:
|
||||
if (hasEnd) {
|
||||
@ -289,22 +291,37 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
if (!this->popParentStack(fParent)) { // if not one liner, pop
|
||||
return false;
|
||||
}
|
||||
if (MarkType::kParam == markType || MarkType::kReturn == markType) {
|
||||
if (MarkType::kParam == markType || MarkType::kReturn == markType
|
||||
|| MarkType::kPhraseDef == markType) {
|
||||
if (!this->checkParamReturn(definition)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (MarkType::kPhraseDef == markType) {
|
||||
string key = definition->fName;
|
||||
if (fPhraseMap.end() != fPhraseMap.find(key)) {
|
||||
this->reportError<bool>("duplicate phrase key");
|
||||
}
|
||||
fPhraseMap[key] = definition;
|
||||
}
|
||||
} else {
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent);
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent, fMC);
|
||||
definition = &fMarkup.front();
|
||||
definition->fName = typeNameBuilder[0];
|
||||
definition->fFiddle = fParent->fFiddle;
|
||||
definition->fContentStart = fChar;
|
||||
definition->fContentEnd = this->trimmedBracketEnd(fMC);
|
||||
this->skipToEndBracket(fMC);
|
||||
string endBracket;
|
||||
endBracket += fMC;
|
||||
endBracket += fMC;
|
||||
definition->fContentEnd = this->trimmedBracketEnd(endBracket);
|
||||
this->skipToEndBracket(endBracket.c_str());
|
||||
SkAssertResult(fMC == this->next());
|
||||
SkAssertResult(fMC == this->next());
|
||||
definition->fTerminator = fChar;
|
||||
TextParser checkForChildren(definition);
|
||||
if (checkForChildren.strnchr(fMC, definition->fContentEnd)) {
|
||||
this->reportError<bool>("put ## on separate line");
|
||||
}
|
||||
fParent->fChildren.push_back(definition);
|
||||
}
|
||||
break;
|
||||
@ -334,10 +351,11 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
return this->reportError<bool>("missing example body");
|
||||
}
|
||||
}
|
||||
definition->setWrapper();
|
||||
// can't do this here; phrase refs may not have been defined yet
|
||||
// this->setWrapper(definition);
|
||||
}
|
||||
} else {
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent);
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent, fMC);
|
||||
definition = &fMarkup.front();
|
||||
definition->fContentStart = fChar;
|
||||
definition->fName = typeNameBuilder[0];
|
||||
@ -395,7 +413,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
} else if (!hasEnd && MarkType::kAnchor == markType) {
|
||||
return this->reportError<bool>("anchor line must have end element last");
|
||||
}
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent);
|
||||
fMarkup.emplace_front(markType, defStart, fLineCount, fParent, fMC);
|
||||
definition = &fMarkup.front();
|
||||
definition->fName = typeNameBuilder[0];
|
||||
definition->fFiddle = Definition::NormalizedName(typeNameBuilder[0]);
|
||||
@ -405,7 +423,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
fParent->fChildren.push_back(definition);
|
||||
if (MarkType::kAnchor == markType) {
|
||||
this->skipToEndBracket(fMC);
|
||||
fMarkup.emplace_front(MarkType::kLink, fChar, fLineCount, definition);
|
||||
fMarkup.emplace_front(MarkType::kLink, fChar, fLineCount, definition, fMC);
|
||||
SkAssertResult(fMC == this->next());
|
||||
this->skipWhiteSpace();
|
||||
Definition* link = &fMarkup.front();
|
||||
@ -437,7 +455,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
if (fMC != this->next() || fMC != this->next()) {
|
||||
return this->reportError<bool>("expected ## to delineate line");
|
||||
}
|
||||
fMarkup.emplace_front(MarkType::kText, start, fLineCount, definition);
|
||||
fMarkup.emplace_front(MarkType::kText, start, fLineCount, definition, fMC);
|
||||
Definition* text = &fMarkup.front();
|
||||
text->fContentStart = start;
|
||||
text->fContentEnd = end;
|
||||
@ -690,7 +708,8 @@ bool BmhParser::collectExternals() {
|
||||
const char* wordStart = fChar;
|
||||
this->skipToNonAlphaNum();
|
||||
if (fChar - wordStart > 0) {
|
||||
fExternals.emplace_front(MarkType::kExternal, wordStart, fChar, fLineCount, fParent);
|
||||
fExternals.emplace_front(MarkType::kExternal, wordStart, fChar, fLineCount, fParent,
|
||||
fMC);
|
||||
RootDefinition* definition = &fExternals.front();
|
||||
definition->fFileName = fFileName;
|
||||
definition->fName = string(wordStart ,fChar - wordStart);
|
||||
@ -700,10 +719,10 @@ bool BmhParser::collectExternals() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dump_examples(FILE* fiddleOut, const Definition& def, bool* continuation) {
|
||||
bool BmhParser::dumpExamples(FILE* fiddleOut, Definition& def, bool* continuation) const {
|
||||
if (MarkType::kExample == def.fMarkType) {
|
||||
string result;
|
||||
if (!def.exampleToScript(&result, Definition::ExampleOptions::kAll)) {
|
||||
if (!this->exampleToScript(&def, BmhParser::ExampleOptions::kAll, &result)) {
|
||||
return false;
|
||||
}
|
||||
if (result.length() > 0) {
|
||||
@ -719,7 +738,7 @@ static bool dump_examples(FILE* fiddleOut, const Definition& def, bool* continua
|
||||
return true;
|
||||
}
|
||||
for (auto& child : def.fChildren ) {
|
||||
if (!dump_examples(fiddleOut, *child, continuation)) {
|
||||
if (!this->dumpExamples(fiddleOut, *child, continuation)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -738,7 +757,7 @@ bool BmhParser::dumpExamples(const char* fiddleJsonFileName) const {
|
||||
if (topic.second->fParent) {
|
||||
continue;
|
||||
}
|
||||
dump_examples(fiddleOut, *topic.second, &continuation);
|
||||
this->dumpExamples(fiddleOut, *topic.second, &continuation);
|
||||
}
|
||||
fprintf(fiddleOut, "\n}\n");
|
||||
fclose(fiddleOut);
|
||||
@ -767,6 +786,262 @@ bool BmhParser::endTableColumn(const char* end, const char* terminator) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static size_t count_indent(const string& text, size_t test, size_t end) {
|
||||
size_t result = test;
|
||||
while (test < end) {
|
||||
if (' ' != text[test]) {
|
||||
break;
|
||||
}
|
||||
++test;
|
||||
}
|
||||
return test - result;
|
||||
}
|
||||
|
||||
static void add_code(const string& text, int pos, int end,
|
||||
size_t outIndent, size_t textIndent, string& example) {
|
||||
do {
|
||||
// fix this to move whole paragraph in, out, but preserve doc indent
|
||||
int nextIndent = count_indent(text, pos, end);
|
||||
size_t len = text.find('\n', pos);
|
||||
if (string::npos == len) {
|
||||
len = end;
|
||||
}
|
||||
if ((size_t) (pos + nextIndent) < len) {
|
||||
size_t indent = outIndent + nextIndent;
|
||||
SkASSERT(indent >= textIndent);
|
||||
indent -= textIndent;
|
||||
for (size_t index = 0; index < indent; ++index) {
|
||||
example += ' ';
|
||||
}
|
||||
pos += nextIndent;
|
||||
while ((size_t) pos < len) {
|
||||
example += '"' == text[pos] ? "\\\"" :
|
||||
'\\' == text[pos] ? "\\\\" :
|
||||
text.substr(pos, 1);
|
||||
++pos;
|
||||
}
|
||||
example += "\\n";
|
||||
} else {
|
||||
pos += nextIndent;
|
||||
}
|
||||
if ('\n' == text[pos]) {
|
||||
++pos;
|
||||
}
|
||||
} while (pos < end);
|
||||
}
|
||||
|
||||
bool BmhParser::exampleToScript(Definition* def, ExampleOptions exampleOptions,
|
||||
string* result) const {
|
||||
bool hasFiddle = true;
|
||||
const Definition* platform = def->hasChild(MarkType::kPlatform);
|
||||
if (platform) {
|
||||
TextParser platParse(platform);
|
||||
hasFiddle = !platParse.strnstr("!fiddle", platParse.fEnd);
|
||||
}
|
||||
if (!hasFiddle) {
|
||||
*result = "";
|
||||
return true;
|
||||
}
|
||||
string text = this->extractText(def, TrimExtract::kNo);
|
||||
bool textOut = string::npos != text.find("SkDebugf(")
|
||||
|| string::npos != text.find("dump(")
|
||||
|| string::npos != text.find("dumpHex(");
|
||||
string heightStr = "256";
|
||||
string widthStr = "256";
|
||||
string normalizedName(def->fFiddle);
|
||||
string code;
|
||||
string imageStr = "0";
|
||||
string srgbStr = "false";
|
||||
string durationStr = "0";
|
||||
for (auto iter : def->fChildren) {
|
||||
switch (iter->fMarkType) {
|
||||
case MarkType::kDuration:
|
||||
durationStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kHeight:
|
||||
heightStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kWidth:
|
||||
widthStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kDescription:
|
||||
// ignore for now
|
||||
break;
|
||||
case MarkType::kFunction: {
|
||||
// emit this, but don't wrap this in draw()
|
||||
string funcText = this->extractText(&*iter, TrimExtract::kNo);
|
||||
size_t pos = 0;
|
||||
while (pos < funcText.length() && ' ' > funcText[pos]) {
|
||||
++pos;
|
||||
}
|
||||
size_t indent = count_indent(funcText, pos, funcText.length());
|
||||
add_code(funcText, pos, funcText.length(), 0, indent, code);
|
||||
code += "\\n";
|
||||
} break;
|
||||
case MarkType::kComment:
|
||||
break;
|
||||
case MarkType::kImage:
|
||||
imageStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kToDo:
|
||||
break;
|
||||
case MarkType::kBug:
|
||||
case MarkType::kMarkChar:
|
||||
case MarkType::kPlatform:
|
||||
case MarkType::kPhraseRef:
|
||||
// ignore for now
|
||||
break;
|
||||
case MarkType::kSet:
|
||||
if ("sRGB" == string(iter->fContentStart,
|
||||
iter->fContentEnd - iter->fContentStart)) {
|
||||
srgbStr = "true";
|
||||
} else {
|
||||
SkASSERT(0); // more work to do
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MarkType::kStdOut:
|
||||
textOut = true;
|
||||
break;
|
||||
default:
|
||||
SkASSERT(0); // more coding to do
|
||||
}
|
||||
}
|
||||
string animatedStr = "0" != durationStr ? "true" : "false";
|
||||
string textOutStr = textOut ? "true" : "false";
|
||||
size_t pos = 0;
|
||||
while (pos < text.length() && ' ' > text[pos]) {
|
||||
++pos;
|
||||
}
|
||||
size_t end = text.length();
|
||||
size_t outIndent = 0;
|
||||
size_t textIndent = count_indent(text, pos, end);
|
||||
if ("" == def->fWrapper) {
|
||||
this->setWrapper(def);
|
||||
}
|
||||
if (def->fWrapper.length() > 0) {
|
||||
code += def->fWrapper;
|
||||
code += "\\n";
|
||||
outIndent = 4;
|
||||
}
|
||||
add_code(text, pos, end, outIndent, textIndent, code);
|
||||
if (def->fWrapper.length() > 0) {
|
||||
code += "}";
|
||||
}
|
||||
string example = "\"" + normalizedName + "\": {\n";
|
||||
size_t nameStart = def->fFileName.find(SkOSPath::SEPARATOR, 0);
|
||||
SkASSERT(string::npos != nameStart);
|
||||
string baseFile = def->fFileName.substr(nameStart + 1, def->fFileName.length() - nameStart - 5);
|
||||
if (ExampleOptions::kText == exampleOptions) {
|
||||
example += " \"code\": \"" + code + "\",\n";
|
||||
example += " \"hash\": \"" + def->fHash + "\",\n";
|
||||
example += " \"file\": \"" + baseFile + "\",\n";
|
||||
example += " \"name\": \"" + def->fName + "\",";
|
||||
} else {
|
||||
example += " \"code\": \"" + code + "\",\n";
|
||||
if (ExampleOptions::kPng == exampleOptions) {
|
||||
example += " \"width\": " + widthStr + ",\n";
|
||||
example += " \"height\": " + heightStr + ",\n";
|
||||
example += " \"hash\": \"" + def->fHash + "\",\n";
|
||||
example += " \"file\": \"" + baseFile + "\",\n";
|
||||
example += " \"name\": \"" + def->fName + "\"\n";
|
||||
example += "}";
|
||||
} else {
|
||||
example += " \"options\": {\n";
|
||||
example += " \"width\": " + widthStr + ",\n";
|
||||
example += " \"height\": " + heightStr + ",\n";
|
||||
example += " \"source\": " + imageStr + ",\n";
|
||||
example += " \"srgb\": " + srgbStr + ",\n";
|
||||
example += " \"f16\": false,\n";
|
||||
example += " \"textOnly\": " + textOutStr + ",\n";
|
||||
example += " \"animated\": " + animatedStr + ",\n";
|
||||
example += " \"duration\": " + durationStr + "\n";
|
||||
example += " },\n";
|
||||
example += " \"fast\": true";
|
||||
}
|
||||
}
|
||||
*result = example;
|
||||
return true;
|
||||
}
|
||||
|
||||
string BmhParser::extractText(const Definition* def, TrimExtract trimExtract) const {
|
||||
string result;
|
||||
TextParser parser(def);
|
||||
auto childIter = def->fChildren.begin();
|
||||
while (!parser.eof()) {
|
||||
const char* end = def->fChildren.end() == childIter ? parser.fEnd : (*childIter)->fStart;
|
||||
string fragment(parser.fChar, end - parser.fChar);
|
||||
trim_end(fragment);
|
||||
if (TrimExtract::kYes == trimExtract) {
|
||||
trim_start(fragment);
|
||||
if (result.length()) {
|
||||
result += '\n';
|
||||
result += '\n';
|
||||
}
|
||||
}
|
||||
if (TrimExtract::kYes == trimExtract || has_nonwhitespace(fragment)) {
|
||||
result += fragment;
|
||||
}
|
||||
parser.skipTo(end);
|
||||
if (def->fChildren.end() != childIter) {
|
||||
Definition* child = *childIter;
|
||||
if (MarkType::kPhraseRef == child->fMarkType) {
|
||||
auto phraseIter = fPhraseMap.find(child->fName);
|
||||
if (fPhraseMap.end() == phraseIter) {
|
||||
return def->reportError<string>("missing phrase definition");
|
||||
}
|
||||
Definition* phrase = phraseIter->second;
|
||||
// count indent of last line in result
|
||||
size_t lastLF = result.rfind('\n');
|
||||
size_t startPos = string::npos == lastLF ? 0 : lastLF;
|
||||
size_t lastLen = result.length() - startPos;
|
||||
size_t indent = count_indent(result, startPos, result.length()) + 4;
|
||||
string phraseStr = this->extractText(phrase, TrimExtract::kNo);
|
||||
startPos = 0;
|
||||
bool firstTime = true;
|
||||
size_t endPos;
|
||||
do {
|
||||
endPos = phraseStr.find('\n', startPos);
|
||||
size_t len = (string::npos != endPos ? endPos : phraseStr.length()) - startPos;
|
||||
if (firstTime && lastLen + len + 1 < 100) { // FIXME: make 100 global const or something
|
||||
result += ' ';
|
||||
} else {
|
||||
result += '\n';
|
||||
result += string(indent, ' ');
|
||||
}
|
||||
firstTime = false;
|
||||
string tmp = phraseStr.substr(startPos, len);
|
||||
result += tmp;
|
||||
startPos = endPos + 1;
|
||||
} while (string::npos != endPos);
|
||||
result += '\n';
|
||||
}
|
||||
parser.skipTo(child->fTerminator);
|
||||
std::advance(childIter, 1);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void BmhParser::setWrapper(Definition* def) const {
|
||||
const char drawWrapper[] = "void draw(SkCanvas* canvas) {";
|
||||
const char drawNoCanvas[] = "void draw(SkCanvas* ) {";
|
||||
string text = this->extractText(def, TrimExtract::kNo);
|
||||
size_t nonSpace = 0;
|
||||
while (nonSpace < text.length() && ' ' >= text[nonSpace]) {
|
||||
++nonSpace;
|
||||
}
|
||||
bool hasFunc = !text.compare(nonSpace, sizeof(drawWrapper) - 1, drawWrapper);
|
||||
bool noCanvas = !text.compare(nonSpace, sizeof(drawNoCanvas) - 1, drawNoCanvas);
|
||||
bool hasCanvas = string::npos != text.find("SkCanvas canvas");
|
||||
SkASSERT(!hasFunc || !noCanvas);
|
||||
bool preprocessor = text[0] == '#';
|
||||
bool wrapCode = !hasFunc && !noCanvas && !preprocessor;
|
||||
if (wrapCode) {
|
||||
def->fWrapper = hasCanvas ? string(drawNoCanvas) : string(drawWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: some examples may produce different output on different platforms
|
||||
// if the text output can be different, think of how to author that
|
||||
|
||||
@ -812,7 +1087,7 @@ bool BmhParser::findDefinitions() {
|
||||
if (' ' >= fMC) {
|
||||
return this->reportError<bool>("illegal markup character");
|
||||
}
|
||||
fMarkup.emplace_front(MarkType::kMarkChar, fChar - 1, fLineCount, fParent);
|
||||
fMarkup.emplace_front(MarkType::kMarkChar, fChar - 4, fLineCount, fParent, fMC);
|
||||
Definition* markChar = &fMarkup.front();
|
||||
markChar->fContentStart = fChar - 1;
|
||||
this->skipToEndBracket('\n');
|
||||
@ -865,7 +1140,7 @@ bool BmhParser::findDefinitions() {
|
||||
}
|
||||
} else { // one line comment
|
||||
fMarkup.emplace_front(MarkType::kComment, fChar - 1, fLineCount,
|
||||
fParent);
|
||||
fParent, fMC);
|
||||
Definition* comment = &fMarkup.front();
|
||||
comment->fContentStart = fChar - 1;
|
||||
this->skipToEndBracket('\n');
|
||||
@ -890,7 +1165,7 @@ bool BmhParser::findDefinitions() {
|
||||
} else if (TableState::kNone == fTableState) {
|
||||
// fixme? no nested tables for now
|
||||
fColStart = fChar - 1;
|
||||
fMarkup.emplace_front(MarkType::kRow, fColStart, fLineCount, fParent);
|
||||
fMarkup.emplace_front(MarkType::kRow, fColStart, fLineCount, fParent, fMC);
|
||||
fRow = &fMarkup.front();
|
||||
fRow->fName = fParent->fName;
|
||||
this->skipWhiteSpace();
|
||||
@ -899,7 +1174,7 @@ bool BmhParser::findDefinitions() {
|
||||
fTableState = TableState::kColumnStart;
|
||||
}
|
||||
if (TableState::kColumnStart == fTableState) {
|
||||
fMarkup.emplace_front(MarkType::kColumn, fColStart, fLineCount, fParent);
|
||||
fMarkup.emplace_front(MarkType::kColumn, fColStart, fLineCount, fParent, fMC);
|
||||
fWorkingColumn = &fMarkup.front();
|
||||
fWorkingColumn->fName = fParent->fName;
|
||||
fWorkingColumn->fContentStart = fChar;
|
||||
@ -907,6 +1182,28 @@ bool BmhParser::findDefinitions() {
|
||||
fTableState = TableState::kColumnEnd;
|
||||
continue;
|
||||
}
|
||||
} else if (this->peek() >= 'a' && this->peek() <= 'z') {
|
||||
// expect zero or more letters and underscores (no spaces) then hash
|
||||
const char* phraseNameStart = fChar;
|
||||
this->skipPhraseName();
|
||||
string phraseKey = string(phraseNameStart, fChar - phraseNameStart);
|
||||
if (fMC != this->next()) {
|
||||
return this->reportError<bool>("expect # after phrase-name");
|
||||
}
|
||||
const char* start = phraseNameStart;
|
||||
SkASSERT('#' == start[-1]);
|
||||
--start;
|
||||
if (start > fStart && ' ' >= start[-1]) {
|
||||
--start; // preserve whether to add whitespace before substitution
|
||||
}
|
||||
fMarkup.emplace_front(MarkType::kPhraseRef, start, fLineCount, fParent, fMC);
|
||||
Definition* markChar = &fMarkup.front();
|
||||
markChar->fContentStart = fChar;
|
||||
this->skipToEndBracket('\n');
|
||||
markChar->fContentEnd = fChar;
|
||||
markChar->fTerminator = fChar;
|
||||
markChar->fName = phraseKey;
|
||||
fParent->fChildren.push_back(markChar);
|
||||
}
|
||||
}
|
||||
char nextChar = this->next();
|
||||
@ -1316,6 +1613,45 @@ const Definition* BmhParser::parentSpace() const {
|
||||
return parent;
|
||||
}
|
||||
|
||||
const char* BmhParser::checkForFullTerminal(const char* end, const Definition* definition) const {
|
||||
const char* start = end;
|
||||
while ('\n' != start[0] && start > fStart) {
|
||||
--start;
|
||||
}
|
||||
SkASSERT (start < end);
|
||||
// if end is preceeeded by \n#MarkType ## backup to there
|
||||
TextParser parser(fFileName, start, fChar, fLineCount);
|
||||
parser.skipWhiteSpace();
|
||||
if (parser.eof() || fMC != parser.next()) {
|
||||
return end;
|
||||
}
|
||||
const char* markName = fMaps[(int) definition->fMarkType].fName;
|
||||
if (!parser.skipExact(markName)) {
|
||||
return end;
|
||||
}
|
||||
parser.skipWhiteSpace();
|
||||
const char* nameStart = parser.fChar;
|
||||
if (isupper(nameStart[0])) {
|
||||
parser.skipToWhiteSpace();
|
||||
if (parser.eof()) {
|
||||
return end;
|
||||
}
|
||||
string defName = string(nameStart, parser.fChar - nameStart);
|
||||
size_t defNamePos = definition->fName.rfind(defName);
|
||||
if (definition->fName.length() != defNamePos + defName.length()) {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
parser.skipWhiteSpace();
|
||||
if (fMC != parser.next()) {
|
||||
return end;
|
||||
}
|
||||
if (!parser.eof() && fMC != parser.next()) {
|
||||
return end;
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
bool BmhParser::popParentStack(Definition* definition) {
|
||||
if (!fParent) {
|
||||
return this->reportError<bool>("missing parent");
|
||||
@ -1329,7 +1665,19 @@ bool BmhParser::popParentStack(Definition* definition) {
|
||||
if (definition->fContentEnd) {
|
||||
return this->reportError<bool>("definition already ended");
|
||||
}
|
||||
definition->fContentEnd = fLine - 1;
|
||||
// more to figure out to handle table columns, at minimum
|
||||
const char* end = fChar;
|
||||
if (fMC != end[0]) {
|
||||
while (end > definition->fContentStart && ' ' >= end[-1]) {
|
||||
--end;
|
||||
}
|
||||
SkASSERT(&end[-1] >= definition->fContentStart && fMC == end[-1]
|
||||
&& (MarkType::kColumn == definition->fMarkType
|
||||
|| (&end[-2] >= definition->fContentStart && fMC == end[-2])));
|
||||
end -= 2;
|
||||
}
|
||||
end = checkForFullTerminal(end, definition);
|
||||
definition->fContentEnd = end;
|
||||
definition->fTerminator = fChar;
|
||||
fParent = definition->fParent;
|
||||
if (!fParent || (MarkType::kTopic == fParent->fMarkType && !fParent->fParent)) {
|
||||
@ -1629,7 +1977,8 @@ vector<string> BmhParser::typeName(MarkType markType, bool* checkEnd) {
|
||||
builder = this->typedefName();
|
||||
break;
|
||||
case MarkType::kParam:
|
||||
// fixme: expect camelCase
|
||||
case MarkType::kPhraseDef:
|
||||
// fixme: expect camelCase for param
|
||||
builder = this->word("", "");
|
||||
this->skipSpace();
|
||||
*checkEnd = false;
|
||||
|
@ -120,6 +120,8 @@ enum class MarkType {
|
||||
kNoExample,
|
||||
kOutdent,
|
||||
kParam,
|
||||
kPhraseDef,
|
||||
kPhraseRef,
|
||||
kPlatform,
|
||||
kPopulate,
|
||||
kPrivate,
|
||||
@ -504,6 +506,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void skipPhraseName() {
|
||||
while (fChar < fEnd && (islower(fChar[0]) || '_' == fChar[0])) {
|
||||
fChar++;
|
||||
}
|
||||
}
|
||||
|
||||
void skipToSpace() {
|
||||
while (fChar < fEnd && ' ' != fChar[0]) {
|
||||
fChar++;
|
||||
@ -637,6 +645,17 @@ public:
|
||||
return fChar + index;
|
||||
}
|
||||
|
||||
const char* trimmedBracketEnd(string bracket) const {
|
||||
size_t max = (size_t) (this->lineLength());
|
||||
string line(fChar, max);
|
||||
size_t index = line.find(bracket);
|
||||
SkASSERT(index < max);
|
||||
while (index > 0 && ' ' >= fChar[index - 1]) {
|
||||
--index;
|
||||
}
|
||||
return fChar + index;
|
||||
}
|
||||
|
||||
const char* trimmedLineEnd() const {
|
||||
const char* result = this->lineEnd();
|
||||
while (result > fChar && ' ' >= result[-1]) {
|
||||
@ -730,17 +749,6 @@ public:
|
||||
kFileType,
|
||||
};
|
||||
|
||||
enum class TrimExtract {
|
||||
kNo,
|
||||
kYes
|
||||
};
|
||||
|
||||
enum class ExampleOptions {
|
||||
kText,
|
||||
kPng,
|
||||
kAll
|
||||
};
|
||||
|
||||
enum class MethodType {
|
||||
kNone,
|
||||
kConstructor,
|
||||
@ -775,13 +783,14 @@ public:
|
||||
|
||||
Definition() {}
|
||||
|
||||
Definition(const char* start, const char* end, int line, Definition* parent)
|
||||
Definition(const char* start, const char* end, int line, Definition* parent, char mc)
|
||||
: fStart(start)
|
||||
, fContentStart(start)
|
||||
, fContentEnd(end)
|
||||
, fParent(parent)
|
||||
, fLineCount(line)
|
||||
, fType(Type::kWord) {
|
||||
, fType(Type::kWord)
|
||||
, fMC(mc) {
|
||||
if (parent) {
|
||||
SkASSERT(parent->fFileName.length() > 0);
|
||||
fFileName = parent->fFileName;
|
||||
@ -789,31 +798,31 @@ public:
|
||||
this->setParentIndex();
|
||||
}
|
||||
|
||||
Definition(MarkType markType, const char* start, int line, Definition* parent)
|
||||
: Definition(markType, start, nullptr, line, parent) {
|
||||
Definition(MarkType markType, const char* start, int line, Definition* parent, char mc)
|
||||
: Definition(markType, start, nullptr, line, parent, mc) {
|
||||
}
|
||||
|
||||
Definition(MarkType markType, const char* start, const char* end, int line, Definition* parent)
|
||||
: Definition(start, end, line, parent) {
|
||||
Definition(MarkType markType, const char* start, const char* end, int line, Definition* parent, char mc)
|
||||
: Definition(start, end, line, parent, mc) {
|
||||
fMarkType = markType;
|
||||
fType = Type::kMark;
|
||||
}
|
||||
|
||||
Definition(Bracket bracket, const char* start, int lineCount, Definition* parent)
|
||||
: Definition(start, nullptr, lineCount, parent) {
|
||||
Definition(Bracket bracket, const char* start, int lineCount, Definition* parent, char mc)
|
||||
: Definition(start, nullptr, lineCount, parent, mc) {
|
||||
fBracket = bracket;
|
||||
fType = Type::kBracket;
|
||||
}
|
||||
|
||||
Definition(KeyWord keyWord, const char* start, const char* end, int lineCount,
|
||||
Definition* parent)
|
||||
: Definition(start, end, lineCount, parent) {
|
||||
Definition* parent, char mc)
|
||||
: Definition(start, end, lineCount, parent, mc) {
|
||||
fKeyWord = keyWord;
|
||||
fType = Type::kKeyWord;
|
||||
}
|
||||
|
||||
Definition(Punctuation punctuation, const char* start, int lineCount, Definition* parent)
|
||||
: Definition(start, nullptr, lineCount, parent) {
|
||||
Definition(Punctuation punctuation, const char* start, int lineCount, Definition* parent, char mc)
|
||||
: Definition(start, nullptr, lineCount, parent, mc) {
|
||||
fPunctuation = punctuation;
|
||||
fType = Type::kPunctuation;
|
||||
}
|
||||
@ -845,8 +854,6 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool exampleToScript(string* result, ExampleOptions ) const;
|
||||
string extractText(TrimExtract trimExtract) const;
|
||||
string fiddleName() const;
|
||||
const Definition* findClone(string match) const;
|
||||
string formatFunction(Format format) const;
|
||||
@ -901,8 +908,6 @@ public:
|
||||
fParentIndex = fParent ? (int) fParent->fTokens.size() : -1;
|
||||
}
|
||||
|
||||
void setWrapper();
|
||||
|
||||
const Definition* topicParent() const {
|
||||
Definition* test = fParent;
|
||||
while (test) {
|
||||
@ -936,6 +941,7 @@ public:
|
||||
MethodType fMethodType = MethodType::kNone;
|
||||
Operator fOperator = Operator::kUnknown;
|
||||
Type fType = Type::kNone;
|
||||
char fMC = '#';
|
||||
bool fClone = false;
|
||||
bool fCloned = false;
|
||||
bool fDeprecated = false;
|
||||
@ -958,12 +964,12 @@ public:
|
||||
RootDefinition() {
|
||||
}
|
||||
|
||||
RootDefinition(MarkType markType, const char* start, int line, Definition* parent)
|
||||
: Definition(markType, start, line, parent) {
|
||||
RootDefinition(MarkType markType, const char* start, int line, Definition* parent, char mc)
|
||||
: Definition(markType, start, line, parent, mc) {
|
||||
}
|
||||
|
||||
RootDefinition(MarkType markType, const char* start, const char* end, int line,
|
||||
Definition* parent) : Definition(markType, start, end, line, parent) {
|
||||
Definition* parent, char mc) : Definition(markType, start, end, line, parent, mc) {
|
||||
}
|
||||
|
||||
~RootDefinition() override {
|
||||
@ -1205,6 +1211,12 @@ public:
|
||||
kClone, // resolved, output, with references to clones as well
|
||||
};
|
||||
|
||||
enum class ExampleOptions {
|
||||
kText,
|
||||
kPng,
|
||||
kAll
|
||||
};
|
||||
|
||||
enum class Exemplary {
|
||||
kNo,
|
||||
kYes,
|
||||
@ -1222,6 +1234,11 @@ public:
|
||||
kYes,
|
||||
};
|
||||
|
||||
enum class TrimExtract {
|
||||
kNo,
|
||||
kYes
|
||||
};
|
||||
|
||||
#define M(mt) (1LL << (int) MarkType::k##mt)
|
||||
#define M_D M(Description)
|
||||
#define M_CS M(Class) | M(Struct)
|
||||
@ -1287,6 +1304,8 @@ public:
|
||||
, { "NoExample", nullptr, MarkType::kNoExample, R_O, E_N, M_CSST | M_E | M(Method) }
|
||||
, { "Outdent", nullptr, MarkType::kOutdent, R_N, E_N, M(Code) }
|
||||
, { "Param", nullptr, MarkType::kParam, R_Y, E_N, M(Method) }
|
||||
, { "PhraseDef", nullptr, MarkType::kPhraseDef, R_Y, E_N, M(Subtopic) }
|
||||
, { "", nullptr, MarkType::kPhraseRef, R_Y, E_N, 0 }
|
||||
, { "Platform", nullptr, MarkType::kPlatform, R_N, E_N, M(Example) | M(NoExample) }
|
||||
, { "Populate", nullptr, MarkType::kPopulate, R_N, E_N, M(Subtopic) }
|
||||
, { "Private", nullptr, MarkType::kPrivate, R_N, E_N, 0 }
|
||||
@ -1333,13 +1352,17 @@ public:
|
||||
const vector<string>& typeNameBuilder, HasTag hasTag);
|
||||
bool checkEndMarker(MarkType markType, string name) const;
|
||||
bool checkExamples() const;
|
||||
const char* checkForFullTerminal(const char* end, const Definition* ) const;
|
||||
bool checkParamReturn(const Definition* definition) const;
|
||||
bool dumpExamples(FILE* fiddleOut, Definition& def, bool* continuation) const;
|
||||
bool dumpExamples(const char* fiddleJsonFileName) const;
|
||||
bool childOf(MarkType markType) const;
|
||||
string className(MarkType markType);
|
||||
bool collectExternals();
|
||||
int endHashCount() const;
|
||||
bool endTableColumn(const char* end, const char* terminator);
|
||||
bool exampleToScript(Definition*, ExampleOptions, string* result ) const;
|
||||
string extractText(const Definition* , TrimExtract ) const;
|
||||
|
||||
RootDefinition* findBmhObject(MarkType markType, const string& typeName) const {
|
||||
auto map = fMaps[(int) markType].fBmh;
|
||||
@ -1383,6 +1406,7 @@ public:
|
||||
fCheckMethods = false;
|
||||
}
|
||||
|
||||
void setWrapper(Definition* def) const;
|
||||
bool skipNoName();
|
||||
bool skipToDefinitionEnd(MarkType markType);
|
||||
bool skipToString();
|
||||
@ -1418,6 +1442,7 @@ public:
|
||||
unordered_map<string, RootDefinition> fTypedefMap;
|
||||
unordered_map<string, Definition*> fTopicMap;
|
||||
unordered_map<string, Definition*> fAliasMap;
|
||||
unordered_map<string, Definition*> fPhraseMap;
|
||||
RootDefinition* fRoot;
|
||||
Definition* fWorkingColumn;
|
||||
Definition* fRow;
|
||||
@ -1485,6 +1510,8 @@ public:
|
||||
, { nullptr, MarkType::kNoExample }
|
||||
, { nullptr, MarkType::kOutdent }
|
||||
, { nullptr, MarkType::kParam }
|
||||
, { nullptr, MarkType::kPhraseDef }
|
||||
, { nullptr, MarkType::kPhraseRef }
|
||||
, { nullptr, MarkType::kPlatform }
|
||||
, { nullptr, MarkType::kPopulate }
|
||||
, { nullptr, MarkType::kPrivate }
|
||||
@ -1517,11 +1544,11 @@ public:
|
||||
void addKeyword(KeyWord keyWord);
|
||||
|
||||
void addPunctuation(Punctuation punctuation) {
|
||||
fParent->fTokens.emplace_back(punctuation, fChar, fLineCount, fParent);
|
||||
fParent->fTokens.emplace_back(punctuation, fChar, fLineCount, fParent, '\0');
|
||||
}
|
||||
|
||||
void addWord() {
|
||||
fParent->fTokens.emplace_back(fIncludeWord, fChar, fLineCount, fParent);
|
||||
fParent->fTokens.emplace_back(fIncludeWord, fChar, fLineCount, fParent, '\0');
|
||||
fIncludeWord = nullptr;
|
||||
}
|
||||
|
||||
@ -1602,7 +1629,7 @@ public:
|
||||
|
||||
void pushBracket(Bracket bracket) {
|
||||
this->setBracketShortCuts(bracket);
|
||||
fParent->fTokens.emplace_back(bracket, fChar, fLineCount, fParent);
|
||||
fParent->fTokens.emplace_back(bracket, fChar, fLineCount, fParent, '\0');
|
||||
Definition* container = &fParent->fTokens.back();
|
||||
this->addDefinition(container);
|
||||
}
|
||||
@ -1889,7 +1916,7 @@ public:
|
||||
|
||||
void constOut(const Definition* memberStart, const Definition& child,
|
||||
const Definition* bmhConst);
|
||||
void descriptionOut(const Definition* def, SkipFirstLine );
|
||||
void descriptionOut(const Definition* def, SkipFirstLine , Phrase );
|
||||
void enumHeaderOut(const RootDefinition* root, const Definition& child);
|
||||
void enumMembersOut(const RootDefinition* root, Definition& child);
|
||||
void enumSizeItems(const Definition& child);
|
||||
|
@ -103,7 +103,7 @@ bool Catalog::parseFromFile(const char* path) {
|
||||
|
||||
bool Catalog::pngOut(Definition* example) {
|
||||
string result;
|
||||
if (!example->exampleToScript(&result, Definition::ExampleOptions::kPng)) {
|
||||
if (!fBmhParser->exampleToScript(example, BmhParser::ExampleOptions::kPng, &result)) {
|
||||
return false;
|
||||
}
|
||||
if (result.length() > 0) {
|
||||
@ -121,7 +121,7 @@ bool Catalog::pngOut(Definition* example) {
|
||||
bool Catalog::textOut(Definition* def, const char* stdOutStart,
|
||||
const char* stdOutEnd) {
|
||||
string result;
|
||||
if (!def->exampleToScript(&result, Definition::ExampleOptions::kText)) {
|
||||
if (!fBmhParser->exampleToScript(def, BmhParser::ExampleOptions::kText, &result)) {
|
||||
return false;
|
||||
}
|
||||
if (result.length() > 0) {
|
||||
|
@ -6,51 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "bookmaker.h"
|
||||
#include "SkOSPath.h"
|
||||
|
||||
static size_t count_indent(const string& text, size_t test, size_t end) {
|
||||
size_t result = test;
|
||||
while (test < end) {
|
||||
if (' ' != text[test]) {
|
||||
break;
|
||||
}
|
||||
++test;
|
||||
}
|
||||
return test - result;
|
||||
}
|
||||
|
||||
static void add_code(const string& text, int pos, int end,
|
||||
size_t outIndent, size_t textIndent, string& example) {
|
||||
do {
|
||||
// fix this to move whole paragraph in, out, but preserve doc indent
|
||||
int nextIndent = count_indent(text, pos, end);
|
||||
size_t len = text.find('\n', pos);
|
||||
if (string::npos == len) {
|
||||
len = end;
|
||||
}
|
||||
if ((size_t) (pos + nextIndent) < len) {
|
||||
size_t indent = outIndent + nextIndent;
|
||||
SkASSERT(indent >= textIndent);
|
||||
indent -= textIndent;
|
||||
for (size_t index = 0; index < indent; ++index) {
|
||||
example += ' ';
|
||||
}
|
||||
pos += nextIndent;
|
||||
while ((size_t) pos < len) {
|
||||
example += '"' == text[pos] ? "\\\"" :
|
||||
'\\' == text[pos] ? "\\\\" :
|
||||
text.substr(pos, 1);
|
||||
++pos;
|
||||
}
|
||||
example += "\\n";
|
||||
} else {
|
||||
pos += nextIndent;
|
||||
}
|
||||
if ('\n' == text[pos]) {
|
||||
++pos;
|
||||
}
|
||||
} while (pos < end);
|
||||
}
|
||||
|
||||
#ifdef CONST
|
||||
#undef CONST
|
||||
@ -487,215 +442,6 @@ void Definition::setCanonicalFiddle() {
|
||||
fFiddle = Definition::NormalizedName(result);
|
||||
}
|
||||
|
||||
void Definition::setWrapper() {
|
||||
const char drawWrapper[] = "void draw(SkCanvas* canvas) {";
|
||||
const char drawNoCanvas[] = "void draw(SkCanvas* ) {";
|
||||
string text = this->extractText(Definition::TrimExtract::kNo);
|
||||
size_t nonSpace = 0;
|
||||
while (nonSpace < text.length() && ' ' >= text[nonSpace]) {
|
||||
++nonSpace;
|
||||
}
|
||||
bool hasFunc = !text.compare(nonSpace, sizeof(drawWrapper) - 1, drawWrapper);
|
||||
bool noCanvas = !text.compare(nonSpace, sizeof(drawNoCanvas) - 1, drawNoCanvas);
|
||||
bool hasCanvas = string::npos != text.find("SkCanvas canvas");
|
||||
SkASSERT(!hasFunc || !noCanvas);
|
||||
bool preprocessor = text[0] == '#';
|
||||
bool wrapCode = !hasFunc && !noCanvas && !preprocessor;
|
||||
if (wrapCode) {
|
||||
fWrapper = hasCanvas ? string(drawNoCanvas) : string(drawWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions) const {
|
||||
bool hasFiddle = true;
|
||||
const Definition* platform = this->hasChild(MarkType::kPlatform);
|
||||
if (platform) {
|
||||
TextParser platParse(platform);
|
||||
hasFiddle = !platParse.strnstr("!fiddle", platParse.fEnd);
|
||||
}
|
||||
if (!hasFiddle) {
|
||||
*result = "";
|
||||
return true;
|
||||
}
|
||||
string text = this->extractText(Definition::TrimExtract::kNo);
|
||||
bool textOut = string::npos != text.find("SkDebugf(")
|
||||
|| string::npos != text.find("dump(")
|
||||
|| string::npos != text.find("dumpHex(");
|
||||
string heightStr = "256";
|
||||
string widthStr = "256";
|
||||
string normalizedName(fFiddle);
|
||||
string code;
|
||||
string imageStr = "0";
|
||||
string srgbStr = "false";
|
||||
string durationStr = "0";
|
||||
for (auto const& iter : fChildren) {
|
||||
switch (iter->fMarkType) {
|
||||
case MarkType::kDuration:
|
||||
durationStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kHeight:
|
||||
heightStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kWidth:
|
||||
widthStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kDescription:
|
||||
// ignore for now
|
||||
break;
|
||||
case MarkType::kFunction: {
|
||||
// emit this, but don't wrap this in draw()
|
||||
string funcText(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
size_t pos = 0;
|
||||
while (pos < funcText.length() && ' ' > funcText[pos]) {
|
||||
++pos;
|
||||
}
|
||||
size_t indent = count_indent(funcText, pos, funcText.length());
|
||||
add_code(funcText, pos, funcText.length(), 0, indent, code);
|
||||
code += "\\n";
|
||||
} break;
|
||||
case MarkType::kComment:
|
||||
break;
|
||||
case MarkType::kImage:
|
||||
imageStr = string(iter->fContentStart, iter->fContentEnd - iter->fContentStart);
|
||||
break;
|
||||
case MarkType::kToDo:
|
||||
break;
|
||||
case MarkType::kBug:
|
||||
case MarkType::kMarkChar:
|
||||
case MarkType::kPlatform:
|
||||
// ignore for now
|
||||
break;
|
||||
case MarkType::kSet:
|
||||
if ("sRGB" == string(iter->fContentStart,
|
||||
iter->fContentEnd - iter->fContentStart)) {
|
||||
srgbStr = "true";
|
||||
} else {
|
||||
SkASSERT(0); // more work to do
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MarkType::kStdOut:
|
||||
textOut = true;
|
||||
break;
|
||||
default:
|
||||
SkASSERT(0); // more coding to do
|
||||
}
|
||||
}
|
||||
string animatedStr = "0" != durationStr ? "true" : "false";
|
||||
string textOutStr = textOut ? "true" : "false";
|
||||
size_t pos = 0;
|
||||
while (pos < text.length() && ' ' > text[pos]) {
|
||||
++pos;
|
||||
}
|
||||
size_t end = text.length();
|
||||
size_t outIndent = 0;
|
||||
size_t textIndent = count_indent(text, pos, end);
|
||||
if (fWrapper.length() > 0) {
|
||||
code += fWrapper;
|
||||
code += "\\n";
|
||||
outIndent = 4;
|
||||
}
|
||||
add_code(text, pos, end, outIndent, textIndent, code);
|
||||
if (fWrapper.length() > 0) {
|
||||
code += "}";
|
||||
}
|
||||
string example = "\"" + normalizedName + "\": {\n";
|
||||
size_t nameStart = fFileName.find(SkOSPath::SEPARATOR, 0);
|
||||
SkASSERT(string::npos != nameStart);
|
||||
string baseFile = fFileName.substr(nameStart + 1, fFileName.length() - nameStart - 5);
|
||||
if (ExampleOptions::kText == exampleOptions) {
|
||||
example += " \"code\": \"" + code + "\",\n";
|
||||
example += " \"hash\": \"" + fHash + "\",\n";
|
||||
example += " \"file\": \"" + baseFile + "\",\n";
|
||||
example += " \"name\": \"" + fName + "\",";
|
||||
} else {
|
||||
example += " \"code\": \"" + code + "\",\n";
|
||||
if (ExampleOptions::kPng == exampleOptions) {
|
||||
example += " \"width\": " + widthStr + ",\n";
|
||||
example += " \"height\": " + heightStr + ",\n";
|
||||
example += " \"hash\": \"" + fHash + "\",\n";
|
||||
example += " \"file\": \"" + baseFile + "\",\n";
|
||||
example += " \"name\": \"" + fName + "\"\n";
|
||||
example += "}";
|
||||
} else {
|
||||
example += " \"options\": {\n";
|
||||
example += " \"width\": " + widthStr + ",\n";
|
||||
example += " \"height\": " + heightStr + ",\n";
|
||||
example += " \"source\": " + imageStr + ",\n";
|
||||
example += " \"srgb\": " + srgbStr + ",\n";
|
||||
example += " \"f16\": false,\n";
|
||||
example += " \"textOnly\": " + textOutStr + ",\n";
|
||||
example += " \"animated\": " + animatedStr + ",\n";
|
||||
example += " \"duration\": " + durationStr + "\n";
|
||||
example += " },\n";
|
||||
example += " \"fast\": true";
|
||||
}
|
||||
}
|
||||
*result = example;
|
||||
return true;
|
||||
}
|
||||
|
||||
string Definition::extractText(TrimExtract trimExtract) const {
|
||||
string result;
|
||||
TextParser parser(fFileName, fContentStart, fContentEnd, fLineCount);
|
||||
int childIndex = 0;
|
||||
char mc = '#';
|
||||
while (parser.fChar < parser.fEnd) {
|
||||
if (TrimExtract::kYes == trimExtract && !parser.skipWhiteSpace()) {
|
||||
break;
|
||||
}
|
||||
if (parser.next() == mc) {
|
||||
if (parser.next() == mc) {
|
||||
if (parser.next() == mc) {
|
||||
mc = parser.next();
|
||||
}
|
||||
} else {
|
||||
// fixme : more work to do if # style comment is in text
|
||||
// if in method definition, could be alternate method name
|
||||
--parser.fChar;
|
||||
if (' ' < parser.fChar[0]) {
|
||||
if (islower(parser.fChar[0])) {
|
||||
result += '\n';
|
||||
parser.skipLine();
|
||||
} else {
|
||||
SkASSERT(isupper(parser.fChar[0]));
|
||||
parser.skipTo(fChildren[childIndex]->fTerminator);
|
||||
if (mc == parser.fChar[0] && mc == parser.fChar[1]) {
|
||||
parser.next();
|
||||
parser.next();
|
||||
}
|
||||
childIndex++;
|
||||
}
|
||||
} else {
|
||||
parser.skipLine();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
--parser.fChar;
|
||||
}
|
||||
const char* end = parser.fEnd;
|
||||
const char* mark = parser.strnchr(mc, end);
|
||||
if (mark) {
|
||||
end = mark;
|
||||
}
|
||||
string fragment(parser.fChar, end - parser.fChar);
|
||||
trim_end(fragment);
|
||||
if (TrimExtract::kYes == trimExtract) {
|
||||
trim_start(fragment);
|
||||
if (result.length()) {
|
||||
result += '\n';
|
||||
result += '\n';
|
||||
}
|
||||
}
|
||||
if (TrimExtract::kYes == trimExtract || has_nonwhitespace(fragment)) {
|
||||
result += fragment;
|
||||
}
|
||||
parser.skipTo(end);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void space_pad(string* str) {
|
||||
size_t len = str->length();
|
||||
if (len == 0) {
|
||||
|
@ -87,7 +87,7 @@ void IncludeParser::ValidateKeyWords() {
|
||||
}
|
||||
|
||||
void IncludeParser::addKeyword(KeyWord keyWord) {
|
||||
fParent->fTokens.emplace_back(keyWord, fIncludeWord, fChar, fLineCount, fParent);
|
||||
fParent->fTokens.emplace_back(keyWord, fIncludeWord, fChar, fLineCount, fParent, '\0');
|
||||
fIncludeWord = nullptr;
|
||||
if (KeyProperty::kObject == kKeyWords[(int) keyWord].fProperty) {
|
||||
Definition* def = &fParent->fTokens.back();
|
||||
@ -1295,7 +1295,7 @@ bool IncludeParser::parseComment(const string& filename, const char* start, cons
|
||||
}
|
||||
const char* lineEnd = parser.trimmedLineEnd();
|
||||
markupDef->fTokens.emplace_back(MarkType::kComment, parser.fChar, lineEnd,
|
||||
parser.fLineCount, parent);
|
||||
parser.fLineCount, parent, '\0');
|
||||
parser.skipToEndBracket('\n');
|
||||
}
|
||||
return true;
|
||||
@ -1338,7 +1338,7 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) {
|
||||
markupChild->fLineCount = child->fLineCount;
|
||||
} else {
|
||||
markupDef->fTokens.emplace_back(MarkType::kEnum, child->fContentStart, child->fContentEnd,
|
||||
child->fLineCount, markupDef);
|
||||
child->fLineCount, markupDef, '\0');
|
||||
markupChild = &markupDef->fTokens.back();
|
||||
}
|
||||
SkASSERT(KeyWord::kNone == markupChild->fKeyWord);
|
||||
@ -1385,7 +1385,7 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) {
|
||||
parser.skipToLineStart();
|
||||
}
|
||||
markupChild->fTokens.emplace_back(MarkType::kComment, start, end, parser.fLineCount,
|
||||
markupChild);
|
||||
markupChild, '\0');
|
||||
comment = &markupChild->fTokens.back();
|
||||
comment->fTerminator = end;
|
||||
if (!this->parseComment(parser.fFileName, start, end, parser.fLineCount, comment)) {
|
||||
@ -1439,12 +1439,12 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) {
|
||||
SkASSERT(!parser.eof());
|
||||
const char* commentEnd = parser.fChar;
|
||||
markupChild->fTokens.emplace_back(MarkType::kComment, commentStart, commentEnd,
|
||||
parser.fLineCount, markupChild);
|
||||
parser.fLineCount, markupChild, '\0');
|
||||
comment = &markupChild->fTokens.back();
|
||||
comment->fTerminator = commentEnd;
|
||||
}
|
||||
markupChild->fTokens.emplace_back(MarkType::kMember, dataStart, dataEnd, parser.fLineCount,
|
||||
markupChild);
|
||||
markupChild, '\0');
|
||||
Definition* member = &markupChild->fTokens.back();
|
||||
member->fName = memberName;
|
||||
if (comment) {
|
||||
@ -1463,7 +1463,7 @@ bool IncludeParser::parseEnum(Definition* child, Definition* markupDef) {
|
||||
}
|
||||
SkASSERT(KeyWord::kStatic == outsideMember->fKeyWord);
|
||||
markupChild->fTokens.emplace_back(MarkType::kMember, outsideMember->fContentStart,
|
||||
outsideMember->fContentEnd, outsideMember->fLineCount, markupChild);
|
||||
outsideMember->fContentEnd, outsideMember->fLineCount, markupChild, '\0');
|
||||
Definition* member = &markupChild->fTokens.back();
|
||||
member->fName = outsideMember->fName;
|
||||
// FIXME: ? add comment as well ?
|
||||
@ -1503,7 +1503,7 @@ bool IncludeParser::parseInclude(const string& name) {
|
||||
bool IncludeParser::parseMember(Definition* child, Definition* markupDef) {
|
||||
const char* typeStart = child->fChildren[0]->fContentStart;
|
||||
markupDef->fTokens.emplace_back(MarkType::kMember, typeStart, child->fContentStart,
|
||||
child->fLineCount, markupDef);
|
||||
child->fLineCount, markupDef, '\0');
|
||||
Definition* markupChild = &markupDef->fTokens.back();
|
||||
TextParser nameParser(child);
|
||||
nameParser.skipToNonAlphaNum();
|
||||
@ -1534,7 +1534,7 @@ bool IncludeParser::parseMember(Definition* child, Definition* markupDef) {
|
||||
}
|
||||
}
|
||||
markupDef->fTokens.emplace_back(MarkType::kComment, start, end, child->fLineCount,
|
||||
markupDef);
|
||||
markupDef, '\0');
|
||||
Definition* commentChild = &markupDef->fTokens.back();
|
||||
markupChild->fChildren.emplace_back(commentChild);
|
||||
parser.skipTo(end);
|
||||
@ -1676,7 +1676,7 @@ bool IncludeParser::parseMethod(Definition* child, Definition* markupDef) {
|
||||
return true;
|
||||
}
|
||||
markupDef->fTokens.emplace_back(MarkType::kMethod, start, end, tokenIter->fLineCount,
|
||||
markupDef);
|
||||
markupDef, '\0');
|
||||
Definition* markupChild = &markupDef->fTokens.back();
|
||||
// do find instead -- I wonder if there is a way to prevent this in c++
|
||||
IClassDefinition& classDef = fIClassMap[markupDef->fName];
|
||||
@ -1873,7 +1873,7 @@ bool IncludeParser::parseTypedef(Definition* child, Definition* markupDef) {
|
||||
return true;
|
||||
}
|
||||
markupDef->fTokens.emplace_back(MarkType::kTypedef, child->fContentStart, child->fContentEnd,
|
||||
child->fLineCount, markupDef);
|
||||
child->fLineCount, markupDef, '\0');
|
||||
Definition* markupChild = &markupDef->fTokens.back();
|
||||
markupChild->fName = nameStr;
|
||||
markupChild->fTerminator = markupChild->fContentEnd;
|
||||
|
@ -15,13 +15,14 @@ void IncludeWriter::constOut(const Definition* memberStart, const Definition& ch
|
||||
this->lf(2);
|
||||
this->writeCommentHeader();
|
||||
fIndent += 4;
|
||||
this->descriptionOut(bmhConst, SkipFirstLine::kYes);
|
||||
this->descriptionOut(bmhConst, SkipFirstLine::kYes, Phrase::kNo);
|
||||
fIndent -= 4;
|
||||
this->writeCommentTrailer();
|
||||
fStart = memberStart->fContentStart;
|
||||
}
|
||||
|
||||
void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirstLine) {
|
||||
void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirstLine,
|
||||
Phrase phrase) {
|
||||
const char* commentStart = def->fContentStart;
|
||||
if (SkipFirstLine::kYes == skipFirstLine) {
|
||||
TextParser parser(def);
|
||||
@ -99,7 +100,11 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
|
||||
commentLen = (int) (prop->fContentEnd - commentStart);
|
||||
if (commentLen > 0) {
|
||||
this->writeBlockIndent(commentLen, commentStart);
|
||||
if ('\n' != commentStart[commentLen - 1] && '\n' == commentStart[commentLen]) {
|
||||
const char* end = commentStart + commentLen;
|
||||
while (end > commentStart && ' ' == end[-1]) {
|
||||
--end;
|
||||
}
|
||||
if (end > commentStart && '\n' == end[-1]) {
|
||||
this->lfcr();
|
||||
}
|
||||
}
|
||||
@ -175,7 +180,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
|
||||
SkASSERT(MarkType::kColumn == column->fMarkType);
|
||||
this->writeString("-");
|
||||
this->writeSpace();
|
||||
this->descriptionOut(column, SkipFirstLine::kNo);
|
||||
this->descriptionOut(column, SkipFirstLine::kNo, Phrase::kNo);
|
||||
this->lf(1);
|
||||
}
|
||||
}
|
||||
@ -185,6 +190,22 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
|
||||
this->lf(2);
|
||||
}
|
||||
break;
|
||||
case MarkType::kPhraseRef: {
|
||||
commentLen = prop->fStart - commentStart;
|
||||
if (commentLen > 0) {
|
||||
this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
|
||||
// ince we don't do line wrapping, always insert LF before phrase
|
||||
this->lfcr(); // TODO: remove this once rewriteBlock rewraps paragraphs
|
||||
}
|
||||
auto iter = fBmhParser->fPhraseMap.find(prop->fName);
|
||||
if (fBmhParser->fPhraseMap.end() == iter) {
|
||||
return this->reportError<void>("missing phrase definition");
|
||||
}
|
||||
Definition* phraseDef = iter->second;
|
||||
this->rewriteBlock(phraseDef->length(), phraseDef->fContentStart, Phrase::kYes);
|
||||
commentStart = prop->fContentStart;
|
||||
commentLen = (int) (def->fContentEnd - commentStart);
|
||||
} break;
|
||||
default:
|
||||
commentLen = (int) (prop->fStart - commentStart);
|
||||
breakOut = true;
|
||||
@ -195,7 +216,7 @@ void IncludeWriter::descriptionOut(const Definition* def, SkipFirstLine skipFirs
|
||||
}
|
||||
SkASSERT(wroteCode || (commentLen > 0 && commentLen < 1500) || def->fDeprecated);
|
||||
if (commentLen > 0) {
|
||||
this->rewriteBlock(commentLen, commentStart, Phrase::kNo);
|
||||
this->rewriteBlock(commentLen, commentStart, phrase);
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,7 +675,7 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
|
||||
}
|
||||
this->writeCommentHeader();
|
||||
fIndent += 4;
|
||||
this->descriptionOut(method, SkipFirstLine::kNo);
|
||||
this->descriptionOut(method, SkipFirstLine::kNo, Phrase::kNo);
|
||||
// compute indention column
|
||||
size_t column = 0;
|
||||
bool hasParmReturn = false;
|
||||
@ -671,8 +692,6 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
|
||||
column += fIndent + sizeof("@return ");
|
||||
int saveIndent = fIndent;
|
||||
for (auto methodPart : method->fChildren) {
|
||||
const char* partStart = methodPart->fContentStart;
|
||||
const char* partEnd = methodPart->fContentEnd;
|
||||
if (MarkType::kParam == methodPart->fMarkType) {
|
||||
this->writeString("@param");
|
||||
this->writeSpace();
|
||||
@ -682,18 +701,24 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
this->indentToColumn(column);
|
||||
fIndent = column;
|
||||
#if 0
|
||||
const char* partStart = methodPart->fContentStart;
|
||||
const char* partEnd = methodPart->fContentEnd;
|
||||
while ('\n' == partEnd[-1]) {
|
||||
--partEnd;
|
||||
}
|
||||
while ('#' == partEnd[-1]) { // FIXME: so wrong; should not be before fContentEnd
|
||||
--partEnd;
|
||||
}
|
||||
this->indentToColumn(column);
|
||||
int partLen = (int) (partEnd - partStart);
|
||||
// FIXME : detect this earlier; assert if #Return is empty
|
||||
SkASSERT(partLen > 0 && partLen < 300); // may assert if param desc is especially long
|
||||
fIndent = column;
|
||||
this->rewriteBlock(partLen, partStart, Phrase::kYes);
|
||||
#else
|
||||
this->descriptionOut(methodPart, SkipFirstLine::kNo, Phrase::kYes);
|
||||
#endif
|
||||
fIndent = saveIndent;
|
||||
this->lfcr();
|
||||
}
|
||||
@ -820,7 +845,7 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const
|
||||
this->indentToColumn(fStructCommentTab);
|
||||
this->writeString("//!<");
|
||||
this->writeSpace();
|
||||
string extract = commentBlock->extractText(Definition::TrimExtract::kYes);
|
||||
string extract = fBmhParser->extractText(commentBlock, BmhParser::TrimExtract::kYes);
|
||||
this->rewriteBlock(extract.length(), &extract.front(), Phrase::kNo);
|
||||
}
|
||||
this->lf(2);
|
||||
@ -833,7 +858,7 @@ void IncludeWriter::structSetMembersShort(const vector<Definition*>& bmhChildren
|
||||
if (MarkType::kMember != memberDef->fMarkType) {
|
||||
continue;
|
||||
}
|
||||
string extract = memberDef->extractText(Definition::TrimExtract::kYes);
|
||||
string extract = fBmhParser->extractText(memberDef, BmhParser::TrimExtract::kYes);
|
||||
bool multiline = string::npos != extract.find('\n');
|
||||
if (multiline) {
|
||||
memberDef->fShort = false;
|
||||
|
@ -166,7 +166,9 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
||||
// look for Sk / sk / SK ..
|
||||
if (!ref.compare(0, 2, "Sk") && ref != "Skew" && ref != "Skews" &&
|
||||
ref != "Skip" && ref != "Skips") {
|
||||
t.reportError("missed Sk prefixed");
|
||||
if (BmhParser::Resolvable::kOut != resolvable) {
|
||||
t.reportError("missed Sk prefixed");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (!ref.compare(0, 2, "SK")) {
|
||||
@ -744,7 +746,9 @@ void MdOut::markTypeOut(Definition* def) {
|
||||
const char* textStart = def->fContentStart;
|
||||
if (MarkType::kParam != def->fMarkType && MarkType::kConst != def->fMarkType &&
|
||||
(!def->fParent || MarkType::kConst != def->fParent->fMarkType) &&
|
||||
TableState::kNone != fTableState) {
|
||||
TableState::kNone != fTableState &&
|
||||
(MarkType::kPhraseRef != def->fMarkType || !def->fParent ||
|
||||
MarkType::kParam != def->fParent->fMarkType)) {
|
||||
this->writePending();
|
||||
FPRINTF("</table>");
|
||||
this->lf(2);
|
||||
@ -1088,6 +1092,22 @@ void MdOut::markTypeOut(Definition* def) {
|
||||
break;
|
||||
case MarkType::kWidth:
|
||||
break;
|
||||
case MarkType::kPhraseDef:
|
||||
break;
|
||||
case MarkType::kPhraseRef:
|
||||
if (fBmhParser.fPhraseMap.end() == fBmhParser.fPhraseMap.find(def->fName)) {
|
||||
def->reportError<void>("missing phrase definition");
|
||||
} else {
|
||||
if (fColumn && ' ' >= def->fStart[0]) {
|
||||
this->writeSpace();
|
||||
}
|
||||
Definition* phraseRef = fBmhParser.fPhraseMap.find(def->fName)->second;
|
||||
this->childrenOut(phraseRef, phraseRef->fContentStart);
|
||||
if (' ' >= def->fContentStart[0]) {
|
||||
this->writeSpace();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SkDebugf("fatal error: MarkType::k%s unhandled in %s()\n",
|
||||
fBmhParser.fMaps[(int) def->fMarkType].fName, __func__);
|
||||
@ -1195,6 +1215,8 @@ void MdOut::markTypeOut(Definition* def) {
|
||||
case MarkType::kTable:
|
||||
this->lf(2);
|
||||
break;
|
||||
case MarkType::kPhraseDef:
|
||||
break;
|
||||
case MarkType::kPrivate:
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user