support srgb flag in bookmaker
allow examples to work with colorspace fix point array plural form fix spacing after private message add some SkImage documentation TBR=caryclark@google.com Docs-Preview: https://skia.org/?cl=90360 Bug: skia:6898 Change-Id: I045ee68e7dd9747ec5d40d95588bbc1594c45366 Reviewed-on: https://skia-review.googlesource.com/90360 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
36add77b9c
commit
61dfc3a53d
@ -1142,17 +1142,35 @@ Returns Color_Space, the range of colors, associated with Image. The
|
||||
reference count of Color_Space is unchanged. The returned Color_Space is
|
||||
immutable.
|
||||
|
||||
Color_Space returned was a parameter to an Image constructor,
|
||||
or was parsed from encoded data. Color_Space may be ignored when
|
||||
drawing Image, and when drawing into Surface constructed with Color_Space.
|
||||
Color_Space returned was passed to an Image constructor,
|
||||
or was parsed from encoded data. Color_Space returned may be ignored when Image
|
||||
is drawn, depending on the capabilities of the Surface receiving the drawing.
|
||||
|
||||
#Return Color_Space in Image, or nullptr ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Image 3
|
||||
#Set sRGB
|
||||
SkPixmap pixmap;
|
||||
source.peekPixels(&pixmap);
|
||||
canvas->scale(.25f, .25f);
|
||||
int y = 0;
|
||||
for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,
|
||||
SkColorSpace::kSRGB_RenderTargetGamma } ) {
|
||||
int x = 0;
|
||||
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);
|
||||
for (int index = 0; index < 2; ++index) {
|
||||
pixmap.setColorSpace(colorSpace);
|
||||
sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);
|
||||
canvas->drawImage(image, x, y);
|
||||
colorSpace = image->colorSpace()->makeColorSpin();
|
||||
x += 512;
|
||||
}
|
||||
y += 512;
|
||||
}
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso refColorSpace makeColorSpace
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -1160,13 +1178,41 @@ drawing Image, and when drawing into Surface constructed with Color_Space.
|
||||
|
||||
#Method sk_sp<SkColorSpace> refColorSpace() const
|
||||
|
||||
#Return incomplete ##
|
||||
Returns a smart pointer to Color_Space, the range of colors, associated with
|
||||
Image. The smart pointer tracks the number of objects sharing this
|
||||
SkColorSpace reference so the memory is released when the owners destruct.
|
||||
|
||||
The returned SkColorSpace is immutable.
|
||||
|
||||
Color_Space returned was passed to an Image constructor,
|
||||
or was parsed from encoded data. Color_Space returned may be ignored when Image
|
||||
is drawn, depending on the capabilities of the Surface receiving the drawing.
|
||||
|
||||
#Return Color_Space in Image, or nullptr, wrapped in a smart pointer ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Image 3
|
||||
#Set sRGB
|
||||
SkPixmap pixmap;
|
||||
source.peekPixels(&pixmap);
|
||||
canvas->scale(.25f, .25f);
|
||||
int y = 0;
|
||||
for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,
|
||||
SkColorSpace::kSRGB_RenderTargetGamma } ) {
|
||||
int x = 0;
|
||||
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);
|
||||
for (int index = 0; index < 2; ++index) {
|
||||
pixmap.setColorSpace(colorSpace);
|
||||
sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);
|
||||
canvas->drawImage(image, x, y);
|
||||
colorSpace = image->refColorSpace()->makeColorSpin();
|
||||
x += 512;
|
||||
}
|
||||
y += 512;
|
||||
}
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso colorSpace makeColorSpace
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -1180,10 +1226,15 @@ is packed in 8 bits as defined by kAlpha_8_SkColorType.
|
||||
#Return true if pixels represent a transparency mask ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
uint8_t pmColors = 0;
|
||||
sk_sp<SkImage> image = SkImage::MakeRasterCopy({SkImageInfo::MakeA8(1, 1), &pmColors, 1});
|
||||
SkDebugf("alphaOnly = %s\n", image->isAlphaOnly() ? "true" : "false");
|
||||
#StdOut
|
||||
alphaOnly = true
|
||||
##
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso alphaType isOpaque
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -1191,15 +1242,26 @@ is packed in 8 bits as defined by kAlpha_8_SkColorType.
|
||||
|
||||
#Method bool isOpaque() const
|
||||
|
||||
Returns if all pixels ignore any Alpha value and are treated as fully opaque.
|
||||
Returns true if pixels ignore their Alpha value and are treated as fully opaque.
|
||||
|
||||
#Return true if Alpha_Type is kOpaque_SkAlphaType ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
auto check_isopaque = [](const SkImageInfo& imageInfo) -> void {
|
||||
auto surface(SkSurface::MakeRaster(imageInfo));
|
||||
auto image(surface->makeImageSnapshot());
|
||||
SkDebugf("isOpaque = %s\n", image->isOpaque() ? "true" : "false");
|
||||
};
|
||||
|
||||
check_isopaque(SkImageInfo::MakeN32Premul(5, 5));
|
||||
check_isopaque(SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType));
|
||||
#StdOut
|
||||
isOpaque = false
|
||||
isOpaque = true
|
||||
##
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso alphaType isAlphaOnly
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -1208,17 +1270,31 @@ Returns if all pixels ignore any Alpha value and are treated as fully opaque.
|
||||
#Method sk_sp<SkShader> makeShader(SkShader::TileMode tileMode1, SkShader::TileMode tileMode2,
|
||||
const SkMatrix* localMatrix = nullptr) const
|
||||
|
||||
#Param tileMode1 incomplete ##
|
||||
#Param tileMode2 incomplete ##
|
||||
#Param localMatrix incomplete ##
|
||||
Creates Shader from Image. Shader dimensions are taken from Image. Shader uses
|
||||
SkShader::TileMode rules to fill drawn area outside Image. localMatrix permits
|
||||
transforming Image before Canvas_Matrix is applied.
|
||||
|
||||
#Return incomplete ##
|
||||
#Param tileMode1 tiling in x, one of: SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode,
|
||||
SkShader::kMirror_TileMode
|
||||
##
|
||||
#Param tileMode2 tiling in y, one of: SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode,
|
||||
SkShader::kMirror_TileMode
|
||||
##
|
||||
#Param localMatrix Image transformation, or nullptr ##
|
||||
|
||||
#Return Shader containing Image ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Image 4
|
||||
SkMatrix matrix;
|
||||
matrix.setRotate(45);
|
||||
SkPaint paint;
|
||||
paint.setShader(image->makeShader(SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode,
|
||||
&matrix));
|
||||
canvas->drawPaint(paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
#SeeAlso scalePixels
|
||||
|
||||
#Method ##
|
||||
|
||||
@ -1226,14 +1302,22 @@ Returns if all pixels ignore any Alpha value and are treated as fully opaque.
|
||||
|
||||
#Method sk_sp<SkShader> makeShader(const SkMatrix* localMatrix = nullptr) const
|
||||
|
||||
Helper version of makeShader() that specifies SkShader::kClamp_TileMode.
|
||||
Creates Shader from Image. Shader dimensions are taken from Image. Shader uses
|
||||
SkShader::kClamp_TileMode to fill drawn area outside Image. localMatrix permits
|
||||
transforming Image before Canvas_Matrix is applied.
|
||||
|
||||
#Param localMatrix incomplete ##
|
||||
#Param localMatrix Image transformation, or nullptr ##
|
||||
|
||||
#Return incomplete ##
|
||||
#Return Shader containing Image ##
|
||||
|
||||
#Example
|
||||
// incomplete
|
||||
#Image 5
|
||||
SkMatrix matrix;
|
||||
matrix.setRotate(45);
|
||||
matrix.postTranslate(125, 30);
|
||||
SkPaint paint;
|
||||
paint.setShader(image->makeShader(&matrix));
|
||||
canvas->drawPaint(paint);
|
||||
##
|
||||
|
||||
#SeeAlso incomplete
|
||||
|
@ -736,10 +736,9 @@ paths are interpolatable
|
||||
|
||||
#Method bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const
|
||||
|
||||
Interpolate between Paths with equal sized Point_Arrays.
|
||||
Copy Verb_Array and Weights to out,
|
||||
and set out Point_Array to a weighted average of this Point_Array and ending
|
||||
Point_Array, using the formula:
|
||||
Interpolate between Paths with Point_Array of equal size.
|
||||
Copy Verb_Array and Weights to out, and set out Point_Array to a weighted
|
||||
average of this Point_Array and ending Point_Array, using the formula:
|
||||
#Formula
|
||||
(this->points * weight) + ending->points * (1 - weight)
|
||||
##
|
||||
@ -754,8 +753,8 @@ the same size as ending Point_Array. Call isInterpolatable to check Path
|
||||
compatibility prior to calling interpolate().
|
||||
|
||||
#Param ending Point_Array averaged with this Point_Array ##
|
||||
#Param weight contribution of ending Point_Array, and
|
||||
one minus contribution of this Point_Array
|
||||
#Param weight contribution of this Point_Array, and
|
||||
one minus contribution of ending Point_Array
|
||||
##
|
||||
#Param out Path replaced by interpolated averages ##
|
||||
|
||||
@ -1759,7 +1758,7 @@ second move is not line
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
#Subtopic Point_Array
|
||||
#Alias Point_Arrays
|
||||
#Substitute SkPoint array
|
||||
|
||||
Point_Array contains Points satisfying the allocated Points for
|
||||
each Verb in Verb_Array. For instance, Path containing one Contour with Line
|
||||
|
@ -694,6 +694,10 @@ FT_Load_Glyph
|
||||
#Enum TileMode
|
||||
#Const kClamp_TileMode 0
|
||||
##
|
||||
#Const kRepeat_TileMode 1
|
||||
##
|
||||
#Const kMirror_TileMode 2
|
||||
##
|
||||
##
|
||||
#Method static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
|
||||
const SkMatrix* localMatrix = nullptr)
|
||||
|
@ -1176,9 +1176,9 @@ Returns <a href="undocumented#Color_Space">Color Space</a>, the range of colors,
|
||||
reference count of <a href="undocumented#Color_Space">Color Space</a> is unchanged. The returned <a href="undocumented#Color_Space">Color Space</a> is
|
||||
immutable.
|
||||
|
||||
<a href="undocumented#Color_Space">Color Space</a> returned was a parameter to an <a href="#Image">Image</a> constructor,
|
||||
or was parsed from encoded data. <a href="undocumented#Color_Space">Color Space</a> may be ignored when
|
||||
drawing <a href="#Image">Image</a>, and when drawing into <a href="SkSurface_Reference#Surface">Surface</a> constructed with <a href="undocumented#Color_Space">Color Space</a>.
|
||||
<a href="undocumented#Color_Space">Color Space</a> returned was passed to an <a href="#Image">Image</a> constructor,
|
||||
or was parsed from encoded data. <a href="undocumented#Color_Space">Color Space</a> returned may be ignored when <a href="#Image">Image</a>
|
||||
is drawn, depending on the capabilities of the <a href="SkSurface_Reference#Surface">Surface</a> receiving the drawing.
|
||||
|
||||
### Return Value
|
||||
|
||||
@ -1186,11 +1186,11 @@ drawing <a href="#Image">Image</a>, and when drawing into <a href="SkSurface_Ref
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="4468d573f42af6f5e234be10a5453bb2"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImage_refColorSpace">refColorSpace</a> <a href="#SkImage_makeColorSpace">makeColorSpace</a>
|
||||
|
||||
---
|
||||
|
||||
@ -1201,17 +1201,27 @@ incomplete
|
||||
sk_sp<SkColorSpace> refColorSpace() const
|
||||
</pre>
|
||||
|
||||
Returns a smart pointer to <a href="undocumented#Color_Space">Color Space</a>, the range of colors, associated with
|
||||
<a href="#Image">Image</a>. The smart pointer tracks the number of objects sharing this
|
||||
<a href="undocumented#SkColorSpace">SkColorSpace</a> reference so the memory is released when the owners destruct.
|
||||
|
||||
The returned <a href="undocumented#SkColorSpace">SkColorSpace</a> is immutable.
|
||||
|
||||
<a href="undocumented#Color_Space">Color Space</a> returned was passed to an <a href="#Image">Image</a> constructor,
|
||||
or was parsed from encoded data. <a href="undocumented#Color_Space">Color Space</a> returned may be ignored when <a href="#Image">Image</a>
|
||||
is drawn, depending on the capabilities of the <a href="SkSurface_Reference#Surface">Surface</a> receiving the drawing.
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
<a href="undocumented#Color_Space">Color Space</a> in <a href="#Image">Image</a>, or nullptr, wrapped in a smart pointer
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="59b2078ebfbda8736a57c0486ae33332"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImage_colorSpace">colorSpace</a> <a href="#SkImage_makeColorSpace">makeColorSpace</a>
|
||||
|
||||
---
|
||||
|
||||
@ -1231,11 +1241,19 @@ true if pixels represent a transparency mask
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="50762c73b8ea91959c5a7b68fbf1062d">
|
||||
|
||||
#### Example Output
|
||||
|
||||
~~~~
|
||||
alphaOnly = true
|
||||
~~~~
|
||||
|
||||
</fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImage_alphaType">alphaType</a> <a href="#SkImage_isOpaque">isOpaque</a>
|
||||
|
||||
---
|
||||
|
||||
@ -1246,7 +1264,7 @@ incomplete
|
||||
bool isOpaque() const
|
||||
</pre>
|
||||
|
||||
Returns if all pixels ignore any <a href="#Alpha">Alpha</a> value and are treated as fully opaque.
|
||||
Returns true if pixels ignore their <a href="#Alpha">Alpha</a> value and are treated as fully opaque.
|
||||
|
||||
### Return Value
|
||||
|
||||
@ -1254,11 +1272,20 @@ true if <a href="#Alpha_Type">Alpha Type</a> is <a href="undocumented#SkAlphaTyp
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="e3340460003b74ee286d625e68589d65">
|
||||
|
||||
#### Example Output
|
||||
|
||||
~~~~
|
||||
isOpaque = false
|
||||
isOpaque = true
|
||||
~~~~
|
||||
|
||||
</fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImage_alphaType">alphaType</a> <a href="#SkImage_isAlphaOnly">isAlphaOnly</a>
|
||||
|
||||
---
|
||||
|
||||
@ -1270,28 +1297,34 @@ sk_sp<SkShader> makeShader(SkShader::TileMode tileMode1, SkShader::TileMod
|
||||
const SkMatrix* localMatrix = nullptr) const
|
||||
</pre>
|
||||
|
||||
Creates <a href="undocumented#Shader">Shader</a> from <a href="#Image">Image</a>. <a href="undocumented#Shader">Shader</a> <a href="#SkImage_dimensions">dimensions</a> are taken from <a href="#Image">Image</a>. <a href="undocumented#Shader">Shader</a> uses
|
||||
<a href="#SkShader_TileMode">SkShader::TileMode</a> rules to fill drawn area outside <a href="#Image">Image</a>. <a href="#SkImage_makeShader_localMatrix">localMatrix</a> permits
|
||||
transforming <a href="#Image">Image</a> before <a href="#Matrix">Canvas Matrix</a> is applied.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImage_makeShader_tileMode1"> <code><strong>tileMode1 </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
tiling in x, one of: <a href="#SkShader_kClamp_TileMode">SkShader::kClamp TileMode</a>, <a href="#SkShader_kRepeat_TileMode">SkShader::kRepeat TileMode</a>,
|
||||
<a href="#SkShader_kMirror_TileMode">SkShader::kMirror TileMode</a></td>
|
||||
</tr> <tr> <td><a name="SkImage_makeShader_tileMode2"> <code><strong>tileMode2 </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
tiling in y, one of: <a href="#SkShader_kClamp_TileMode">SkShader::kClamp TileMode</a>, <a href="#SkShader_kRepeat_TileMode">SkShader::kRepeat TileMode</a>,
|
||||
<a href="#SkShader_kMirror_TileMode">SkShader::kMirror TileMode</a></td>
|
||||
</tr> <tr> <td><a name="SkImage_makeShader_localMatrix"> <code><strong>localMatrix </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
<a href="#Image">Image</a> transformation, or nullptr</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
<a href="undocumented#Shader">Shader</a> containing <a href="#Image">Image</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="1c6de6fe72b00b5be970f5f718363449"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
incomplete
|
||||
<a href="#SkImage_scalePixels">scalePixels</a>
|
||||
|
||||
---
|
||||
|
||||
@ -1299,22 +1332,24 @@ incomplete
|
||||
sk_sp<SkShader> makeShader(const SkMatrix* localMatrix = nullptr) const
|
||||
</pre>
|
||||
|
||||
Helper version of
|
||||
Creates <a href="undocumented#Shader">Shader</a> from <a href="#Image">Image</a>. <a href="undocumented#Shader">Shader</a> <a href="#SkImage_dimensions">dimensions</a> are taken from <a href="#Image">Image</a>. <a href="undocumented#Shader">Shader</a> uses
|
||||
<a href="#SkShader_kClamp_TileMode">SkShader::kClamp TileMode</a> to fill drawn area outside <a href="#Image">Image</a>. <a href="#SkImage_makeShader_2_localMatrix">localMatrix</a> permits
|
||||
transforming <a href="#Image">Image</a> before <a href="#Matrix">Canvas Matrix</a> is applied.
|
||||
|
||||
### Parameters
|
||||
|
||||
<table> <tr> <td><a name="SkImage_makeShader_2_localMatrix"> <code><strong>localMatrix </strong></code> </a></td> <td>
|
||||
incomplete</td>
|
||||
<a href="#Image">Image</a> transformation, or nullptr</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
### Return Value
|
||||
|
||||
incomplete
|
||||
<a href="undocumented#Shader">Shader</a> containing <a href="#Image">Image</a>
|
||||
|
||||
### Example
|
||||
|
||||
<div><fiddle-embed name="882e8e0103048009a25cfc20400492f7"></fiddle-embed></div>
|
||||
<div><fiddle-embed name="10172fca71b9dbdcade772513ffeb27e"></fiddle-embed></div>
|
||||
|
||||
### See Also
|
||||
|
||||
|
@ -614,10 +614,9 @@ paths are interpolatable
|
||||
bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const
|
||||
</pre>
|
||||
|
||||
Interpolate between <a href="#Path">Paths</a> with equal sized <a href="SkPath_Reference#Point_Array">Point Arrays</a>.
|
||||
Copy <a href="#Verb_Array">Verb Array</a> and <a href="#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:
|
||||
Interpolate 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="#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:
|
||||
(this->points * <a href="#SkPath_interpolate_weight">weight</a>) + <a href="#SkPath_interpolate_ending">ending</a>->points * (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
|
||||
@ -633,8 +632,8 @@ compatibility prior to calling <a href="#SkPath_interpolate">interpolate</a>.
|
||||
<table> <tr> <td><a name="SkPath_interpolate_ending"> <code><strong>ending </strong></code> </a></td> <td>
|
||||
<a href="#Point_Array">Point Array</a> averaged with this <a href="#Point_Array">Point Array</a></td>
|
||||
</tr> <tr> <td><a name="SkPath_interpolate_weight"> <code><strong>weight </strong></code> </a></td> <td>
|
||||
contribution of <a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a>, and
|
||||
one minus contribution of this <a href="#Point_Array">Point Array</a></td>
|
||||
contribution of this <a href="#Point_Array">Point Array</a>, and
|
||||
one minus contribution of <a href="#SkPath_interpolate_ending">ending</a> <a href="#Point_Array">Point Array</a></td>
|
||||
</tr> <tr> <td><a name="SkPath_interpolate_out"> <code><strong>out </strong></code> </a></td> <td>
|
||||
<a href="#Path">Path</a> replaced by interpolated averages</td>
|
||||
</tr>
|
||||
|
@ -1049,6 +1049,20 @@
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::dimensions()",
|
||||
"stdout": "dimensionsAsBounds == bounds\\n"
|
||||
},
|
||||
"SkImage_isAlphaOnly": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n uint8_t pmColors = 0;\n sk_sp<SkImage> image = SkImage::MakeRasterCopy({SkImageInfo::MakeA8(1, 1), &pmColors, 1});\n SkDebugf(\"alphaOnly = %s\\n\", image->isAlphaOnly() ? \"true\" : \"false\");\n}",
|
||||
"hash": "50762c73b8ea91959c5a7b68fbf1062d",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::isAlphaOnly",
|
||||
"stdout": "alphaOnly = true\\n"
|
||||
},
|
||||
"SkImage_isOpaque": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n auto check_isopaque = [](const SkImageInfo& imageInfo) -> void {\n auto surface(SkSurface::MakeRaster(imageInfo));\n auto image(surface->makeImageSnapshot());\n SkDebugf(\"isOpaque = %s\\n\", image->isOpaque() ? \"true\" : \"false\");\n };\n check_isopaque(SkImageInfo::MakeN32Premul(5, 5));\n check_isopaque(SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType));\n}",
|
||||
"hash": "e3340460003b74ee286d625e68589d65",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::isOpaque",
|
||||
"stdout": "isOpaque = false\\nisOpaque = true\\n"
|
||||
},
|
||||
"SkMatrix_I": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkMatrix m1, m2, m3;\n m1.reset();\n m2.setIdentity();\n m3 = SkMatrix::I();\n SkDebugf(\"m1 %c= m2\\n\", m1 == m2 ? '=' : '!');\n SkDebugf(\"m2 %c= m3\\n\", m1 == m2 ? '=' : '!');\n}",
|
||||
@ -4868,10 +4882,10 @@
|
||||
"name": "SkImage::bounds()"
|
||||
},
|
||||
"SkImage_colorSpace": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPixmap pixmap;\n source.peekPixels(&pixmap);\n canvas->scale(.25f, .25f);\n int y = 0;\n for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,\n SkColorSpace::kSRGB_RenderTargetGamma } ) {\n int x = 0;\n sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);\n for (int index = 0; index < 2; ++index) {\n pixmap.setColorSpace(colorSpace);\n sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);\n canvas->drawImage(image, x, y);\n colorSpace = image->colorSpace()->makeColorSpin();\n x += 512;\n }\n y += 512;\n }\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"hash": "4468d573f42af6f5e234be10a5453bb2",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::colorSpace"
|
||||
},
|
||||
@ -4914,14 +4928,6 @@
|
||||
"hash": "96c8202a13068e36432006f75b124eee",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::height()"
|
||||
},
|
||||
"SkImage_isAlphaOnly": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::isAlphaOnly"
|
||||
},
|
||||
"SkImage_isLazyGenerated": {
|
||||
"code": "class TestImageGenerator : public SkImageGenerator {\npublic:\n TestImageGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(10, 10)) {}\n ~TestImageGenerator() override {}\nprotected:\n bool onGetPixels(const SkImageInfo& info, void* pixelPtr, size_t rowBytes,\n const Options& options) override {\n SkPMColor* pixels = static_cast<SkPMColor*>(pixelPtr);\n for (int y = 0; y < info.height(); ++y) {\n for (int x = 0; x < info.width(); ++x) {\n pixels[y * info.width() + x] = 0xff223344 + y * 0x000C0811;\n }\n }\n return true;\n }\n};\n\nvoid draw(SkCanvas* canvas) {\n auto gen = std::unique_ptr<TestImageGenerator>(new TestImageGenerator());\n sk_sp<SkImage> image(SkImage::MakeFromGenerator(std::move(gen)));\n SkString lazy(image->isLazyGenerated() ? \"is lazy\" : \"not lazy\");\n canvas->scale(8, 8);\n canvas->drawImage(image, 0, 0, nullptr);\n SkPaint paint;\n paint.setTextSize(4);\n canvas->drawString(lazy, 2, 5, paint);\n}\n",
|
||||
@ -4930,14 +4936,6 @@
|
||||
"hash": "a8b8bd4bfe968e2c63085f867665227f",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::isLazyGenerated"
|
||||
},
|
||||
"SkImage_isOpaque": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::isOpaque"
|
||||
},
|
||||
"SkImage_isTextureBacked": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
@ -4980,18 +4978,18 @@
|
||||
"name": "SkImage::makeRasterImage"
|
||||
},
|
||||
"SkImage_makeShader": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setRotate(45);\n SkPaint paint;\n paint.setShader(image->makeShader(SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode,\n &matrix));\n canvas->drawPaint(paint);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"hash": "1c6de6fe72b00b5be970f5f718363449",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::makeShader"
|
||||
},
|
||||
"SkImage_makeShader_2": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkMatrix matrix;\n matrix.setRotate(45);\n matrix.postTranslate(125, 30);\n SkPaint paint;\n paint.setShader(image->makeShader(&matrix));\n canvas->drawPaint(paint);\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"hash": "10172fca71b9dbdcade772513ffeb27e",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::makeShader_2"
|
||||
},
|
||||
@ -5044,10 +5042,10 @@
|
||||
"name": "SkImage::readPixels_2"
|
||||
},
|
||||
"SkImage_refColorSpace": {
|
||||
"code": "void draw(SkCanvas* canvas) {\n // incomplete\n}",
|
||||
"code": "void draw(SkCanvas* canvas) {\n SkPixmap pixmap;\n source.peekPixels(&pixmap);\n canvas->scale(.25f, .25f);\n int y = 0;\n for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,\n SkColorSpace::kSRGB_RenderTargetGamma } ) {\n int x = 0;\n sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);\n for (int index = 0; index < 2; ++index) {\n pixmap.setColorSpace(colorSpace);\n sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);\n canvas->drawImage(image, x, y);\n colorSpace = image->refColorSpace()->makeColorSpin();\n x += 512;\n }\n y += 512;\n }\n}",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"hash": "882e8e0103048009a25cfc20400492f7",
|
||||
"hash": "59b2078ebfbda8736a57c0486ae33332",
|
||||
"file": "SkImage_Reference",
|
||||
"name": "SkImage::refColorSpace"
|
||||
},
|
||||
|
@ -1000,6 +1000,12 @@ void dumpHex() const
|
||||
<tr>
|
||||
<td><a name="SkShader_kClamp_TileMode"> <code><strong>SkShader::kClamp_TileMode </strong></code> </a></td><td>0</td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkShader_kRepeat_TileMode"> <code><strong>SkShader::kRepeat_TileMode </strong></code> </a></td><td>1</td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="SkShader_kMirror_TileMode"> <code><strong>SkShader::kMirror_TileMode </strong></code> </a></td><td>2</td><td></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
@ -342,6 +342,7 @@ bool BmhParser::addDefinition(const char* defStart, bool hasEnd, MarkType markTy
|
||||
case MarkType::kOutdent:
|
||||
case MarkType::kPlatform:
|
||||
case MarkType::kSeeAlso:
|
||||
case MarkType::kSet:
|
||||
case MarkType::kSubstitute:
|
||||
case MarkType::kTime:
|
||||
case MarkType::kVolatile:
|
||||
@ -1262,6 +1263,7 @@ vector<string> BmhParser::typeName(MarkType markType, bool* checkEnd) {
|
||||
case MarkType::kPlatform:
|
||||
case MarkType::kReturn:
|
||||
case MarkType::kSeeAlso:
|
||||
case MarkType::kSet:
|
||||
case MarkType::kSubstitute:
|
||||
case MarkType::kTime:
|
||||
case MarkType::kToDo:
|
||||
|
@ -122,6 +122,7 @@ enum class MarkType {
|
||||
kRoot,
|
||||
kRow,
|
||||
kSeeAlso,
|
||||
kSet,
|
||||
kStdOut,
|
||||
kStruct,
|
||||
kSubstitute,
|
||||
@ -1236,6 +1237,7 @@ public:
|
||||
, { "", nullptr, MarkType::kRow, R_Y, E_N, M(Table) | M(List) }
|
||||
, { "SeeAlso", nullptr, MarkType::kSeeAlso, R_Y, E_N,
|
||||
M_CSST | M_E | M(Method) | M(Typedef) }
|
||||
, { "Set", nullptr, MarkType::kSet, R_N, E_N, M(Example) }
|
||||
, { "StdOut", nullptr, MarkType::kStdOut, R_N, E_N, M(Example) }
|
||||
, { "Struct", &fClassMap, MarkType::kStruct, R_Y, E_O, M(Class) | M(Root) | M_ST }
|
||||
, { "Substitute", nullptr, MarkType::kSubstitute, R_N, E_N, M_ST }
|
||||
@ -1425,6 +1427,7 @@ public:
|
||||
, { nullptr, MarkType::kRoot }
|
||||
, { nullptr, MarkType::kRow }
|
||||
, { nullptr, MarkType::kSeeAlso }
|
||||
, { nullptr, MarkType::kSet }
|
||||
, { nullptr, MarkType::kStdOut }
|
||||
, { &fIStructMap, MarkType::kStruct }
|
||||
, { nullptr, MarkType::kSubstitute }
|
||||
|
@ -526,6 +526,7 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
|
||||
string normalizedName(fFiddle);
|
||||
string code;
|
||||
string imageStr = "0";
|
||||
string srgbStr = "false";
|
||||
for (auto const& iter : fChildren) {
|
||||
switch (iter->fMarkType) {
|
||||
case MarkType::kError:
|
||||
@ -562,6 +563,15 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
|
||||
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;
|
||||
@ -609,7 +619,7 @@ bool Definition::exampleToScript(string* result, ExampleOptions exampleOptions)
|
||||
example += " \"width\": " + widthStr + ",\n";
|
||||
example += " \"height\": " + heightStr + ",\n";
|
||||
example += " \"source\": " + imageStr + ",\n";
|
||||
example += " \"srgb\": false,\n";
|
||||
example += " \"srgb\": " + srgbStr + ",\n";
|
||||
example += " \"f16\": false,\n";
|
||||
example += " \"textOnly\": " + textOutStr + ",\n";
|
||||
example += " \"animated\": false,\n";
|
||||
|
@ -1493,6 +1493,9 @@ bool IncludeParser::parseMethod(Definition* child, Definition* markupDef) {
|
||||
}
|
||||
tokenIter->fName = nameStr;
|
||||
tokenIter->fMarkType = MarkType::kMethod;
|
||||
if (string::npos != nameStr.find("defined")) {
|
||||
SkDebugf("");
|
||||
}
|
||||
tokenIter->fPrivate = string::npos != nameStr.find("::");
|
||||
auto testIter = child->fParent->fTokens.begin();
|
||||
SkASSERT(child->fParentIndex > 0);
|
||||
@ -1642,10 +1645,18 @@ bool IncludeParser::parseObject(Definition* child, Definition* markupDef) {
|
||||
auto tokenIter = child->fParent->fTokens.begin();
|
||||
std::advance(tokenIter, child->fParentIndex);
|
||||
tokenIter = std::prev(tokenIter);
|
||||
TextParser checkDeprecated(&*tokenIter);
|
||||
if (checkDeprecated.startsWith("SK_ATTR_DEPRECATED")) {
|
||||
TextParser previousToken(&*tokenIter);
|
||||
if (previousToken.startsWith("SK_ATTR_DEPRECATED")) {
|
||||
break;
|
||||
}
|
||||
if (Bracket::kPound == child->fParent->fBracket &&
|
||||
KeyWord::kIf == child->fParent->fKeyWord) {
|
||||
// TODO: this will skip methods named defined() -- for the
|
||||
// moment there aren't any
|
||||
if (previousToken.startsWith("defined")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this->parseMethod(child, markupDef)) {
|
||||
return child->reportError<bool>("failed to parse method");
|
||||
|
@ -65,6 +65,9 @@ void IncludeWriter::descriptionOut(const Definition* def) {
|
||||
commentLen = (int) (prop->fContentEnd - commentStart);
|
||||
if (commentLen > 0) {
|
||||
this->writeBlockIndent(commentLen, commentStart);
|
||||
if ('\n' != commentStart[commentLen - 1] && '\n' == commentStart[commentLen]) {
|
||||
this->lfcr();
|
||||
}
|
||||
}
|
||||
commentStart = prop->fTerminator;
|
||||
commentLen = (int) (def->fContentEnd - commentStart);
|
||||
|
@ -883,6 +883,8 @@ void MdOut::markTypeOut(Definition* def) {
|
||||
fprintf(fOut, "See Also");
|
||||
this->lf(2);
|
||||
break;
|
||||
case MarkType::kSet:
|
||||
break;
|
||||
case MarkType::kStdOut: {
|
||||
TextParser code(def);
|
||||
this->mdHeaderOut(4);
|
||||
|
Loading…
Reference in New Issue
Block a user