From 53498e973e52889869d0e6c4f9b186ed65d6d892 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Thu, 28 Jun 2018 19:13:56 -0400 Subject: [PATCH] fix blank catalog images Some catalog images are blank because the image wasn't selected in the fiddle example. Also continue to add documentation and examples for SkRRect R=caryclark@google.com NOTRY=true Docs-Preview: https://skia.org/?cl=138382 Bug: skia:6898 Change-Id: I282a14ffcbaf2f8383294724900960f5ba40a2aa Reviewed-on: https://skia-review.googlesource.com/138382 Reviewed-by: Cary Clark Commit-Queue: Cary Clark Auto-Submit: Cary Clark --- docs/SkBlendMode_Reference.bmh | 7 + docs/SkPath_Reference.bmh | 4 +- docs/SkRRect_Reference.bmh | 460 ++++++++++++++++++------- docs/SkRect_Reference.bmh | 2 +- site/user/api/SkBlendMode_Reference.md | 14 +- site/user/api/SkPath_Reference.md | 6 +- site/user/api/SkRRect_Reference.md | 317 +++++++++++------ site/user/api/SkRect_Reference.md | 2 +- site/user/api/catalog.htm | 137 ++++---- 9 files changed, 651 insertions(+), 298 deletions(-) diff --git a/docs/SkBlendMode_Reference.bmh b/docs/SkBlendMode_Reference.bmh index 1dbba49db3..494ff4fb30 100644 --- a/docs/SkBlendMode_Reference.bmh +++ b/docs/SkBlendMode_Reference.bmh @@ -860,6 +860,7 @@ Da as destination Alpha, Dc as destination Color component . SkBlendMode::kDarken does not make an image darker; it replaces the destination component with source if source is darker. #Example +#Image 3 canvas->drawImage(image, 0, 0); SkColor colors[] = { SK_ColorWHITE, SK_ColorBLACK }; SkPoint horz[] = { { 0, 0 }, { 256, 0 } }; @@ -885,6 +886,7 @@ Da as destination Alpha, Dc as destination Color component . SkBlendMode::kDarken does not make an image lighter; it replaces the destination component with source if source is lighter. #Example +#Image 3 canvas->drawImage(image, 0, 0); SkColor colors[] = { SK_ColorBLACK, SK_ColorWHITE }; SkPoint horz[] = { { 0, 0 }, { 256, 0 } }; @@ -1065,6 +1067,7 @@ Da as destination Alpha, Dc as destination Color component , the product of Unpremultiplied source and destination. SkBlendMode::kMultiply makes the image darker. #Example +#Image 5 canvas->drawImage(image, 0, 0); canvas->drawImage(image, 128, 0); canvas->drawImage(image, 0, 128); @@ -1094,6 +1097,7 @@ Da as destination Alpha, D as destination Color ## , source hue, leaving destination luminosity and saturation unchanged. #Example +#Image 3 canvas->drawImage(image, 0, 0); canvas->drawColor(0xFF00FF00, SkBlendMode::kHue); ## @@ -1112,6 +1116,7 @@ Da as destination Alpha, D as destination Color ## , source hue, leaving destination luminosity and saturation unchanged. #Example +#Image 3 canvas->drawImage(image, 0, 0); canvas->drawColor(0xFF00FF00, SkBlendMode::kSaturation); ## @@ -1130,6 +1135,7 @@ Da as destination Alpha, D as destination Color ## , source hue and saturation, leaving destination luminosity unchanged. #Example +#Image 3 canvas->drawImage(image, 0, 0); canvas->drawColor(0xFF00FF00, SkBlendMode::kColor); ## @@ -1148,6 +1154,7 @@ Da as destination Alpha, D as destination Color ## , source luminosity, leaving destination hue and saturation unchanged. #Example +#Image 3 canvas->drawImage(image, 0, 0); canvas->drawColor(0xFF00FF00, SkBlendMode::kLuminosity); ## diff --git a/docs/SkPath_Reference.bmh b/docs/SkPath_Reference.bmh index e0e8da2540..f82654a511 100644 --- a/docs/SkPath_Reference.bmh +++ b/docs/SkPath_Reference.bmh @@ -5044,7 +5044,7 @@ for (int y = 2; y < 256; y += 9) { #Method void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const #In Utility -#Line # sends text representation using floats to standard output ## +#Line # sends text representation to stream ## Writes text representation of Path to stream. If stream is nullptr, writes to standard output. Set forceClose to true to get edges used to fill Path. Set dumpAsHex true to generate exact binary representations @@ -5086,7 +5086,7 @@ path.close(); ## ## -#SeeAlso SkRect::dump() SkRRect::dump() SkPathMeasure::dump() +#SeeAlso dumpHex SkRect::dump() SkRRect::dump() SkPathMeasure::dump() ## diff --git a/docs/SkRRect_Reference.bmh b/docs/SkRRect_Reference.bmh index 67e61b44fa..a96237cdc5 100644 --- a/docs/SkRRect_Reference.bmh +++ b/docs/SkRRect_Reference.bmh @@ -878,7 +878,23 @@ sets to kSimple_Type. Otherwise, sets to kNinePatch_Type. #Param radii corner x-axis and y-axis radii ## #Example -// incomplete + SkPaint paint; + paint.setStrokeWidth(15); + paint.setStrokeCap(SkPaint::kSquare_Cap); + paint.setAntiAlias(true); + float intervals[] = { 5, 21.75f }; + paint.setStyle(SkPaint::kStroke_Style); + paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0)); + SkPath path; + SkRRect rrect; + SkVector corners[] = {{15, 17}, {17, 19}, {19, 15}, {15, 15}}; + rrect.setRectRadii({20, 20, 100, 100}, corners); + path.addRRect(rrect, SkPath::kCW_Direction); + canvas->drawPath(path, paint); + path.rewind(); + path.addRRect(rrect, SkPath::kCCW_Direction, 1); + canvas->translate(120, 0); + canvas->drawPath(path, paint); ## #SeeAlso setNinePatch SkPath::addRoundRect @@ -888,7 +904,7 @@ sets to kSimple_Type. Otherwise, sets to kNinePatch_Type. # ------------------------------------------------------------------------------ #Enum Corner -#Line # incomplete ## +#Line # corner radii order ## #Code enum Corner { @@ -901,74 +917,133 @@ sets to kSimple_Type. Otherwise, sets to kNinePatch_Type. The radii are stored: top-left, top-right, bottom-right, bottom-left. -#Const kUpperLeft_Corner -#Line # incomplete ## +#Const kUpperLeft_Corner 0 +#Line # index of top-left corner radii ## ## -#Const kUpperRight_Corner -#Line # incomplete ## +#Const kUpperRight_Corner 1 +#Line # index of top-right corner radii ## ## -#Const kLowerRight_Corner -#Line # incomplete ## +#Const kLowerRight_Corner 2 +#Line # index of bottom-right corner radii ## ## -#Const kLowerLeft_Corner -#Line # incomplete ## +#Const kLowerLeft_Corner 3 +#Line # index of bottom-left corner radii ## ## #Example -// incomplete +#Height 70 + SkPaint paint; + paint.setAntiAlias(true); + SkRRect rrect; + SkVector corners[] = {{25, 17}, {17, 19}, {19, 15}, {15, 15}}; + rrect.setRectRadii({30, 10, 100, 60}, corners); + canvas->drawRRect(rrect, paint); + paint.setColor(SK_ColorWHITE); + const SkRect r = rrect.getBounds(); + canvas->drawLine(r.fLeft, r.fTop + rrect.radii(SkRRect::kUpperLeft_Corner).fY, + r.fRight, r.fTop + rrect.radii(SkRRect::kUpperRight_Corner).fY, paint); + canvas->drawLine(r.fLeft, r.fBottom - rrect.radii(SkRRect::kLowerLeft_Corner).fY, + r.fRight, r.fBottom - rrect.radii(SkRRect::kLowerRight_Corner).fY, paint); + canvas->drawLine(r.fLeft + rrect.radii(SkRRect::kUpperLeft_Corner).fX, r.fTop, + r.fLeft + rrect.radii(SkRRect::kLowerLeft_Corner).fX, r.fBottom, paint); + canvas->drawLine(r.fRight - rrect.radii(SkRRect::kUpperRight_Corner).fX, r.fTop, + r.fRight - rrect.radii(SkRRect::kLowerRight_Corner).fX, r.fBottom, paint); ## -#SeeAlso incomplete +#SeeAlso radii #Enum ## # ------------------------------------------------------------------------------ #Method const SkRect& rect() const -#In incomplete -#Line # incomplete ## +#In Property +#Line # returns bounds ## +Returns bounds. Bounds may have zero width or zero height. Bounds right is +greater than or equal to left; bounds bottom is greater than or equal to top. +Result is identical to getBounds. -#Return incomplete ## +#Return bounding box ## #Example -// incomplete + for (SkScalar left : { SK_ScalarNaN, SK_ScalarInfinity, 100.f, 50.f, 25.f} ) { + SkRRect rrect1 = SkRRect::MakeRectXY({left, 20, 60, 220}, 50, 200); + SkDebugf("left bounds: (%g) %g\n", left, rrect1.rect().fLeft); + } +#StdOut +left bounds: (nan) 0 +left bounds: (inf) 0 +left bounds: (100) 60 +left bounds: (50) 50 +left bounds: (25) 25 +## ## -#SeeAlso incomplete +#SeeAlso getBounds #Method ## # ------------------------------------------------------------------------------ #Method SkVector radii(Corner corner) const -#In incomplete -#Line # incomplete ## +#In Property +#Line # returns x-axis and y-axis radii for one corner ## +Returns Scalar pair for radius of curve on x-axis and y-axis for one corner. +Both radii may be zero. If not zero, both are positive and finite. -#Param corner incomplete ## -#Return incomplete ## - -#Example -// incomplete +#Param corner one of: kUpperLeft_Corner, kUpperRight_Corner, + kLowerRight_Corner, kLowerLeft_Corner ## -#SeeAlso incomplete +#Return x-axis and y-axis radii for one corner ## + +#Example +#Description +Finite values are scaled proportionately to fit; other values are set to zero. +Scaled values cannot be larger than 25, half the bounding rect width. +Small scaled values are halved to scale in proportion to the y-axis corner +radius, which is twice the bounds height. +## + for (SkScalar radiusX : { SK_ScalarNaN, SK_ScalarInfinity, 100.f, 50.f, 25.f} ) { + SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, radiusX, 200); + SkDebugf("left corner: (%g) %g\n", radiusX, rrect1.radii(SkRRect::kUpperLeft_Corner).fX); + } +#StdOut +left corner: (nan) 0 +left corner: (inf) 0 +left corner: (100) 25 +left corner: (50) 25 +left corner: (25) 12.5 +## +## + +#SeeAlso Corner #Method ## # ------------------------------------------------------------------------------ #Method const SkRect& getBounds() const -#In incomplete -#Line # incomplete ## +#In Property +#Line # returns bounds ## +Returns bounds. Bounds may have zero width or zero height. Bounds right is +greater than or equal to left; bounds bottom is greater than or equal to top. +Result is identical to rect(). -#Return incomplete ## +#Return bounding box ## #Example -// incomplete +#Height 120 + SkPaint paint; + SkRRect rrect = SkRRect::MakeRectXY({20, 20, 220, 100}, 15, 15); + canvas->drawRRect(rrect, paint); + paint.setColor(SK_ColorWHITE); + rrect = SkRRect::MakeOval(rrect.getBounds()); + canvas->drawRRect(rrect, paint); ## -#SeeAlso incomplete +#SeeAlso rect #Method ## @@ -976,18 +1051,33 @@ The radii are stored: top-left, top-right, bottom-right, bottom-left. #Method bool operator==(const SkRRect& a, const SkRRect& b) #In Operator -#Line # incomplete ## +#Line # returns true if members are equal ## +Returns true if bounds and radii in a are equal to bounds and radii in b. -#Param a incomplete ## -#Param b incomplete ## +a and b are not equal if either contain NaN. a and b are equal if members +contain zeroes width different signs. -#Return incomplete ## +#Param a Rect bounds and radii to compare ## +#Param b Rect bounds and radii to compare ## + +#Return true if members are equal ## #Example -// incomplete + SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, 50, 200); + SkRRect rrect2 = SkRRect::MakeRectXY(rrect1.rect(), 25, 100); + SkRRect rrect3 = SkRRect::MakeOval(rrect1.rect()); + canvas->drawRRect(rrect1, SkPaint()); + std::string str = "rrect1 " + std::string(rrect1 == rrect2 ? "=" : "!") + "= rrect2"; + canvas->drawString(str.c_str(), 10, 240, SkPaint()); + canvas->translate(70, 0); + canvas->drawRRect(rrect2, SkPaint()); + canvas->translate(70, 0); + canvas->drawRRect(rrect3, SkPaint()); + str = "rrect2 " + std::string(rrect2 == rrect3 ? "=" : "!") + "= rrect3"; + canvas->drawString(str.c_str(), -20, 240, SkPaint()); ## -#SeeAlso incomplete +#SeeAlso operator!=(const SkRRect& a, const SkRRect& b) #Method ## @@ -995,26 +1085,41 @@ The radii are stored: top-left, top-right, bottom-right, bottom-left. #Method bool operator!=(const SkRRect& a, const SkRRect& b) #In Operator -#Line # incomplete ## +#Line # returns true if members are unequal ## +Returns true if bounds and radii in a are not equal to bounds and radii in b. -#Param a incomplete ## -#Param b incomplete ## +a and b are not equal if either contain NaN. a and b are equal if members +contain zeroes width different signs. -#Return incomplete ## +#Param a Rect bounds and radii to compare ## +#Param b Rect bounds and radii to compare ## + +#Return true if members are not equal ## #Example -// incomplete + SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, 50, 100); + SkRRect rrect2 = SkRRect::MakeRectXY(rrect1.rect(), 50, 50); + SkRRect rrect3 = SkRRect::MakeOval(rrect1.rect()); + canvas->drawRRect(rrect1, SkPaint()); + std::string str = "rrect1 " + std::string(rrect1 == rrect2 ? "=" : "!") + "= rrect2"; + canvas->drawString(str.c_str(), 10, 240, SkPaint()); + canvas->translate(70, 0); + canvas->drawRRect(rrect2, SkPaint()); + canvas->translate(70, 0); + canvas->drawRRect(rrect3, SkPaint()); + str = "rrect2 " + std::string(rrect2 == rrect3 ? "=" : "!") + "= rrect3"; + canvas->drawString(str.c_str(), -20, 240, SkPaint()); ## -#SeeAlso incomplete +#SeeAlso operator==(const SkRRect& a, const SkRRect& b) #Method ## # ------------------------------------------------------------------------------ #Method void inset(SkScalar dx, SkScalar dy, SkRRect* dst) const -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # insets bounds and radii ## Calls inset on the bounds, and adjust the radii to reflect what happens. If the corner is sharp (no curvature), leave it alone, @@ -1026,40 +1131,55 @@ If the inset is sufficiently negative to cause the bounds to become infinite the the result is a default initialized rrect. It is valid for dst == this. -#Param dx incomplete ## -#Param dy incomplete ## -#Param dst incomplete ## +#Param dx added to rect().fLeft, and subtracted from rect().fRight ## +#Param dy added to rect().fTop, and subtracted from rect().fBottom ## +#Param dst insets bounds and radii ## #Example -// incomplete + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100); + for (int index = 0; index < 25; ++index) { + canvas->drawRRect(rrect, paint); + rrect.inset(-3, 3, &rrect); + } ## -#SeeAlso incomplete +#SeeAlso outset offset makeOffset #Method ## # ------------------------------------------------------------------------------ #Method void inset(SkScalar dx, SkScalar dy) -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # insets bounds and radii ## -#Param dx incomplete ## -#Param dy incomplete ## +#Param dx added to rect().fLeft, and subtracted from rect().fRight ## +#Param dy added to rect().fTop, and subtracted from rect().fBottom ## #Example -// incomplete + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + SkRRect rrect = SkRRect::MakeRectXY({10, 20, 180, 220}, 50, 100); + for (int index = 0; index < 25; ++index) { + canvas->drawRRect(rrect, paint); + rrect.inset(3, 3); + } ## -#SeeAlso incomplete +#SeeAlso outset offset makeOffset + #Method ## # ------------------------------------------------------------------------------ #Method void outset(SkScalar dx, SkScalar dy, SkRRect* dst) const -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # outsets bounds and radii ## Call outset on the bounds, and adjust the radii to reflect what happens in stroking. If the corner is sharp (no curvature), leave it alone, @@ -1067,98 +1187,127 @@ otherwise we grow/shrink the radii by the amount of the inset. If a given radius becomes negative, it is pinned to 0. It is valid for dst == this. -#Param dx incomplete ## -#Param dy incomplete ## -#Param dst incomplete ## +#Param dx subtracted from rect().fLeft, and added to rect().fRight ## +#Param dy subtracted from rect().fTop, and added to rect().fBottom ## +#Param dst outset bounds and radii ## #Example -// incomplete + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100); + for (int index = 0; index < 25; ++index) { + canvas->drawRRect(rrect, paint); + rrect.outset(-3, 3, &rrect); + } ## -#SeeAlso incomplete +#SeeAlso inset offset makeOffset + #Method ## # ------------------------------------------------------------------------------ #Method void outset(SkScalar dx, SkScalar dy) -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # outsets bounds and radii ## -#Param dx incomplete ## -#Param dy incomplete ## +#Param dx subtracted from rect().fLeft, and added to rect().fRight ## +#Param dy subtracted from rect().fTop, and added to rect().fBottom ## #Example -// incomplete + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100); + for (int index = 0; index < 25; ++index) { + canvas->drawRRect(rrect, paint); + rrect.outset(3, 3); + } ## -#SeeAlso incomplete +#SeeAlso inset offset makeOffset #Method ## # ------------------------------------------------------------------------------ #Method void offset(SkScalar dx, SkScalar dy) -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # offsets bounds and radii ## -Translate the rrect by (dx, dy). +Translates the rrect by (dx, dy). -#Param dx incomplete ## -#Param dy incomplete ## +#Param dx offset added to rect().fLeft and rect().fRight ## +#Param dy offset added to rect().fTop and rect().fBottom ## #Example -// incomplete + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100); + for (int index = 0; index < 25; ++index) { + canvas->drawRRect(rrect, paint); + rrect.offset(3, 3); + } ## -#SeeAlso incomplete +#SeeAlso makeOffset inset outset #Method ## # ------------------------------------------------------------------------------ #Method SkRRect SK_WARN_UNUSED_RESULT makeOffset(SkScalar dx, SkScalar dy) const -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # offsets bounds and radii ## -#Param dx incomplete ## -#Param dy incomplete ## +#Param dx offset added to rect().fLeft and rect().fRight ## +#Param dy offset added to rect().fTop and rect().fBottom ## -#Return incomplete ## +#Return Round_Rect bounds offset by (dx, dy), with unchanged corner radii ## #Example -// incomplete + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100); + for (int index = 0; index < 25; ++index) { + canvas->drawRRect(rrect, paint); + rrect = rrect.makeOffset(-3, 3); + } ## -#SeeAlso incomplete +#SeeAlso offset inset outset #Method ## # ------------------------------------------------------------------------------ #Method bool contains(const SkRect& rect) const -#In incomplete -#Line # incomplete ## +#In Intersection +#Line # returns true if Rect is inside ## -Returns true if 'rect' is wholy inside the RR, and both -are not empty. +Returns true if rect is inside the bounds and corner radii, and if +Round_Rect and rect are not empty. -#Param rect incomplete ## +#Param rect area tested for containment ## -#Return incomplete ## +#Return true if Round_Rect contains rect ## #Example // incomplete ## -#SeeAlso incomplete +#SeeAlso SkRect::contains #Method ## # ------------------------------------------------------------------------------ #Method bool isValid() const -#In incomplete +#In Utility #Line # incomplete ## #Return incomplete ## @@ -1185,7 +1334,7 @@ are not empty. # ------------------------------------------------------------------------------ #Method size_t writeToMemory(void* buffer) const -#In incomplete +#In Utility #Line # incomplete ## Write the rrect into the specified buffer. This is guaranteed to always @@ -1207,7 +1356,7 @@ a multiple of 4. Return kSizeInMemory. # ------------------------------------------------------------------------------ #Method size_t readFromMemory(const void* buffer, size_t length) -#In incomplete +#In Utility #Line # incomplete ## Reads the rrect from the specified buffer. @@ -1234,19 +1383,19 @@ and that value is guaranteed to always be a multiple of 4. # ------------------------------------------------------------------------------ #Method bool transform(const SkMatrix& matrix, SkRRect* dst) const -#In incomplete -#Line # incomplete ## +#In Inset_Outset_Offset +#Line # scales and offsets into copy ## -Transform by the specified matrix, and put the result in dst. +Transforms by Round_Rect by matrix, storing result in dst. +Returns true if Round_Rect transformed can be represented by another Round_Rect. +Returns false if matrix contains transformations other than scale and translate. -#Param matrix SkMatrix specifying the transform. Must only contain - scale and/or translate, or this call will fail. -## -#Param dst SkRRect to store the result. It is an error to use this, - which would make this function no longer const. -## +Asserts in debug builds if Round_Rect equals dst. -#Return true on success, false on failure. +#Param matrix SkMatrix specifying the transform ## +#Param dst SkRRect to store the result ## + +#Return true if transformation succeeded. ## #Example @@ -1260,44 +1409,125 @@ Transform by the specified matrix, and put the result in dst. # ------------------------------------------------------------------------------ #Method void dump(bool asHex) const -#In incomplete -#Line # incomplete ## +#In Utility +#Line # sends text representation to standard output ## +Writes text representation of Round_Rect to standard output. +Set asHex true to generate exact binary representations +of floating point numbers. -#Param asHex incomplete ## +#Param asHex true if SkScalar values are written as hexadecimal ## #Example -// incomplete +SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3}); +for (bool dumpAsHex : { false, true } ) { + rrect.dump(dumpAsHex); +} +#StdOut +SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); +const SkPoint corners[] = { + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, +}; +SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ + SkBits2Float(0x3f2aaaab), /* 0.666667 */ + SkBits2Float(0x3f5b6db7), /* 0.857143 */ + SkBits2Float(0x3f2aaaab) /* 0.666667 */); +const SkPoint corners[] = { + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +}; +## ## -#SeeAlso incomplete +#SeeAlso dumpHex SkRect::dump SkPath::dump SkPathMeasure::dump #Method ## # ------------------------------------------------------------------------------ #Method void dump() const -#In incomplete -#Line # incomplete ## +#In Utility +#Line # sends text representation using floats to standard output ## +Writes text representation of Round_Rect to standard output. The representation +may be directly compiled as C++ code. Floating point values are written +with limited precision; it may not be possible to reconstruct original +Round_Rect from output. #Example -// incomplete +SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3}); +rrect.dump(); +SkRect bounds = SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); +const SkPoint corners[] = { + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, +}; +SkRRect copy; +copy.setRectRadii(bounds, corners); +SkDebugf("rrect is " "%s" "equal to copy\n", rrect == copy ? "" : "not "); +#StdOut +SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); +const SkPoint corners[] = { + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, +}; +rrect is not equal to copy +## ## -#SeeAlso incomplete +#SeeAlso dumpHex SkRect::dump SkPath::dump SkPathMeasure::dump #Method ## # ------------------------------------------------------------------------------ #Method void dumpHex() const -#In incomplete -#Line # incomplete ## +#In Utility +#Line # sends text representation using hexadecimal to standard output ## +Writes text representation of Round_Rect to standard output. The representation +may be directly compiled as C++ code. Floating point values are written +in hexadecimal to preserve their exact bit pattern. The output reconstructs the +original Round_Rect. #Example -// incomplete +SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3}); +rrect.dumpHex(); +SkRect bounds = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ + SkBits2Float(0x3f2aaaab), /* 0.666667 */ + SkBits2Float(0x3f5b6db7), /* 0.857143 */ + SkBits2Float(0x3f2aaaab) /* 0.666667 */); +const SkPoint corners[] = { + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +}; +SkRRect copy; +copy.setRectRadii(bounds, corners); +SkDebugf("rrect is " "%s" "equal to copy\n", rrect == copy ? "" : "not "); +#StdOut +SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ + SkBits2Float(0x3f2aaaab), /* 0.666667 */ + SkBits2Float(0x3f5b6db7), /* 0.857143 */ + SkBits2Float(0x3f2aaaab) /* 0.666667 */); +const SkPoint corners[] = { + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ + { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +}; +rrect is equal to copy +## ## -#SeeAlso incomplete +#SeeAlso dump SkRect::dumpHex SkPath::dumpHex #Method ## diff --git a/docs/SkRect_Reference.bmh b/docs/SkRect_Reference.bmh index cb0c1ed190..49eff9e873 100644 --- a/docs/SkRect_Reference.bmh +++ b/docs/SkRect_Reference.bmh @@ -1549,7 +1549,7 @@ rect: (30, 50, 40, 60) does not contain (29, 59) ## ## -#SeeAlso SkIRect::contains +#SeeAlso SkIRect::contains SkRRect::contains ## diff --git a/site/user/api/SkBlendMode_Reference.md b/site/user/api/SkBlendMode_Reference.md index d1bb465851..d860b27e55 100644 --- a/site/user/api/SkBlendMode_Reference.md +++ b/site/user/api/SkBlendMode_Reference.md @@ -823,7 +823,7 @@ component with source if source is darker. ### Example -
+
## Lighten @@ -838,7 +838,7 @@ component with source if source is lighter. ### Example -
+
## Color Dodge @@ -943,7 +943,7 @@ the product of Unpremultiplied source a ### Example -
+
## Hue @@ -957,7 +957,7 @@ source hue, leaving destination luminosity and saturation unchanged. ### Example -
+
## Saturation @@ -971,7 +971,7 @@ source hue, leaving destination luminosity and saturation unchanged. ### Example -
+
## Color @@ -985,7 +985,7 @@ source hue and saturation, leaving destination luminosity unchanged. ### Example -
+
## Luminosity @@ -999,7 +999,7 @@ source luminosity, leaving destination hue and saturation unchanged. ### Example -
+
## SkBlendMode_Name diff --git a/site/user/api/SkPath_Reference.md b/site/user/api/SkPath_Reference.md index f213448922..51210da825 100644 --- a/site/user/api/SkPath_Reference.md +++ b/site/user/api/SkPath_Reference.md @@ -524,7 +524,7 @@ SkPath member functions read and modify the structure properties. dump - sends text representation using floats to standard output + sends text representation to stream dumpHex @@ -2525,7 +2525,7 @@ rotated circle bounds = 14.6447, 9.64466, 85.3553, 80.3553 dump - sends text representation using floats to standard output + sends text representation to stream @@ -5433,7 +5433,7 @@ path.close(); ### See Also -SkRect::dump()[2] SkRRect::dump()[2] SkPathMeasure::dump() +dumpHex SkRect::dump()[2] SkRRect::dump()[2] SkPathMeasure::dump() --- diff --git a/site/user/api/SkRRect_Reference.md b/site/user/api/SkRRect_Reference.md index c72c227aca..c2f16d38ab 100644 --- a/site/user/api/SkRRect_Reference.md +++ b/site/user/api/SkRRect_Reference.md @@ -14,7 +14,7 @@ SkRRect related constants are defined by enum, enum classDescription Corner - incomplete + corner radii order Type @@ -34,11 +34,11 @@ SkRRect related constants are defined by enum, enum class kLowerLeft Corner - incomplete + index of bottom-left corner radii kLowerRight Corner - incomplete + index of bottom-right corner radii kNinePatch Type @@ -62,11 +62,11 @@ SkRRect related constants are defined by enum, enum class kUpperLeft Corner - incomplete + index of top-left corner radii kUpperRight Corner - incomplete + index of top-right corner radii @@ -157,7 +157,7 @@ SkRRect can be constructed or initialized by these functions, including C++ clas makeOffset - incomplete + offsets bounds and radii @@ -170,7 +170,7 @@ SkRRect operators inline class member functions with arithmetic equivalents. Description operator!=(const SkRRect& a, const SkRRect& b) - incomplete + returns true if members are unequal operator=(const SkRRect& rrect) @@ -178,7 +178,7 @@ SkRRect operators inline class member functions with arithmetic equivalents. operator==(const SkRRect& a, const SkRRect& b) - incomplete + returns true if members are equal @@ -207,19 +207,19 @@ SkRRect member functions read and modify the structure properties. contains - incomplete + returns true if Rect is inside dump - incomplete + sends text representation to standard output dumpHex - incomplete + sends text representation using hexadecimal to standard output getBounds - incomplete + returns bounds getSimpleRadii @@ -235,7 +235,7 @@ SkRRect member functions read and modify the structure properties. inset - incomplete + insets bounds and radii isComplex @@ -267,19 +267,19 @@ SkRRect member functions read and modify the structure properties. makeOffset - incomplete + offsets bounds and radii offset - incomplete + offsets bounds and radii outset - incomplete + outsets bounds and radii radii - incomplete + returns x-axis and y-axis radii for one corner readFromMemory @@ -287,7 +287,7 @@ SkRRect member functions read and modify the structure properties. rect - incomplete + returns bounds setEmpty @@ -315,7 +315,7 @@ SkRRect member functions read and modify the structure properties. transform - incomplete + scales and offsets into copy type @@ -1129,7 +1129,7 @@ sets to kSimple Type. Otherwise, sets to +
### See Also @@ -1158,37 +1158,37 @@ The radii are stored: top-left, top-right, bottom-right, bottom-left. Description
SkRRect::kUpperLeft_Corner - #Line # incomplete ## + 0 -incomplete +index of top-left corner radii SkRRect::kUpperRight_Corner - #Line # incomplete ## + 1 -incomplete +index of top-right corner radii SkRRect::kLowerRight_Corner - #Line # incomplete ## + 2 -incomplete +index of bottom-right corner radii SkRRect::kLowerLeft_Corner - #Line # incomplete ## + 3 -incomplete +index of bottom-left corner radii ### Example -
+
### See Also -incomplete +radii ## rect @@ -1197,17 +1197,33 @@ incomplete const SkRect& rect() const +Returns bounds. Bounds may have zero width or zero height. Bounds right is +greater than or equal to left; bounds bottom is greater than or equal to top. +Result is identical to getBounds. + ### Return Value -incomplete +bounding box ### Example -
+
+ +#### Example Output + +~~~~ +left bounds: (nan) 0 +left bounds: (inf) 0 +left bounds: (100) 60 +left bounds: (50) 50 +left bounds: (25) 25 +~~~~ + +
### See Also -incomplete +getBounds --- @@ -1218,24 +1234,44 @@ incomplete SkVector radii(Corner corner) const +Returns Scalar pair for radius of curve on x-axis and y-axis for one corner. +Both radii may be zero. If not zero, both are positive and finite. + ### Parameters - +
cornerincompleteone of: kUpperLeft Corner, kUpperRight Corner, +kLowerRight Corner, kLowerLeft Corner
### Return Value -incomplete +x-axis and y-axis radii for one corner ### Example -
+
Finite values are scaled proportionately to fit; other values are set to zero. +Scaled values cannot be larger than 25, half the bounding rect width. +Small scaled values are halved to scale in proportion to the y-axis corner +radius, which is twice the bounds height. +
+ +#### Example Output + +~~~~ +left corner: (nan) 0 +left corner: (inf) 0 +left corner: (100) 25 +left corner: (50) 25 +left corner: (25) 12.5 +~~~~ + +
### See Also -incomplete +Corner --- @@ -1246,17 +1282,21 @@ incomplete const SkRect& getBounds() const +Returns bounds. Bounds may have zero width or zero height. Bounds right is +greater than or equal to left; bounds bottom is greater than or equal to top. +Result is identical to rect. + ### Return Value -incomplete +bounding box ### Example -
+
### See Also -incomplete +rect --- @@ -1267,27 +1307,32 @@ incomplete bool operator==(const SkRRect& a, const SkRRect& b) +Returns true if bounds and radii in a are equal to bounds and radii in b. + +a and b are not equal if either contain NaN. a and b are equal if members +contain zeroes width different signs. + ### Parameters - + - +
aincompleteRect bounds and radii to compare
bincompleteRect bounds and radii to compare
### Return Value -incomplete +true if members are equal ### Example -
+
### See Also -incomplete +operator!=(const SkRRect& a, const SkRRect& b) --- @@ -1298,27 +1343,32 @@ incomplete bool operator!=(const SkRRect& a, const SkRRect& b) +Returns true if bounds and radii in a are not equal to bounds and radii in b. + +a and b are not equal if either contain NaN. a and b are equal if members +contain zeroes width different signs. + ### Parameters - + - +
aincompleteRect bounds and radii to compare
bincompleteRect bounds and radii to compare
### Return Value -incomplete +true if members are not equal ### Example -
+
### See Also -incomplete +operator==(const SkRRect& a, const SkRRect& b) --- @@ -1342,23 +1392,23 @@ It is valid for dst == this. ### Parameters - + - + - +
dxincompleteadded to rect.fLeft, and subtracted from rect.fRight
dyincompleteadded to rect.fTop, and subtracted from rect.fBottom
dstincompleteinsets bounds and radii
### Example -
+
### See Also -incomplete +outset[2] offset makeOffset --- @@ -1371,20 +1421,20 @@ void inset(SkScalar ### Parameters - + - +
dxincompleteadded to rect.fLeft, and subtracted from rect.fRight
dyincompleteadded to rect.fTop, and subtracted from rect.fBottom
### Example -
+
### See Also -incomplete +
outset[2] offset makeOffset --- @@ -1404,23 +1454,23 @@ It is valid for dst == this. ### Parameters - + - + - +
dxincompletesubtracted from rect.fLeft, and added to rect.fRight
dyincompletesubtracted from rect.fTop, and added to rect.fBottom
dstincompleteoutset bounds and radii
### Example -
+
### See Also -incomplete +inset[2] offset makeOffset --- @@ -1433,20 +1483,20 @@ void outset(SkScal ### Parameters - + - +
dxincompletesubtracted from rect.fLeft, and added to rect.fRight
dyincompletesubtracted from rect.fTop, and added to rect.fBottom
### Example -
+
### See Also -incomplete +
inset[2] offset makeOffset --- @@ -1457,25 +1507,25 @@ incomplete void offset(SkScalar dx, SkScalar dy) -Translate the rrect by (dx, dy). +Translates the rrect by (dx, dy). ### Parameters - + - +
dxincompleteoffset added to rect.fLeft and rect.fRight
dyincompleteoffset added to rect.fTop and rect.fBottom
### Example -
+
### See Also -incomplete +makeOffset inset[2] outset[2] --- @@ -1489,24 +1539,24 @@ incomplete ### Parameters - + - +
dxincompleteoffset added to rect.fLeft and rect.fRight
dyincompleteoffset added to rect.fTop and rect.fBottom
### Return Value -incomplete +Round Rect bounds offset by (dx, dy), with unchanged corner radii ### Example -
+
### See Also -incomplete +offset inset[2] outset[2] --- @@ -1517,19 +1567,19 @@ incomplete bool contains(const SkRect& rect) const -Returns true if 'rect' is wholy inside the RR, and both -are not empty. +Returns true if rect is inside the bounds and corner radii, and if +Round Rect and rect are not empty. ### Parameters - +
rectincompletearea tested for containment
### Return Value -incomplete +true if Round Rect contains rect ### Example @@ -1537,7 +1587,7 @@ incomplete ### See Also -incomplete +SkRect::contains[2][3] --- @@ -1657,25 +1707,25 @@ incomplete bool transform(const SkMatrix& matrix, SkRRect* dst) const -Transform by the specified matrix, and put the result in dst. +Transforms by Round Rect by matrix, storing result in dst. +Returns true if Round Rect transformed can be represented by another Round Rect. +Returns false if matrix contains transformations other than scale and translate. + +Asserts in debug builds if Round Rect equals dst. ### Parameters - + - +
matrixSkMatrix specifying the transform. Must only contain -scale and/or translate, or this call will fail. -SkMatrix specifying the transform
dstSkRRect to store the result. It is an error to use this, -which would make this function no longer const. -SkRRect to store the result
### Return Value -true on success, false on failure. +true if transformation succeeded. ### Example @@ -1694,20 +1744,48 @@ incomplete void dump(bool asHex) const +Writes text representation of Round Rect to standard output. +Set asHex true to generate exact binary representations +of floating point numbers. + ### Parameters - +
asHexincompletetrue if SkScalar values are written as hexadecimal
### Example -
+
+ +#### Example Output + +~~~~ +SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); +const SkPoint corners[] = { +{ 0, 0 }, +{ 0, 0 }, +{ 0, 0 }, +{ 0, 0 }, +}; +SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ +SkBits2Float(0x3f2aaaab), /* 0.666667 */ +SkBits2Float(0x3f5b6db7), /* 0.857143 */ +SkBits2Float(0x3f2aaaab) /* 0.666667 */); +const SkPoint corners[] = { +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +}; +~~~~ + +
### See Also -incomplete +dumpHex SkRect::dump[2] SkPath::dump[2] SkPathMeasure::dump --- @@ -1717,13 +1795,33 @@ incomplete void dump() const +Writes text representation of Round Rect to standard output. The representation +may be directly compiled as C++ code. Floating point values are written +with limited precision; it may not be possible to reconstruct original +Round Rect from output. + ### Example -
+
+ +#### Example Output + +~~~~ +SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); +const SkPoint corners[] = { +{ 0, 0 }, +{ 0, 0 }, +{ 0, 0 }, +{ 0, 0 }, +}; +rrect is not equal to copy +~~~~ + +
### See Also -incomplete +dumpHex SkRect::dump[2] SkPath::dump[2] SkPathMeasure::dump --- @@ -1734,13 +1832,36 @@ incomplete void dumpHex() const +Writes text representation of Round Rect to standard output. The representation +may be directly compiled as C++ code. Floating point values are written +in hexadecimal to preserve their exact bit pattern. The output reconstructs the +original Round Rect. + ### Example -
+
+ +#### Example Output + +~~~~ +SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ +SkBits2Float(0x3f2aaaab), /* 0.666667 */ +SkBits2Float(0x3f5b6db7), /* 0.857143 */ +SkBits2Float(0x3f2aaaab) /* 0.666667 */); +const SkPoint corners[] = { +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +{ SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ +}; +rrect is equal to copy +~~~~ + +
### See Also -incomplete +dump[2] SkRect::dumpHex SkPath::dumpHex --- diff --git a/site/user/api/SkRect_Reference.md b/site/user/api/SkRect_Reference.md index 02438608ca..e0402bf2f6 100644 --- a/site/user/api/SkRect_Reference.md +++ b/site/user/api/SkRect_Reference.md @@ -2531,7 +2531,7 @@ rect: (30, 50, 40, 60) does not contain (29, 59) ### See Also -SkIRect::contains[2][3][4] +SkIRect::contains[2][3][4] SkRRect::contains --- diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index 49f322a881..db6e59418c 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -2701,6 +2701,27 @@ "file": "SkPoint_Reference", "name": "SkPoint::y()", "stdout": "pt1.fY == pt1.y()\\n" + }, + "SkRRect_dump": { + "code": "void draw(SkCanvas* canvas) {\n SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3});\n for (bool dumpAsHex : { false, true } ) {\n rrect.dump(dumpAsHex);\n }\n}", + "hash": "265b8d23288dc8026ff788e809360af7", + "file": "SkRRect_Reference", + "name": "SkRRect::dump()", + "stdout": "SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f);\\nconst SkPoint corners[] = {\\n { 0, 0 },\\n { 0, 0 },\\n { 0, 0 },\\n { 0, 0 },\\n};\\nSkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */\\n SkBits2Float(0x3f2aaaab), /* 0.666667 */\\n SkBits2Float(0x3f5b6db7), /* 0.857143 */\\n SkBits2Float(0x3f2aaaab) /* 0.666667 */);\\nconst SkPoint corners[] = {\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n};\\n" + }, + "SkRRect_dumpHex": { + "code": "void draw(SkCanvas* canvas) {\n SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3});\n rrect.dumpHex();\n SkRect bounds = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */\n SkBits2Float(0x3f2aaaab), /* 0.666667 */\n SkBits2Float(0x3f5b6db7), /* 0.857143 */\n SkBits2Float(0x3f2aaaab) /* 0.666667 */);\n const SkPoint corners[] = {\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\n };\n SkRRect copy;\n copy.setRectRadii(bounds, corners);\n SkDebugf(\"rrect is \" \"%s\" \"equal to copy\\n\", rrect == copy ? \"\" : \"not \");\n}", + "hash": "c73f5e2644d949b859f05bd367883454", + "file": "SkRRect_Reference", + "name": "SkRRect::dumpHex", + "stdout": "SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */\\n SkBits2Float(0x3f2aaaab), /* 0.666667 */\\n SkBits2Float(0x3f5b6db7), /* 0.857143 */\\n SkBits2Float(0x3f2aaaab) /* 0.666667 */);\\nconst SkPoint corners[] = {\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */\\n};\\nrrect is equal to copy\\n" + }, + "SkRRect_dump_2": { + "code": "void draw(SkCanvas* canvas) {\n SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3});\n rrect.dump();\n SkRect bounds = SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f);\n const SkPoint corners[] = {\n { 0, 0 },\n { 0, 0 },\n { 0, 0 },\n { 0, 0 },\n };\n SkRRect copy;\n copy.setRectRadii(bounds, corners);\n SkDebugf(\"rrect is \" \"%s\" \"equal to copy\\n\", rrect == copy ? \"\" : \"not \");\n}", + "hash": "f850423c7c0c4f803d479ecd92221059", + "file": "SkRRect_Reference", + "name": "SkRRect::dump_2", + "stdout": "SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f);\\nconst SkPoint corners[] = {\\n { 0, 0 },\\n { 0, 0 },\\n { 0, 0 },\\n { 0, 0 },\\n};\\nrrect is not equal to copy\\n" }, "SkRRect_height": { "code": "void draw(SkCanvas* canvas) {\n SkRRect unsorted = SkRRect::MakeRect({ 15, 25, 10, 20 });\n SkDebugf(\"unsorted height: %g\\n\", unsorted.height());\n SkRRect large = SkRRect::MakeRect({ 1, -FLT_MAX, 2, FLT_MAX });\n SkDebugf(\"large height: %.0f\\n\", large.height());\n}", @@ -2708,6 +2729,20 @@ "file": "SkRRect_Reference", "name": "SkRRect::height()", "stdout": "unsorted height: 5\\nlarge height: inf\\n" + }, + "SkRRect_radii": { + "code": "void draw(SkCanvas* canvas) {\n for (SkScalar radiusX : { SK_ScalarNaN, SK_ScalarInfinity, 100.f, 50.f, 25.f} ) {\n SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, radiusX, 200);\n SkDebugf(\"left corner: (%g) %g\\n\", radiusX, rrect1.radii(SkRRect::kUpperLeft_Corner).fX);\n }\n}", + "hash": "8d5c88478528584913867ada423e0d59", + "file": "SkRRect_Reference", + "name": "SkRRect::radii()", + "stdout": "left corner: (nan) 0\\nleft corner: (inf) 0\\nleft corner: (100) 25\\nleft corner: (50) 25\\nleft corner: (25) 12.5\\n" + }, + "SkRRect_rect": { + "code": "void draw(SkCanvas* canvas) {\n for (SkScalar left : { SK_ScalarNaN, SK_ScalarInfinity, 100.f, 50.f, 25.f} ) {\n SkRRect rrect1 = SkRRect::MakeRectXY({left, 20, 60, 220}, 50, 200);\n SkDebugf(\"left bounds: (%g) %g\\n\", left, rrect1.rect().fLeft);\n }\n}", + "hash": "6831adf4c536047f4709c686feb10c48", + "file": "SkRRect_Reference", + "name": "SkRRect::rect()", + "stdout": "left bounds: (nan) 0\\nleft bounds: (inf) 0\\nleft bounds: (100) 60\\nleft bounds: (50) 50\\nleft bounds: (25) 25\\n" }, "SkRRect_width": { "code": "void draw(SkCanvas* canvas) {\n SkRRect unsorted = SkRRect::MakeRect({ 15, 25, 10, 5 });\n SkDebugf(\"unsorted width: %g\\n\", unsorted.width());\n SkRRect large = SkRRect::MakeRect({ -FLT_MAX, 1, FLT_MAX, 2 });\n SkDebugf(\"large width: %.0f\\n\", large.width());\n}", @@ -3297,7 +3332,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n canvas->drawColor(0xFF00FF00, SkBlendMode::kColor);\n}", "width": 256, "height": 256, - "hash": "953eb53ac00e22d098c1a1290379282e", + "hash": "5d7c6e23a34ca9bf3ba8cda4cdc94cc4", "file": "SkBlendMode_Reference", "name": "Color" }, @@ -3321,7 +3356,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n SkColor colors[] = { SK_ColorWHITE, SK_ColorBLACK };\n SkPoint horz[] = { { 0, 0 }, { 256, 0 } };\n SkPaint paint;\n paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),\n SkShader::kClamp_TileMode));\n paint.setBlendMode(SkBlendMode::kDarken);\n canvas->drawPaint(paint);\n}", "width": 256, "height": 256, - "hash": "8c5065ba642f815602000f6b53cefc48", + "hash": "23c974d2759f523ca2f4a78ae86855c3", "file": "SkBlendMode_Reference", "name": "Darken" }, @@ -3393,7 +3428,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n canvas->drawColor(0xFF00FF00, SkBlendMode::kHue);\n}", "width": 256, "height": 256, - "hash": "ade7ea4d06775cb252a1d15c7a8112d3", + "hash": "41e45570d682397d3b8ff2f51bd9c574", "file": "SkBlendMode_Reference", "name": "Hue" }, @@ -3401,7 +3436,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n SkColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };\n SkPoint horz[] = { { 0, 0 }, { 256, 0 } };\n SkPaint paint;\n paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),\n SkShader::kClamp_TileMode));\n paint.setBlendMode(SkBlendMode::kLighten);\n canvas->drawPaint(paint);\n}", "width": 256, "height": 256, - "hash": "bbbe1a7b2587e76f9b2c7996b188a054", + "hash": "95cb08b8c8db3af3b2c9ad56ae7d6bc1", "file": "SkBlendMode_Reference", "name": "Lighten" }, @@ -3409,7 +3444,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n canvas->drawColor(0xFF00FF00, SkBlendMode::kLuminosity);\n}", "width": 256, "height": 256, - "hash": "7161fa58aa064ee229ae346cb2e165c4", + "hash": "7d42fe34ae20dd9e12c39dc3950e9989", "file": "SkBlendMode_Reference", "name": "Luminosity" }, @@ -3425,7 +3460,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n canvas->drawImage(image, 128, 0);\n canvas->drawImage(image, 0, 128);\n canvas->drawImage(image, 128, 128);\n SkPaint paint;\n paint.setBlendMode(SkBlendMode::kDstATop);\n SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };\n SkPoint vert[] = { { 0, 0 }, { 0, 256 } };\n paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),\n SkShader::kClamp_TileMode));\n canvas->drawPaint(paint);\n canvas->clipRect( { 30, 30, 226, 226 } );\n canvas->drawColor(0x80bb9977, SkBlendMode::kMultiply);\n}", "width": 256, "height": 256, - "hash": "145418271d58afc4070e7df42095c750", + "hash": "eb29c896f008dfbef09e16b85114fc3a", "file": "SkBlendMode_Reference", "name": "Multiply" }, @@ -3449,7 +3484,7 @@ "code": "void draw(SkCanvas* canvas) {\n canvas->drawImage(image, 0, 0);\n canvas->drawColor(0xFF00FF00, SkBlendMode::kSaturation);\n}", "width": 256, "height": 256, - "hash": "4a99f5f6738b18afd92a4cb2bd762bf0", + "hash": "a48698975d236573cef512f94a7e360b", "file": "SkBlendMode_Reference", "name": "Saturation" }, @@ -7566,10 +7601,10 @@ "name": "SkRGBToHSV" }, "SkRRect_Corner": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n SkRRect rrect;\n SkVector corners[] = {{25, 17}, {17, 19}, {19, 15}, {15, 15}};\n rrect.setRectRadii({30, 10, 100, 60}, corners);\n canvas->drawRRect(rrect, paint);\n paint.setColor(SK_ColorWHITE);\n const SkRect r = rrect.getBounds();\n canvas->drawLine(r.fLeft, r.fTop + rrect.radii(SkRRect::kUpperLeft_Corner).fY,\n r.fRight, r.fTop + rrect.radii(SkRRect::kUpperRight_Corner).fY, paint);\n canvas->drawLine(r.fLeft, r.fBottom - rrect.radii(SkRRect::kLowerLeft_Corner).fY,\n r.fRight, r.fBottom - rrect.radii(SkRRect::kLowerRight_Corner).fY, paint);\n canvas->drawLine(r.fLeft + rrect.radii(SkRRect::kUpperLeft_Corner).fX, r.fTop,\n r.fLeft + rrect.radii(SkRRect::kLowerLeft_Corner).fX, r.fBottom, paint);\n canvas->drawLine(r.fRight - rrect.radii(SkRRect::kUpperRight_Corner).fX, r.fTop,\n r.fRight - rrect.radii(SkRRect::kLowerRight_Corner).fX, r.fBottom, paint);\n}", "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "height": 70, + "hash": "9205393f30b156e1507e88aa27f1dd91", "file": "SkRRect_Reference", "name": "SkRRect::Corner" }, @@ -7636,30 +7671,6 @@ "hash": "94c298c404fff922ec53a3d7567852a2", "file": "SkRRect_Reference", "name": "SkRRect::operator=(const SkRRect& rrect)" -}, - "SkRRect_dump": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", - "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", - "file": "SkRRect_Reference", - "name": "SkRRect::dump()" -}, - "SkRRect_dumpHex": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", - "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", - "file": "SkRRect_Reference", - "name": "SkRRect::dumpHex" -}, - "SkRRect_dump_2": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", - "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", - "file": "SkRRect_Reference", - "name": "SkRRect::dump_2" }, "SkRRect_empty_constructor": { "code": "void draw(SkCanvas* canvas) {\n SkRRect rrect;\n SkPaint p;\n p.setStyle(SkPaint::kStroke_Style);\n p.setStrokeWidth(10);\n canvas->drawRRect(rrect, p);\n rrect.setRect({10, 10, 100, 50});\n canvas->drawRRect(rrect, p);\n}", @@ -7670,18 +7681,18 @@ "name": "SkRRect::SkRRect()" }, "SkRRect_equal_operator": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, 50, 200);\n SkRRect rrect2 = SkRRect::MakeRectXY(rrect1.rect(), 25, 100);\n SkRRect rrect3 = SkRRect::MakeOval(rrect1.rect());\n canvas->drawRRect(rrect1, SkPaint());\n std::string str = \"rrect1 \" + std::string(rrect1 == rrect2 ? \"=\" : \"!\") + \"= rrect2\";\n canvas->drawString(str.c_str(), 10, 240, SkPaint());\n canvas->translate(70, 0);\n canvas->drawRRect(rrect2, SkPaint());\n canvas->translate(70, 0);\n canvas->drawRRect(rrect3, SkPaint());\n str = \"rrect2 \" + std::string(rrect2 == rrect3 ? \"=\" : \"!\") + \"= rrect3\";\n canvas->drawString(str.c_str(), -20, 240, SkPaint());\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "df181af37f1d2b06f0f45af73df7b47d", "file": "SkRRect_Reference", "name": "SkRRect::operator==(const SkRRect& a, const SkRRect& b)" }, "SkRRect_getBounds": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkRRect rrect = SkRRect::MakeRectXY({20, 20, 220, 100}, 15, 15);\n canvas->drawRRect(rrect, paint);\n paint.setColor(SK_ColorWHITE);\n rrect = SkRRect::MakeOval(rrect.getBounds());\n canvas->drawRRect(rrect, paint);\n}", "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "height": 120, + "hash": "4577e2dcb086b241bb43d8b89ee0b0dd", "file": "SkRRect_Reference", "name": "SkRRect::getBounds" }, @@ -7702,18 +7713,18 @@ "name": "SkRRect::getType" }, "SkRRect_inset": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);\n for (int index = 0; index < 25; ++index) {\n canvas->drawRRect(rrect, paint);\n rrect.inset(-3, 3, &rrect);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "f02f0110d5605dac6d14dcb8d1d8cb6e", "file": "SkRRect_Reference", "name": "SkRRect::inset()" }, "SkRRect_inset_2": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n SkRRect rrect = SkRRect::MakeRectXY({10, 20, 180, 220}, 50, 100);\n for (int index = 0; index < 25; ++index) {\n canvas->drawRRect(rrect, paint);\n rrect.inset(3, 3);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "da61054322550a2d5ac15114da23bd23", "file": "SkRRect_Reference", "name": "SkRRect::inset_2" }, @@ -7782,52 +7793,44 @@ "name": "SkRRect::kSizeInMemory" }, "SkRRect_makeOffset": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);\n for (int index = 0; index < 25; ++index) {\n canvas->drawRRect(rrect, paint);\n rrect = rrect.makeOffset(-3, 3);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "c433aa41eaf5e419e3349fb970a08151", "file": "SkRRect_Reference", "name": "SkRRect::makeOffset" }, "SkRRect_notequal_operator": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, 50, 100);\n SkRRect rrect2 = SkRRect::MakeRectXY(rrect1.rect(), 50, 50);\n SkRRect rrect3 = SkRRect::MakeOval(rrect1.rect());\n canvas->drawRRect(rrect1, SkPaint());\n std::string str = \"rrect1 \" + std::string(rrect1 == rrect2 ? \"=\" : \"!\") + \"= rrect2\";\n canvas->drawString(str.c_str(), 10, 240, SkPaint());\n canvas->translate(70, 0);\n canvas->drawRRect(rrect2, SkPaint());\n canvas->translate(70, 0);\n canvas->drawRRect(rrect3, SkPaint());\n str = \"rrect2 \" + std::string(rrect2 == rrect3 ? \"=\" : \"!\") + \"= rrect3\";\n canvas->drawString(str.c_str(), -20, 240, SkPaint());\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "505e47b3e6474ebdecdc04c3c2af2c34", "file": "SkRRect_Reference", "name": "SkRRect::operator!=(const SkRRect& a, const SkRRect& b)" }, "SkRRect_offset": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);\n for (int index = 0; index < 25; ++index) {\n canvas->drawRRect(rrect, paint);\n rrect.offset(3, 3);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "a45cdd46ef2fe0df62d84d41713e82e2", "file": "SkRRect_Reference", "name": "SkRRect::offset()" }, "SkRRect_outset": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);\n for (int index = 0; index < 25; ++index) {\n canvas->drawRRect(rrect, paint);\n rrect.outset(-3, 3, &rrect);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "4d69b6d9c7726c47c42827d79fc7899c", "file": "SkRRect_Reference", "name": "SkRRect::outset()" }, "SkRRect_outset_2": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setStyle(SkPaint::kStroke_Style);\n SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);\n for (int index = 0; index < 25; ++index) {\n canvas->drawRRect(rrect, paint);\n rrect.outset(3, 3);\n }\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "4391cced86653dcd0f84439a5c0bb3f2", "file": "SkRRect_Reference", "name": "SkRRect::outset_2" -}, - "SkRRect_radii": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", - "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", - "file": "SkRRect_Reference", - "name": "SkRRect::radii()" }, "SkRRect_readFromMemory": { "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", @@ -7836,14 +7839,6 @@ "hash": "882e8e0103048009a25cfc20400492f7", "file": "SkRRect_Reference", "name": "SkRRect::readFromMemory" -}, - "SkRRect_rect": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", - "width": 256, - "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", - "file": "SkRRect_Reference", - "name": "SkRRect::rect()" }, "SkRRect_setEmpty": { "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});\n canvas->drawRRect(rrect, paint);\n rrect.setEmpty();\n paint.setColor(SK_ColorBLUE);\n canvas->drawRRect(rrect, paint);\n}", @@ -7878,10 +7873,10 @@ "name": "SkRRect::setRect" }, "SkRRect_setRectRadii": { - "code": "void draw(SkCanvas* canvas) {\n // incomplete\n}", + "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setStrokeWidth(15);\n paint.setStrokeCap(SkPaint::kSquare_Cap);\n paint.setAntiAlias(true);\n float intervals[] = { 5, 21.75f };\n paint.setStyle(SkPaint::kStroke_Style);\n paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));\n SkPath path;\n SkRRect rrect;\n SkVector corners[] = {{15, 17}, {17, 19}, {19, 15}, {15, 15}};\n rrect.setRectRadii({20, 20, 100, 100}, corners);\n path.addRRect(rrect, SkPath::kCW_Direction);\n canvas->drawPath(path, paint);\n path.rewind();\n path.addRRect(rrect, SkPath::kCCW_Direction, 1);\n canvas->translate(120, 0);\n canvas->drawPath(path, paint);\n}", "width": 256, "height": 256, - "hash": "882e8e0103048009a25cfc20400492f7", + "hash": "4589dd49da291f8cd414db96c12851c7", "file": "SkRRect_Reference", "name": "SkRRect::setRectRadii" },