2017-11-27 15:44:06 +00:00
|
|
|
#Topic IPoint
|
2018-05-30 13:21:49 +00:00
|
|
|
#Alias IPoints ##
|
|
|
|
#Alias IPoint_Reference ##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Struct SkIPoint
|
|
|
|
|
2018-05-16 11:07:07 +00:00
|
|
|
SkIPoint holds two 32-bit integer coordinates.
|
|
|
|
|
|
|
|
#Subtopic Overview
|
|
|
|
#Populate
|
|
|
|
##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Related_Function
|
2018-02-01 14:37:32 +00:00
|
|
|
#Populate
|
|
|
|
##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Member_Function
|
2018-02-01 14:37:32 +00:00
|
|
|
#Populate
|
|
|
|
##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Member
|
2018-02-01 14:37:32 +00:00
|
|
|
#Populate
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Member int32_t fX
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # x-axis value ##
|
2017-11-27 15:44:06 +00:00
|
|
|
x-axis value used by IPoint.
|
|
|
|
##
|
|
|
|
|
|
|
|
#Member int32_t fY
|
2018-02-01 14:37:32 +00:00
|
|
|
#Line # y-axis value ##
|
2017-11-27 15:44:06 +00:00
|
|
|
y-axis value used by IPoint.
|
|
|
|
##
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Member ##
|
2018-02-01 14:37:32 +00:00
|
|
|
|
2017-11-27 15:44:06 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Constructor
|
|
|
|
#Populate
|
|
|
|
##
|
|
|
|
|
2017-11-27 15:44:06 +00:00
|
|
|
#Method static constexpr SkIPoint Make(int32_t x, int32_t y)
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Constructor
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # constructs from integer inputs ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Sets fX to x, fY to y.
|
|
|
|
|
|
|
|
#Param x integer x-axis value of constructed IPoint ##
|
|
|
|
#Param y integer y-axis value of constructed IPoint ##
|
|
|
|
|
|
|
|
#Return IPoint (x, y) ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
SkIPoint pt1 = {45, 66};
|
|
|
|
SkIPoint pt2 = SkIPoint::Make(45, 66);
|
|
|
|
SkDebugf("pt1 %c= pt2\n", pt1 == pt2 ? '=' : '!');
|
|
|
|
#StdOut
|
|
|
|
pt1 == pt2
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
2018-04-04 19:39:46 +00:00
|
|
|
#SeeAlso set() SkPoint::iset() SkPoint::Make
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Property
|
|
|
|
#Line # member values ##
|
|
|
|
#Populate
|
|
|
|
##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Method int32_t x() const
|
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns fX ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns x-axis value of IPoint.
|
|
|
|
|
|
|
|
#Return fX ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
SkIPoint pt1 = {45, 66};
|
|
|
|
SkDebugf("pt1.fX %c= pt1.x()\n", pt1.fX == pt1.x() ? '=' : '!');
|
|
|
|
#StdOut
|
|
|
|
pt1.fX == pt1.x()
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
2018-04-04 19:39:46 +00:00
|
|
|
#SeeAlso y() SkPoint::x()
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method int32_t y() const
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns fY ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns y-axis value of IPoint.
|
|
|
|
|
|
|
|
#Return fY ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
SkIPoint pt1 = {45, 66};
|
|
|
|
SkDebugf("pt1.fY %c= pt1.y()\n", pt1.fY == pt1.y() ? '=' : '!');
|
|
|
|
#StdOut
|
|
|
|
pt1.fY == pt1.y()
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
2018-04-04 19:39:46 +00:00
|
|
|
#SeeAlso x() SkPoint::y()
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool isZero() const
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Property
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if both members equal zero ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns true if fX and fY are both zero.
|
|
|
|
|
|
|
|
#Return true if fX is zero and fY is zero ##
|
|
|
|
|
|
|
|
#Example
|
2017-12-15 16:21:51 +00:00
|
|
|
SkIPoint pt = { 0, -0};
|
2017-11-27 15:44:06 +00:00
|
|
|
SkDebugf("pt.isZero() == %s\n", pt.isZero() ? "true" : "false");
|
|
|
|
#StdOut
|
2017-12-15 16:21:51 +00:00
|
|
|
pt.isZero() == true
|
2017-11-27 15:44:06 +00:00
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso SkPoint::isZero
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Set
|
|
|
|
#Populate
|
|
|
|
#Line # replaces all values ##
|
|
|
|
##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
2018-02-06 14:41:53 +00:00
|
|
|
#Method void set(int32_t x, int32_t y)
|
|
|
|
#In Set
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # sets to integer input ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Sets fX to x and fY to y.
|
|
|
|
|
|
|
|
#Param x new value for fX ##
|
|
|
|
#Param y new value for fY ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
SkIPoint pt1, pt2 = { SK_MinS32, SK_MaxS32 };
|
|
|
|
pt1.set(SK_MinS32, SK_MaxS32);
|
|
|
|
SkDebugf("pt1 %c= pt2\n", pt1 == pt2 ? '=' : '!');
|
|
|
|
#StdOut
|
|
|
|
pt1 == pt2
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
2018-04-04 19:39:46 +00:00
|
|
|
#SeeAlso Make
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2018-02-06 14:41:53 +00:00
|
|
|
#Subtopic Operator
|
|
|
|
#Populate
|
|
|
|
##
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Method SkIPoint operator-()_const
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # reverses sign of IPoint ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns IPoint changing the signs of fX and fY.
|
|
|
|
|
|
|
|
#Return IPoint as (-fX, -fY) ##
|
|
|
|
|
|
|
|
#Example
|
2017-12-15 16:21:51 +00:00
|
|
|
SkIPoint test[] = { {0, -0}, {-1, -2},
|
|
|
|
{ SK_MaxS32, SK_MinS32 },
|
2018-03-16 15:34:15 +00:00
|
|
|
{ SK_NaN32, SK_NaN32 } };
|
2017-12-15 16:21:51 +00:00
|
|
|
for (const SkIPoint& pt : test) {
|
|
|
|
SkIPoint negPt = -pt;
|
|
|
|
SkDebugf("pt: %d, %d negate: %d, %d\n", pt.fX, pt.fY, negPt.fX, negPt.fY);
|
2017-11-27 15:44:06 +00:00
|
|
|
}
|
|
|
|
#StdOut
|
2017-12-15 16:21:51 +00:00
|
|
|
pt: 0, 0 negate: 0, 0
|
|
|
|
pt: -1, -2 negate: 1, 2
|
|
|
|
pt: 2147483647, -2147483647 negate: -2147483647, 2147483647
|
2017-11-27 15:44:06 +00:00
|
|
|
pt: -2147483648, -2147483648 negate: -2147483648, -2147483648
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator-(const SkIPoint& a, const SkIPoint& b) operator-=(const SkIVector& v) SkPoint::operator-()_const
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void operator+=(const SkIVector& v)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # adds IVector to IPoint ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Offsets IPoint by IVector v. Sets IPoint to #Formula # (fX + v.fX, fY + v.fY) ##.
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Param v IVector to add ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
#Height 64
|
2017-12-15 16:21:51 +00:00
|
|
|
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);
|
2017-11-27 15:44:06 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator+(const SkIPoint& a, const SkIVector& b) SkPoint::operator+=(const SkVector& v)
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method void operator-=(const SkIVector& v)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # subtracts IVector from IPoint ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Subtracts IVector v from IPoint. Sets IPoint to: #Formula # (fX - v.fX, fY - v.fY) ##.
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
#Param v IVector to subtract ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
#Height 64
|
2017-12-15 16:21:51 +00:00
|
|
|
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);
|
2017-11-27 15:44:06 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator-(const SkIPoint& a, const SkIPoint& b) SkPoint::operator-=(const SkVector& v)
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool equals(int32_t x, int32_t y) const
|
2018-02-06 14:41:53 +00:00
|
|
|
#In Operator
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if members are equal ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns true if IPoint is equivalent to IPoint constructed from (x, y).
|
|
|
|
|
|
|
|
#Param x value compared with fX ##
|
|
|
|
#Param y value compared with fY ##
|
|
|
|
|
|
|
|
#Return true if IPoint equals (x, y) ##
|
|
|
|
|
|
|
|
#Example
|
2017-12-15 16:21:51 +00:00
|
|
|
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) ? '=' : '!');
|
2017-11-27 15:44:06 +00:00
|
|
|
}
|
|
|
|
#StdOut
|
2017-12-15 16:21:51 +00:00
|
|
|
pt: 0, 0 == pt
|
|
|
|
pt: -1, -2 == pt
|
|
|
|
pt: 2147483647, -1 == pt
|
2017-11-27 15:44:06 +00:00
|
|
|
pt: -2147483648, -1 == pt
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator==(const SkIPoint& a, const SkIPoint& b)
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool operator==(const SkIPoint& a, const SkIPoint& b)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if IPoints are equal ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns true if a is equivalent to b.
|
|
|
|
|
|
|
|
#Param a IPoint to compare ##
|
|
|
|
#Param b IPoint to compare ##
|
|
|
|
|
|
|
|
#Return true if a.fX == b.fX and a.fY == b.fY ##
|
|
|
|
|
|
|
|
#Example
|
2017-12-15 16:21:51 +00:00
|
|
|
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 ? '=' : '!');
|
2017-11-27 15:44:06 +00:00
|
|
|
}
|
|
|
|
#StdOut
|
2017-12-15 16:21:51 +00:00
|
|
|
pt: 0, 0 == pt
|
|
|
|
pt: -1, -2 == pt
|
|
|
|
pt: 2147483647, -1 == pt
|
2017-11-27 15:44:06 +00:00
|
|
|
pt: -2147483648, -1 == pt
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso equals() operator!=(const SkIPoint& a, const SkIPoint& b)
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method bool operator!=(const SkIPoint& a, const SkIPoint& b)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns true if IPoints are unequal ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns true if a is not equivalent to b.
|
|
|
|
|
|
|
|
#Param a IPoint to compare ##
|
|
|
|
#Param b IPoint to compare ##
|
|
|
|
|
|
|
|
#Return true if a.fX != b.fX or a.fY != b.fY ##
|
|
|
|
|
|
|
|
#Example
|
2017-12-15 16:21:51 +00:00
|
|
|
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 ? '!' : '=');
|
2017-11-27 15:44:06 +00:00
|
|
|
}
|
|
|
|
#StdOut
|
2017-12-15 16:21:51 +00:00
|
|
|
pt: 0, 0 == pt
|
|
|
|
pt: -1, -2 == pt
|
|
|
|
pt: 2147483647, -1 == pt
|
2017-11-27 15:44:06 +00:00
|
|
|
pt: -2147483648, -1 == pt
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator==(const SkIPoint& a, const SkIPoint& b) equals()
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkIVector operator-(const SkIPoint& a, const SkIPoint& b)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns IVector between IPoints ##
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
Returns IVector from b to a; computed as #Formula # (a.fX - b.fX, a.fY - b.fY) ##.
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
Can also be used to subtract IVector from IVector, returning IVector.
|
|
|
|
|
|
|
|
#Param a IPoint or IVector to subtract from ##
|
|
|
|
#Param b IVector to subtract ##
|
|
|
|
|
|
|
|
#Return IVector from b to a ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
#Height 64
|
2017-12-15 16:21:51 +00:00
|
|
|
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);
|
2017-11-27 15:44:06 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator-=(const SkIVector& v)
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#Method SkIPoint operator+(const SkIPoint& a, const SkIVector& b)
|
|
|
|
|
2018-01-30 15:08:57 +00:00
|
|
|
#Line # returns IPoint offset by IVector ##
|
2017-11-27 15:44:06 +00:00
|
|
|
Returns IPoint resulting from IPoint a offset by IVector b, computed as:
|
Condense embedded formulas.
Bookmaker delimits formulas and equations to allow
representing variables and symbols without tripping
up reference lookup, spell checking, and comment
generation.
Before, formulas were represented with:
some text
#Formula
(x + y, 0)
##
, and more text
This made it difficult to know when spacing should
be preserved before and after the formula. Now,
formulas are represented with:
some text #Formula # (x + y, 0) ##, and more text
The presence or absence of a space between ## and ,
is now significant (before it was not).
Also, formulas are bracketed by <code> in markdown
generation, so that variables stand out better.
See:
https://skia.org/user/api/SkBlendMode_Reference?cl=152781#Dst_Out
for an example.
Also fixed 100 column offenders and added a code
check to identify them. For the moment, 100 column
offenders are outed with SkDebugf but their presence
does not cause bookmaker to fail.
TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=152781
Bug: skia:6898
Change-Id: If92a65a234f5d616bf4485984a8d219a6f04821a
Reviewed-on: https://skia-review.googlesource.com/152781
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-09-13 16:04:30 +00:00
|
|
|
#Formula # (a.fX + b.fX, a.fY + b.fY) ##.
|
2017-11-27 15:44:06 +00:00
|
|
|
|
|
|
|
Can also be used to offset IPoint b by IVector a, returning IPoint.
|
|
|
|
Can also be used to add IVector to IVector, returning IVector.
|
|
|
|
|
|
|
|
#Param a IPoint or IVector to add to ##
|
|
|
|
#Param b IPoint or IVector to add ##
|
|
|
|
|
|
|
|
#Return IPoint equal to a offset by b ##
|
|
|
|
|
|
|
|
#Example
|
|
|
|
#Height 128
|
2017-12-15 16:21:51 +00:00
|
|
|
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);
|
2017-11-27 15:44:06 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
#SeeAlso operator+=(const SkIVector& v)
|
|
|
|
|
|
|
|
#Method ##
|
|
|
|
|
|
|
|
#Struct SkIPoint ##
|
|
|
|
|
|
|
|
|
2018-05-16 11:07:07 +00:00
|
|
|
#Subtopic IVector
|
|
|
|
#Line # alias for IPoint ##
|
2018-05-30 13:21:49 +00:00
|
|
|
#Alias IVector ##
|
|
|
|
#Alias IVectors ##
|
2017-11-27 15:44:06 +00:00
|
|
|
#Typedef SkIPoint SkIVector
|
2018-05-16 11:07:07 +00:00
|
|
|
#Line # alias for IPoint ##
|
|
|
|
#Code
|
|
|
|
typedef SkIPoint SkIVector;
|
|
|
|
##
|
|
|
|
SkIVector provides an alternative name for SkIPoint. SkIVector and SkIPoint
|
2018-05-30 13:21:49 +00:00
|
|
|
can be used interchangeably for all purposes.
|
2017-11-27 15:44:06 +00:00
|
|
|
#Typedef ##
|
|
|
|
##
|
2018-05-16 11:07:07 +00:00
|
|
|
|
|
|
|
#Topic IPoint ##
|
|
|
|
|