From 0c5f54663b3080819825bd035979a82d4c5ac902 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Fri, 15 Dec 2017 11:21:51 -0500 Subject: working on image docs some new image work turn dos into unix linefeeds add SkBitmap::pixmap() Docs-Preview: https://skia.org/?cl=83863 TBR=caryclark@google.com Bug: skia:6898 Change-Id: I06242b4b66464814b753fe37f930baf32f79323a Reviewed-on: https://skia-review.googlesource.com/83863 Reviewed-by: Cary Clark Commit-Queue: Cary Clark --- docs/SkIPoint_Reference.bmh | 210 ++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 105 deletions(-) (limited to 'docs/SkIPoint_Reference.bmh') diff --git a/docs/SkIPoint_Reference.bmh b/docs/SkIPoint_Reference.bmh index 178a14f2c3..ed37167a12 100644 --- a/docs/SkIPoint_Reference.bmh +++ b/docs/SkIPoint_Reference.bmh @@ -129,10 +129,10 @@ Returns true if fX and fY are both zero. #Return true if fX is zero and fY is zero ## #Example -SkIPoint pt = { 0, -0}; +SkIPoint pt = { 0, -0}; SkDebugf("pt.isZero() == %s\n", pt.isZero() ? "true" : "false"); #StdOut -pt.isZero() == true +pt.isZero() == true ## ## @@ -171,17 +171,17 @@ Returns IPoint changing the signs of fX and fY. #Return IPoint as (-fX, -fY) ## #Example -SkIPoint test[] = { {0, -0}, {-1, -2}, - { SK_MaxS32, SK_MinS32 }, - { SK_NaN32, -SK_NaN32 } }; -for (const SkIPoint& pt : test) { - SkIPoint negPt = -pt; - SkDebugf("pt: %d, %d negate: %d, %d\n", pt.fX, pt.fY, negPt.fX, negPt.fY); +SkIPoint test[] = { {0, -0}, {-1, -2}, + { SK_MaxS32, SK_MinS32 }, + { SK_NaN32, -SK_NaN32 } }; +for (const SkIPoint& pt : test) { + SkIPoint negPt = -pt; + SkDebugf("pt: %d, %d negate: %d, %d\n", pt.fX, pt.fY, negPt.fX, negPt.fY); } #StdOut -pt: 0, 0 negate: 0, 0 -pt: -1, -2 negate: 1, 2 -pt: 2147483647, -2147483647 negate: -2147483647, 2147483647 +pt: 0, 0 negate: 0, 0 +pt: -1, -2 negate: 1, 2 +pt: 2147483647, -2147483647 negate: -2147483647, 2147483647 pt: -2147483648, -2147483648 negate: -2147483648, -2147483648 ## ## @@ -204,24 +204,24 @@ Offsets IPoint by IVector v. Sets IPoint to #Example #Height 64 - auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { - for (size_t i = 0; i < count - 1; ++i) { - SkPoint p0, p1; - p0.iset(pts[i]); - p1.iset(pts[i + 1]); - canvas->drawLine(p0, p1, paint); - } - }; - SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; - SkPaint paint; - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kStroke_Style); - canvas->scale(30, 15); - draw_lines(points, SK_ARRAY_COUNT(points), paint); - points[1] += {1, 1}; - points[2] += {-1, -1}; - paint.setColor(SK_ColorRED); - draw_lines(points, SK_ARRAY_COUNT(points), paint); + auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { + for (size_t i = 0; i < count - 1; ++i) { + SkPoint p0, p1; + p0.iset(pts[i]); + p1.iset(pts[i + 1]); + canvas->drawLine(p0, p1, paint); + } + }; + SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + canvas->scale(30, 15); + draw_lines(points, SK_ARRAY_COUNT(points), paint); + points[1] += {1, 1}; + points[2] += {-1, -1}; + paint.setColor(SK_ColorRED); + draw_lines(points, SK_ARRAY_COUNT(points), paint); ## #SeeAlso operator+(const SkIPoint& a, const SkIVector& b) SkPoint::operator+=(const SkVector& v) @@ -242,24 +242,24 @@ Subtracts IVector v from IPoint. Sets IPoint to: #Example #Height 64 - auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { - for (size_t i = 0; i < count - 1; ++i) { - SkPoint p0, p1; - p0.iset(pts[i]); - p1.iset(pts[i + 1]); - canvas->drawLine(p0, p1, paint); - } - }; - SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; - SkPaint paint; - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kStroke_Style); - canvas->scale(30, 15); - draw_lines(points, SK_ARRAY_COUNT(points), paint); - points[1] -= {1, 1}; - points[2] -= {-1, -1}; - paint.setColor(SK_ColorRED); - draw_lines(points, SK_ARRAY_COUNT(points), paint); + auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { + for (size_t i = 0; i < count - 1; ++i) { + SkPoint p0, p1; + p0.iset(pts[i]); + p1.iset(pts[i + 1]); + canvas->drawLine(p0, p1, paint); + } + }; + SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + canvas->scale(30, 15); + draw_lines(points, SK_ARRAY_COUNT(points), paint); + points[1] -= {1, 1}; + points[2] -= {-1, -1}; + paint.setColor(SK_ColorRED); + draw_lines(points, SK_ARRAY_COUNT(points), paint); ## #SeeAlso operator-(const SkIPoint& a, const SkIPoint& b) SkPoint::operator-=(const SkVector& v) @@ -278,14 +278,14 @@ Returns true if IPoint is equivalent to IPoint constructed from (x, y). #Return true if IPoint equals (x, y) ## #Example -SkIPoint test[] = { {0, -0}, {-1, -2}, {SK_MaxS32, -1}, {SK_NaN32, -1} }; -for (const SkIPoint& pt : test) { - SkDebugf("pt: %d, %d %c= pt\n", pt.fX, pt.fY, pt.equals(pt.fX, pt.fY) ? '=' : '!'); +SkIPoint test[] = { {0, -0}, {-1, -2}, {SK_MaxS32, -1}, {SK_NaN32, -1} }; +for (const SkIPoint& pt : test) { + SkDebugf("pt: %d, %d %c= pt\n", pt.fX, pt.fY, pt.equals(pt.fX, pt.fY) ? '=' : '!'); } #StdOut -pt: 0, 0 == pt -pt: -1, -2 == pt -pt: 2147483647, -1 == pt +pt: 0, 0 == pt +pt: -1, -2 == pt +pt: 2147483647, -1 == pt pt: -2147483648, -1 == pt ## ## @@ -306,14 +306,14 @@ Returns true if a is equivalent to b. #Return true if a.fX == b.fX and a.fY == b.fY ## #Example -SkIPoint test[] = { {0, -0}, {-1, -2}, {SK_MaxS32, -1}, {SK_NaN32, -1} }; -for (const SkIPoint& pt : test) { - SkDebugf("pt: %d, %d %c= pt\n", pt.fX, pt.fY, pt == pt ? '=' : '!'); +SkIPoint test[] = { {0, -0}, {-1, -2}, {SK_MaxS32, -1}, {SK_NaN32, -1} }; +for (const SkIPoint& pt : test) { + SkDebugf("pt: %d, %d %c= pt\n", pt.fX, pt.fY, pt == pt ? '=' : '!'); } #StdOut -pt: 0, 0 == pt -pt: -1, -2 == pt -pt: 2147483647, -1 == pt +pt: 0, 0 == pt +pt: -1, -2 == pt +pt: 2147483647, -1 == pt pt: -2147483648, -1 == pt ## ## @@ -334,14 +334,14 @@ Returns true if a is not equivalent to b. #Return true if a.fX != b.fX or a.fY != b.fY ## #Example -SkIPoint test[] = { {0, -0}, {-1, -2}, {SK_MaxS32, -1}, {SK_NaN32, -1} }; -for (const SkIPoint& pt : test) { - SkDebugf("pt: %d, %d %c= pt\n", pt.fX, pt.fY, pt != pt ? '!' : '='); +SkIPoint test[] = { {0, -0}, {-1, -2}, {SK_MaxS32, -1}, {SK_NaN32, -1} }; +for (const SkIPoint& pt : test) { + SkDebugf("pt: %d, %d %c= pt\n", pt.fX, pt.fY, pt != pt ? '!' : '='); } #StdOut -pt: 0, 0 == pt -pt: -1, -2 == pt -pt: 2147483647, -1 == pt +pt: 0, 0 == pt +pt: -1, -2 == pt +pt: 2147483647, -1 == pt pt: -2147483648, -1 == pt ## ## @@ -369,24 +369,24 @@ Can also be used to subtract IVector from IVector, returning IVector. #Example #Height 64 - auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { - for (size_t i = 0; i < count - 1; ++i) { - SkPoint p0, p1; - p0.iset(pts[i]); - p1.iset(pts[i + 1]); - canvas->drawLine(p0, p1, paint); - } - }; - SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; - SkPaint paint; - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kStroke_Style); - canvas->scale(30, 15); - draw_lines(points, SK_ARRAY_COUNT(points), paint); - points[1] += points[0] - points[3]; - points[2] -= points[1] - points[0]; - paint.setColor(SK_ColorRED); - draw_lines(points, SK_ARRAY_COUNT(points), paint); + auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { + for (size_t i = 0; i < count - 1; ++i) { + SkPoint p0, p1; + p0.iset(pts[i]); + p1.iset(pts[i + 1]); + canvas->drawLine(p0, p1, paint); + } + }; + SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + canvas->scale(30, 15); + draw_lines(points, SK_ARRAY_COUNT(points), paint); + points[1] += points[0] - points[3]; + points[2] -= points[1] - points[0]; + paint.setColor(SK_ColorRED); + draw_lines(points, SK_ARRAY_COUNT(points), paint); ## #SeeAlso operator-=(const SkIVector& v) @@ -413,28 +413,28 @@ Can also be used to add IVector to IVector, returning IVector. #Example #Height 128 - auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { - for (size_t i = 0; i < count - 1; ++i) { - SkPoint p0, p1; - p0.iset(pts[i]); - p1.iset(pts[i + 1]); - canvas->drawLine(p0, p1, paint); - } - }; - SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; - SkPaint paint; - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kStroke_Style); - canvas->scale(30, 15); - draw_lines(points, SK_ARRAY_COUNT(points), paint); - SkIPoint mod = {4, 1}; - for (auto& point : points) { - point = point + mod; - mod.fX -= 1; - mod.fY += 1; - } - paint.setColor(SK_ColorRED); - draw_lines(points, SK_ARRAY_COUNT(points), paint); + auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void { + for (size_t i = 0; i < count - 1; ++i) { + SkPoint p0, p1; + p0.iset(pts[i]); + p1.iset(pts[i + 1]); + canvas->drawLine(p0, p1, paint); + } + }; + SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } }; + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + canvas->scale(30, 15); + draw_lines(points, SK_ARRAY_COUNT(points), paint); + SkIPoint mod = {4, 1}; + for (auto& point : points) { + point = point + mod; + mod.fX -= 1; + mod.fY += 1; + } + paint.setColor(SK_ColorRED); + draw_lines(points, SK_ARRAY_COUNT(points), paint); ## #SeeAlso operator+=(const SkIVector& v) -- cgit v1.2.3