Documentation
¶
Overview ¶
Package path is a port of the Rust crate tiny-skia-path 0.12.0, a Bezier path of tiny-skia, and of the crate strict-num 0.1.1, which holds the checked float types.
The package holds a memory-efficient container for a Bezier path, a path builder, a path stroker and a path dasher.
It also holds some basic geometry types. Upstream says that they will move to an external crate eventually.
All types use single precision floats (float32), as Skia does.
The arithmetic gives the same bits as the Rust code. A multiply that is followed by an add is written as float32(x*y) + z, so that the Go compiler cannot fuse the two operations (D16).
Index ¶
- Constants
- func AlmostDequalULPs(x, other float32) bool
- func Ave(x, other float32) float32
- func Bound(x, min, max float32) float32
- func ChopCubicAt2(src *[4]Point, t NormalizedF32Exclusive, dst []Point)
- func ChopQuadAt(src []Point, t NormalizedF32Exclusive, dst *[5]Point)
- func ComputeResolutionScale(ts Transform) float32
- func FindUnitQuadRoots(a, b, c float32, roots *[3]NormalizedF32Exclusive) int
- func Half(x float32) float32
- func Invert(x float32) float32
- func IsNearlyEqual(x, other float32) bool
- func IsNearlyEqualWithinTolerance(x, other, tolerance float32) bool
- func IsNearlyZero(x float32) bool
- func IsNearlyZeroWithinTolerance(x, tolerance float32) bool
- func SaturateCeil(x float32) int32
- func SaturateFloor(x float32) int32
- func SaturateFrom(x float32) int32
- func SaturateFromF64(x float64) int32
- func SaturateRound(x float32) int32
- func Sqr(x float32) float32
- type CubicCoeff
- type F32x2
- func (v F32x2) Abs() F32x2
- func (v F32x2) Add(other F32x2) F32x2
- func (v F32x2) Div(other F32x2) F32x2
- func (v F32x2) Max(other F32x2) F32x2
- func (v F32x2) MaxComponent() float32
- func (v F32x2) Min(other F32x2) F32x2
- func (v F32x2) Mul(other F32x2) F32x2
- func (v F32x2) Sub(other F32x2) F32x2
- func (v F32x2) X() float32
- func (v F32x2) Y() float32
- type FiniteF32
- type IntRect
- func (r IntRect) Bottom() int32
- func (r IntRect) Contains(other IntRect) bool
- func (r IntRect) Height() uint32
- func (r IntRect) Inset(dx, dy int32) (IntRect, bool)
- func (r IntRect) Intersect(other IntRect) (IntRect, bool)
- func (r IntRect) Left() int32
- func (r IntRect) MakeOutset(dx, dy int32) (IntRect, bool)
- func (r IntRect) Right() int32
- func (r IntRect) Size() IntSize
- func (r IntRect) ToRect() Rect
- func (r IntRect) Top() int32
- func (r IntRect) Translate(tx, ty int32) (IntRect, bool)
- func (r IntRect) TranslateTo(x, y int32) (IntRect, bool)
- func (r IntRect) Width() uint32
- func (r IntRect) X() int32
- func (r IntRect) Y() int32
- type IntSize
- func (s IntSize) Dimensions() (uint32, uint32)
- func (s IntSize) Height() uint32
- func (s IntSize) ScaleBy(factor float32) (IntSize, bool)
- func (s IntSize) ScaleTo(to IntSize) IntSize
- func (s IntSize) ScaleToHeight(newHeight uint32) (IntSize, bool)
- func (s IntSize) ScaleToWidth(newWidth uint32) (IntSize, bool)
- func (s IntSize) ToIntRect(x, y int32) IntRect
- func (s IntSize) ToSize() Size
- func (s IntSize) Width() uint32
- type LineCap
- type LineJoin
- type NonZeroPositiveF32
- type NonZeroRect
- func (r NonZeroRect) BBoxTransform(bbox NonZeroRect) NonZeroRect
- func (r NonZeroRect) Bottom() float32
- func (r NonZeroRect) Height() float32
- func (r NonZeroRect) Left() float32
- func (r NonZeroRect) Right() float32
- func (r NonZeroRect) Size() Size
- func (r NonZeroRect) ToIntRect() IntRect
- func (r NonZeroRect) ToRect() Rect
- func (r NonZeroRect) Top() float32
- func (r NonZeroRect) Transform(ts Transform) (NonZeroRect, bool)
- func (r NonZeroRect) TranslateTo(x, y float32) (NonZeroRect, bool)
- func (r NonZeroRect) Width() float32
- func (r NonZeroRect) X() float32
- func (r NonZeroRect) Y() float32
- type NormalizedF32
- type NormalizedF32Exclusive
- type Path
- func (p *Path) Bounds() Rect
- func (p *Path) Clear() *PathBuilder
- func (p *Path) Clone() *Path
- func (p *Path) ComputeTightBounds() (Rect, bool)
- func (p *Path) Dash(dash *StrokeDash, resolutionScale float32) (*Path, bool)
- func (p *Path) IsEmpty() bool
- func (p *Path) Len() int
- func (p *Path) Points() []Point
- func (p *Path) Segments() PathSegmentsIter
- func (p *Path) String() string
- func (p *Path) Stroke(stroke *Stroke, resolutionScale float32) (*Path, bool)
- func (p *Path) Transform(ts Transform) (*Path, bool)
- func (p *Path) Verbs() []PathVerb
- type PathBuilder
- func (pb *PathBuilder) Clear()
- func (pb *PathBuilder) Clone() *PathBuilder
- func (pb *PathBuilder) Close()
- func (pb *PathBuilder) CubicTo(x1, y1, x2, y2, x, y float32)
- func (pb *PathBuilder) Finish() (*Path, bool)
- func (pb *PathBuilder) IsEmpty() bool
- func (pb *PathBuilder) LastPoint() (Point, bool)
- func (pb *PathBuilder) Len() int
- func (pb *PathBuilder) LineTo(x, y float32)
- func (pb *PathBuilder) MoveTo(x, y float32)
- func (pb *PathBuilder) PushCircle(x, y, r float32)
- func (pb *PathBuilder) PushOval(oval Rect)
- func (pb *PathBuilder) PushPath(other *Path)
- func (pb *PathBuilder) PushRect(rect Rect)
- func (pb *PathBuilder) QuadTo(x1, y1, x, y float32)
- type PathSegment
- type PathSegmentKind
- type PathSegmentsIter
- type PathStroker
- type PathVerb
- type Point
- func (p Point) Add(other Point) Point
- func (p *Point) AddAssign(other Point)
- func (p Point) Cross(other Point) float32
- func (p Point) Distance(other Point) float32
- func (p Point) Dot(other Point) float32
- func (p Point) IsFinite() bool
- func (p Point) IsZero() bool
- func (p Point) Length() float32
- func (p Point) Mul(other Point) Point
- func (p *Point) MulAssign(other Point)
- func (p Point) Neg() Point
- func (p *Point) Normalize() bool
- func (p *Point) Scale(scale float32)
- func (p *Point) SetLength(length float32) bool
- func (p *Point) SetLengthFrom(x, y, length float32) bool
- func (p *Point) SetNormalize(x, y float32) bool
- func (p Point) Sub(other Point) Point
- func (p *Point) SubAssign(other Point)
- func (p Point) ToF32x2() F32x2
- type PositiveF32
- type QuadCoeff
- type Rect
- func (r Rect) BBoxTransform(bbox NonZeroRect) Rect
- func (r Rect) Bottom() float32
- func (r Rect) Height() float32
- func (r Rect) Inset(dx, dy float32) (Rect, bool)
- func (r Rect) Intersect(other Rect) (Rect, bool)
- func (r Rect) IsEmpty() bool
- func (r Rect) Join(other Rect) (Rect, bool)
- func (r Rect) Left() float32
- func (r Rect) Outset(dx, dy float32) (Rect, bool)
- func (r Rect) Right() float32
- func (r Rect) Round() (IntRect, bool)
- func (r Rect) RoundOut() (IntRect, bool)
- func (r Rect) String() string
- func (r Rect) ToNonZeroRect() (NonZeroRect, bool)
- func (r Rect) Top() float32
- func (r Rect) Transform(ts Transform) (Rect, bool)
- func (r Rect) Width() float32
- func (r Rect) X() float32
- func (r Rect) Y() float32
- type Size
- func (s Size) ExpandTo(to Size) Size
- func (s Size) Height() float32
- func (s Size) ScaleBy(factor float32) (Size, bool)
- func (s Size) ScaleTo(to Size) Size
- func (s Size) ScaleToHeight(newHeight float32) (Size, bool)
- func (s Size) ScaleToWidth(newWidth float32) (Size, bool)
- func (s Size) ToIntSize() IntSize
- func (s Size) ToNonZeroRect(x, y float32) NonZeroRect
- func (s Size) ToRect(x, y float32) (Rect, bool)
- func (s Size) Width() float32
- type Stroke
- type StrokeDash
- type Transform
- func DefaultTransform() Transform
- func IdentityTransform() Transform
- func TransformFromBBox(bbox NonZeroRect) Transform
- func TransformFromRotate(angle float32) Transform
- func TransformFromRotateAt(angle, tx, ty float32) Transform
- func TransformFromRow(sx, ky, kx, sy, tx, ty float32) Transform
- func TransformFromScale(sx, sy float32) Transform
- func TransformFromSkew(kx, ky float32) Transform
- func TransformFromTranslate(tx, ty float32) Transform
- func (ts Transform) GetScale() (float32, float32)
- func (ts Transform) HasScale() bool
- func (ts Transform) HasSkew() bool
- func (ts Transform) HasTranslate() bool
- func (ts Transform) Invert() (Transform, bool)
- func (ts Transform) IsFinite() bool
- func (ts Transform) IsIdentity() bool
- func (ts Transform) IsScale() bool
- func (ts Transform) IsScaleTranslate() bool
- func (ts Transform) IsSkew() bool
- func (ts Transform) IsTranslate() bool
- func (ts Transform) IsValid() bool
- func (ts Transform) MapPoint(point *Point)
- func (ts Transform) MapPoints(points []Point)
- func (ts Transform) PostConcat(other Transform) Transform
- func (ts Transform) PostRotate(angle float32) Transform
- func (ts Transform) PostRotateAt(angle, tx, ty float32) Transform
- func (ts Transform) PostScale(sx, sy float32) Transform
- func (ts Transform) PostTranslate(tx, ty float32) Transform
- func (ts Transform) PreConcat(other Transform) Transform
- func (ts Transform) PreRotate(angle float32) Transform
- func (ts Transform) PreRotateAt(angle, tx, ty float32) Transform
- func (ts Transform) PreScale(sx, sy float32) Transform
- func (ts Transform) PreTranslate(tx, ty float32) Transform
Constants ¶
const NormalizedF32ExclusiveAny = NormalizedF32ExclusiveHalf
NormalizedF32ExclusiveAny is NormalizedF32Exclusive::ANY in tiny-skia-path path/src/floating_point.rs. It is just a random, valid number.
const ScalarMax float32 = 3.402823466e+38
ScalarMax is SCALAR_MAX in tiny-skia-path path/src/scalar.rs.
const ScalarNearlyZero float32 = 1.0 / (1 << 12)
ScalarNearlyZero is SCALAR_NEARLY_ZERO in tiny-skia-path path/src/scalar.rs.
const ScalarRoot2Over2 float32 = 0.707106781
ScalarRoot2Over2 is SCALAR_ROOT_2_OVER_2 in tiny-skia-path path/src/scalar.rs.
Variables ¶
This section is empty.
Functions ¶
func AlmostDequalULPs ¶
AlmostDequalULPs is Scalar::almost_dequal_ulps in tiny-skia-path path/src/scalar.rs. It comes from SkPathOpsTypes.
func Bound ¶
Bound is Scalar::bound in tiny-skia-path path/src/scalar.rs. It is a clamp that does not panic.
It works like SkTPin, and returns max for NaN and infinity.
func ChopCubicAt2 ¶
func ChopCubicAt2(src *[4]Point, t NormalizedF32Exclusive, dst []Point)
ChopCubicAt2 is chop_cubic_at2 in tiny-skia-path path/src/path_geometry.rs.
func ChopQuadAt ¶
func ChopQuadAt(src []Point, t NormalizedF32Exclusive, dst *[5]Point)
ChopQuadAt is chop_quad_at in tiny-skia-path path/src/path_geometry.rs.
func ComputeResolutionScale ¶
ComputeResolutionScale is PathStroker::compute_resolution_scale in tiny-skia-path path/src/stroker.rs. It computes a resolution scale.
The resolution scale is the "intended" resolution for the output. The default is 1.0.
A larger value (res > 1) tells that the result must be more precise, because it will be zoomed up, and small errors will be magnified.
A smaller value (0 < res < 1) tells that the result can be less precise, because it will be zoomed down, and small errors can be invisible.
func FindUnitQuadRoots ¶
func FindUnitQuadRoots(a, b, c float32, roots *[3]NormalizedF32Exclusive) int
FindUnitQuadRoots is find_unit_quad_roots in tiny-skia-path path/src/path_geometry.rs.
From Numerical Recipes in C.
Q = -1/2 (B + sign(B) sqrt[B*B - 4*A*C]) x1 = Q / A x2 = C / Q
func IsNearlyEqual ¶
IsNearlyEqual is Scalar::is_nearly_equal in tiny-skia-path path/src/scalar.rs.
func IsNearlyEqualWithinTolerance ¶
IsNearlyEqualWithinTolerance is Scalar::is_nearly_equal_within_tolerance in tiny-skia-path path/src/scalar.rs.
func IsNearlyZero ¶
IsNearlyZero is Scalar::is_nearly_zero in tiny-skia-path path/src/scalar.rs.
func IsNearlyZeroWithinTolerance ¶
IsNearlyZeroWithinTolerance is Scalar::is_nearly_zero_within_tolerance in tiny-skia-path path/src/scalar.rs.
func SaturateCeil ¶
SaturateCeil is i32::saturate_ceil of the trait SaturateRound<f32> in tiny-skia-path path/src/floating_point.rs.
func SaturateFloor ¶
SaturateFloor is i32::saturate_floor of the trait SaturateRound<f32> in tiny-skia-path path/src/floating_point.rs.
func SaturateFrom ¶
SaturateFrom is i32::saturate_from of the trait SaturateCast<f32> in tiny-skia-path path/src/floating_point.rs. It returns the closest integer for the given float.
It returns MAX_I32_FITS_IN_F32 for NaN.
func SaturateFromF64 ¶
SaturateFromF64 is i32::saturate_from of the trait SaturateCast<f64> in tiny-skia-path path/src/floating_point.rs. It returns the closest integer for the given double.
It returns i32::MAX for NaN.
func SaturateRound ¶
SaturateRound is i32::saturate_round of the trait SaturateRound<f32> in tiny-skia-path path/src/floating_point.rs.
Types ¶
type CubicCoeff ¶
CubicCoeff is CubicCoeff in tiny-skia-path path/src/path_geometry.rs.
func CubicCoeffFromPoints ¶
func CubicCoeffFromPoints(points *[4]Point) CubicCoeff
CubicCoeffFromPoints is CubicCoeff::from_points in tiny-skia-path path/src/path_geometry.rs.
func (CubicCoeff) Eval ¶
func (c CubicCoeff) Eval(t F32x2) F32x2
Eval is CubicCoeff::eval in tiny-skia-path path/src/path_geometry.rs.
type F32x2 ¶
type F32x2 [2]float32
F32x2 is f32x2 in tiny-skia-path path/src/f32x2_t.rs. It is a pair of float32 numbers.
Upstream says that it is mainly for internal use, and that a user must not rely on it.
Right now, there are no visible benefits of using SIMD for f32x2. So we don't.
func F32x2Splat ¶
F32x2Splat is f32x2::splat in tiny-skia-path path/src/f32x2_t.rs. It creates a new pair from a single value.
func NewF32x2 ¶
NewF32x2 is f32x2::new in tiny-skia-path path/src/f32x2_t.rs. It creates a new pair.
func (F32x2) Abs ¶
Abs is f32x2::abs in tiny-skia-path path/src/f32x2_t.rs. It returns an absolute value.
func (F32x2) Max ¶
Max is f32x2::max in tiny-skia-path path/src/f32x2_t.rs. It returns a maximum value.
func (F32x2) MaxComponent ¶
MaxComponent is f32x2::max_component in tiny-skia-path path/src/f32x2_t.rs. It returns the maximum of both values.
func (F32x2) Min ¶
Min is f32x2::min in tiny-skia-path path/src/f32x2_t.rs. It returns a minimum value.
type FiniteF32 ¶
type FiniteF32 float32
FiniteF32 is FiniteF32 in strict-num src/lib.rs. It is an immutable, finite float32.
func NewFiniteF32 ¶
NewFiniteF32 is FiniteF32::new in strict-num src/lib.rs. It creates a finite float32.
It returns false for NaN and infinity.
type IntRect ¶
type IntRect struct {
// contains filtered or unexported fields
}
IntRect is IntRect in tiny-skia-path path/src/rect.rs. It is an integer rectangle.
The type guarantees these facts:
- The width and the height are in the range 1..=i32::MAX.
- x+width and y+height do not overflow.
func IntRectFromLTRB ¶
IntRectFromLTRB is IntRect::from_ltrb in tiny-skia-path path/src/rect.rs. It creates a new IntRect.
func IntRectFromXYWH ¶
IntRectFromXYWH is IntRect::from_xywh in tiny-skia-path path/src/rect.rs. It creates a new IntRect.
func (IntRect) Bottom ¶
Bottom is IntRect::bottom in tiny-skia-path path/src/rect.rs. It returns the bottom edge of the rectangle.
func (IntRect) Contains ¶
Contains is IntRect::contains in tiny-skia-path path/src/rect.rs. It checks that the rectangle includes all of other.
func (IntRect) Height ¶
Height is IntRect::height in tiny-skia-path path/src/rect.rs. It returns the height of the rectangle.
func (IntRect) Inset ¶
Inset is IntRect::inset in tiny-skia-path path/src/rect.rs. It insets the rectangle.
func (IntRect) Intersect ¶
Intersect is IntRect::intersect in tiny-skia-path path/src/rect.rs. It returns the intersection of two rectangles.
It returns false if the rectangles do not intersect.
func (IntRect) Left ¶
Left is IntRect::left in tiny-skia-path path/src/rect.rs. It returns the left edge of the rectangle.
func (IntRect) MakeOutset ¶
MakeOutset is IntRect::make_outset in tiny-skia-path path/src/rect.rs. It outsets the rectangle.
func (IntRect) Right ¶
Right is IntRect::right in tiny-skia-path path/src/rect.rs. It returns the right edge of the rectangle.
func (IntRect) Size ¶
Size is IntRect::size in tiny-skia-path path/src/rect.rs. It returns the size of the rectangle.
func (IntRect) ToRect ¶
ToRect is IntRect::to_rect in tiny-skia-path path/src/rect.rs. It converts the rectangle into a Rect.
func (IntRect) Top ¶
Top is IntRect::top in tiny-skia-path path/src/rect.rs. It returns the top edge of the rectangle.
func (IntRect) Translate ¶
Translate is IntRect::translate in tiny-skia-path path/src/rect.rs. It translates the rectangle by the given offset.
func (IntRect) TranslateTo ¶
TranslateTo is IntRect::translate_to in tiny-skia-path path/src/rect.rs. It translates the rectangle to the given position.
func (IntRect) Width ¶
Width is IntRect::width in tiny-skia-path path/src/rect.rs. It returns the width of the rectangle.
type IntSize ¶
type IntSize struct {
// contains filtered or unexported fields
}
IntSize is IntSize in tiny-skia-path path/src/size.rs. It is an integer size.
The width and the height are guaranteed to be positive and not zero.
func IntSizeFromWH ¶
IntSizeFromWH is IntSize::from_wh in tiny-skia-path path/src/size.rs. It creates a new IntSize from a width and a height.
func (IntSize) Dimensions ¶
Dimensions is IntSize::dimensions in tiny-skia-path path/src/size.rs. It returns the width and the height.
func (IntSize) Height ¶
Height is IntSize::height in tiny-skia-path path/src/size.rs. It returns the height.
func (IntSize) ScaleBy ¶
ScaleBy is IntSize::scale_by in tiny-skia-path path/src/size.rs. It scales the size by the given factor.
func (IntSize) ScaleTo ¶
ScaleTo is IntSize::scale_to in tiny-skia-path path/src/size.rs. It scales the size to the given size.
func (IntSize) ScaleToHeight ¶
ScaleToHeight is IntSize::scale_to_height in tiny-skia-path path/src/size.rs. It scales the size to the given height.
func (IntSize) ScaleToWidth ¶
ScaleToWidth is IntSize::scale_to_width in tiny-skia-path path/src/size.rs. It scales the size to the given width.
func (IntSize) ToIntRect ¶
ToIntRect is IntSize::to_int_rect in tiny-skia-path path/src/size.rs. It converts the size into an IntRect at the given position.
type LineCap ¶
type LineCap uint8
LineCap is LineCap in tiny-skia-path path/src/stroker.rs. It is what a stroke draws at the start and the end of an open contour of a path.
The zero value is LineCapButt, the Default of upstream.
type LineJoin ¶
type LineJoin uint8
LineJoin is LineJoin in tiny-skia-path path/src/stroker.rs. It sets how a stroke draws the corners of a shape.
The join affects the four corners of a stroked rectangle, and the connected segments of a stroked path.
Choose the miter join to draw sharp corners. Choose the round join to draw a circle with a radius equal to the stroke width on top of the corner. Choose the bevel join to connect the thick strokes with the smallest shape.
The fill path made to describe the stroked path uses the join setting, but it can omit the actual join. For example, a fill path made with round joins does not always include circles at each connected segment.
The zero value is LineJoinMiter, the Default of upstream.
const ( // LineJoinMiter extends to the miter limit, then switches to bevel. LineJoinMiter LineJoin = iota // LineJoinMiterClip extends to the miter limit, then clips the corner. LineJoinMiterClip // LineJoinRound adds a circle. LineJoinRound // LineJoinBevel connects the outside edges. LineJoinBevel )
type NonZeroPositiveF32 ¶
type NonZeroPositiveF32 float32
NonZeroPositiveF32 is NonZeroPositiveF32 in strict-num src/lib.rs. It is an immutable, finite float32 that is known to be > 0.
func NewNonZeroPositiveF32 ¶
func NewNonZeroPositiveF32(n float32) (NonZeroPositiveF32, bool)
NewNonZeroPositiveF32 is NonZeroPositiveF32::new in strict-num src/lib.rs. It creates a new NonZeroPositiveF32 if the given value is > 0.
It returns false for a negative value, zero, NaN and infinity.
func (NonZeroPositiveF32) Get ¶
func (n NonZeroPositiveF32) Get() float32
Get is NonZeroPositiveF32::get in strict-num src/lib.rs. It returns the value as a primitive type.
func (NonZeroPositiveF32) GetFinite ¶
func (n NonZeroPositiveF32) GetFinite() FiniteF32
GetFinite is NonZeroPositiveF32::get_finite in strict-num src/lib.rs. It returns the value as a FiniteF32.
type NonZeroRect ¶
type NonZeroRect struct {
// contains filtered or unexported fields
}
NonZeroRect is NonZeroRect in tiny-skia-path path/src/rect.rs. It is a rectangle defined by its left, top, right and bottom edges.
It is like Rect, but its width and its height are guaranteed to be positive and not zero.
The type guarantees these facts:
- All values are finite.
- The left edge is < right.
- The top edge is < bottom.
- The width and the height are <= f32::MAX.
- The width and the height are > 0.0.
func NonZeroRectFromLTRB ¶
func NonZeroRectFromLTRB(left, top, right, bottom float32) (NonZeroRect, bool)
NonZeroRectFromLTRB is NonZeroRect::from_ltrb in tiny-skia-path path/src/rect.rs. It creates a new NonZeroRect.
func NonZeroRectFromXYWH ¶
func NonZeroRectFromXYWH(x, y, w, h float32) (NonZeroRect, bool)
NonZeroRectFromXYWH is NonZeroRect::from_xywh in tiny-skia-path path/src/rect.rs. It creates a new NonZeroRect.
func (NonZeroRect) BBoxTransform ¶
func (r NonZeroRect) BBoxTransform(bbox NonZeroRect) NonZeroRect
BBoxTransform is NonZeroRect::bbox_transform in tiny-skia-path path/src/rect.rs. It applies a bounding box transform.
func (NonZeroRect) Bottom ¶
func (r NonZeroRect) Bottom() float32
Bottom is NonZeroRect::bottom in tiny-skia-path path/src/rect.rs. It returns the bottom edge.
func (NonZeroRect) Height ¶
func (r NonZeroRect) Height() float32
Height is NonZeroRect::height in tiny-skia-path path/src/rect.rs. It returns the height of the rectangle.
func (NonZeroRect) Left ¶
func (r NonZeroRect) Left() float32
Left is NonZeroRect::left in tiny-skia-path path/src/rect.rs. It returns the left edge.
func (NonZeroRect) Right ¶
func (r NonZeroRect) Right() float32
Right is NonZeroRect::right in tiny-skia-path path/src/rect.rs. It returns the right edge.
func (NonZeroRect) Size ¶
func (r NonZeroRect) Size() Size
Size is NonZeroRect::size in tiny-skia-path path/src/rect.rs. It returns the size of the rectangle.
func (NonZeroRect) ToIntRect ¶
func (r NonZeroRect) ToIntRect() IntRect
ToIntRect is NonZeroRect::to_int_rect in tiny-skia-path path/src/rect.rs. It converts the rectangle into an IntRect.
func (NonZeroRect) ToRect ¶
func (r NonZeroRect) ToRect() Rect
ToRect is NonZeroRect::to_rect in tiny-skia-path path/src/rect.rs. It converts the rectangle into a Rect.
func (NonZeroRect) Top ¶
func (r NonZeroRect) Top() float32
Top is NonZeroRect::top in tiny-skia-path path/src/rect.rs. It returns the top edge.
func (NonZeroRect) Transform ¶
func (r NonZeroRect) Transform(ts Transform) (NonZeroRect, bool)
Transform is NonZeroRect::transform in tiny-skia-path path/src/rect.rs. It transforms the rectangle with the given Transform.
If the transform is a skew, the result is a bounding box around the skewed rectangle.
func (NonZeroRect) TranslateTo ¶
func (r NonZeroRect) TranslateTo(x, y float32) (NonZeroRect, bool)
TranslateTo is NonZeroRect::translate_to in tiny-skia-path path/src/rect.rs. It translates the rectangle to the given position.
func (NonZeroRect) Width ¶
func (r NonZeroRect) Width() float32
Width is NonZeroRect::width in tiny-skia-path path/src/rect.rs. It returns the width of the rectangle.
func (NonZeroRect) X ¶
func (r NonZeroRect) X() float32
X is NonZeroRect::x in tiny-skia-path path/src/rect.rs. It returns the X position of the rectangle.
func (NonZeroRect) Y ¶
func (r NonZeroRect) Y() float32
Y is NonZeroRect::y in tiny-skia-path path/src/rect.rs. It returns the Y position of the rectangle.
type NormalizedF32 ¶
type NormalizedF32 float32
NormalizedF32 is NormalizedF32 in strict-num src/lib.rs. It is an immutable, finite float32 in the range 0..=1.
const NormalizedF32One NormalizedF32 = 1
NormalizedF32One is NormalizedF32::ONE in strict-num src/lib.rs. It is a NormalizedF32 with the value one.
const NormalizedF32Zero NormalizedF32 = 0
NormalizedF32Zero is NormalizedF32::ZERO in strict-num src/lib.rs. It is a NormalizedF32 with the value zero.
func FindCubicMaxCurvature ¶
func FindCubicMaxCurvature(src *[4]Point, tValues *[3]NormalizedF32) []NormalizedF32
FindCubicMaxCurvature is find_cubic_max_curvature in tiny-skia-path path/src/path_geometry.rs. It returns the part of tValues that holds the result.
Looking for
F' dot F'' == 0 A = b - a B = c - 2b + a C = d - 3c + 3b - a F' = 3Ct^2 + 6Bt + 3A F'' = 6Ct + 6B F' dot F'' -> CCt^3 + 3BCt^2 + (2BB + CA)t + AB
func NewNormalizedF32 ¶
func NewNormalizedF32(n float32) (NormalizedF32, bool)
NewNormalizedF32 is NormalizedF32::new in strict-num src/lib.rs. It creates a NormalizedF32 if the given value is in the range 0..=1.
func NormalizedF32Clamped ¶
func NormalizedF32Clamped(n float32) NormalizedF32
NormalizedF32Clamped is NormalizedF32::new_clamped in strict-num src/lib.rs. It creates a NormalizedF32 and clamps the given value to the range 0..=1.
It returns zero for NaN or infinity.
func NormalizedF32FromU8 ¶
func NormalizedF32FromU8(n uint8) NormalizedF32
NormalizedF32FromU8 is NormalizedF32::new_u8 in strict-num src/lib.rs. It creates a NormalizedF32 by dividing the given value by 255.
func NormalizedF32FromU16 ¶
func NormalizedF32FromU16(n uint16) NormalizedF32
NormalizedF32FromU16 is NormalizedF32::new_u16 in strict-num src/lib.rs. It creates a NormalizedF32 by dividing the given value by 65535.
func (NormalizedF32) Get ¶
func (n NormalizedF32) Get() float32
Get is NormalizedF32::get in strict-num src/lib.rs. It returns the value as a primitive type.
func (NormalizedF32) GetFinite ¶
func (n NormalizedF32) GetFinite() FiniteF32
GetFinite is NormalizedF32::get_finite in strict-num src/lib.rs. It returns the value as a FiniteF32.
func (NormalizedF32) Mul ¶
func (n NormalizedF32) Mul(rhs NormalizedF32) NormalizedF32
Mul is the core::ops::Mul impl of NormalizedF32 in strict-num src/lib.rs. The product is clamped to the range 0..=1.
func (NormalizedF32) ToU8 ¶
func (n NormalizedF32) ToU8() uint8
ToU8 is NormalizedF32::to_u8 in strict-num src/lib.rs. It returns the value as a uint8.
func (NormalizedF32) ToU16 ¶
func (n NormalizedF32) ToU16() uint16
ToU16 is NormalizedF32::to_u16 in strict-num src/lib.rs. It returns the value as a uint16.
type NormalizedF32Exclusive ¶
type NormalizedF32Exclusive float32
NormalizedF32Exclusive is NormalizedF32Exclusive in tiny-skia-path path/src/floating_point.rs. It is an immutable float32 that is larger than 0 and less than 1.
Port: upstream wraps a FiniteF32. A conversion such as NormalizedF32Exclusive(x) does not check the value, as new_unchecked does not in Rust. Use NewNormalizedF32Exclusive to check it.
const NormalizedF32ExclusiveHalf NormalizedF32Exclusive = 0.5
NormalizedF32ExclusiveHalf is NormalizedF32Exclusive::HALF in tiny-skia-path path/src/floating_point.rs. It is a predefined 0.5 value.
func NewNormalizedF32Exclusive ¶
func NewNormalizedF32Exclusive(n float32) (NormalizedF32Exclusive, bool)
NewNormalizedF32Exclusive is NormalizedF32Exclusive::new in tiny-skia-path path/src/floating_point.rs. It creates a NormalizedF32Exclusive.
func NewTValues ¶
func NewTValues() [3]NormalizedF32Exclusive
NewTValues is new_t_values in tiny-skia-path path/src/path_geometry.rs.
TODO: to a custom type?
func NormalizedF32ExclusiveBounded ¶
func NormalizedF32ExclusiveBounded(n float32) NormalizedF32Exclusive
NormalizedF32ExclusiveBounded is NormalizedF32Exclusive::new_bounded in tiny-skia-path path/src/floating_point.rs. It creates a NormalizedF32Exclusive and clamps the given value.
Upstream says that it returns zero for NaN or infinity. The code returns the upper bound, 1 - f32::EPSILON, for NaN and infinity.
func ValidUnitDivide ¶
func ValidUnitDivide(numer, denom float32) (NormalizedF32Exclusive, bool)
ValidUnitDivide is valid_unit_divide in tiny-skia-path path/src/path_geometry.rs.
func (NormalizedF32Exclusive) Get ¶
func (n NormalizedF32Exclusive) Get() float32
Get is NormalizedF32Exclusive::get in tiny-skia-path path/src/floating_point.rs. It returns the value as a primitive type.
func (NormalizedF32Exclusive) ToNormalized ¶
func (n NormalizedF32Exclusive) ToNormalized() NormalizedF32
ToNormalized is NormalizedF32Exclusive::to_normalized in tiny-skia-path path/src/floating_point.rs. It returns the value as a NormalizedF32.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path is Path in tiny-skia-path path/src/path.rs. It is a Bezier path.
A PathBuilder creates a Path. PathBuilder.Finish returns the path, and Path.Clear returns a PathBuilder that reuses the memory of the path.
A Path is immutable and uses compact storage: it stores the types of the segments and the points apart. Path.Verbs and Path.Points give access to them, and so does Path.Segments.
The type guarantees these facts:
- It has valid bounds, computed in advance.
- All points are finite.
- It has at least two segments.
- Each contour starts with a MoveTo.
- No Move follows a Move.
- No Close follows a Close.
- Contours of zero length are allowed.
func PathFromCircle ¶
PathFromCircle is PathBuilder::from_circle in tiny-skia-path path/src/path_builder.rs. It creates a new Path from a circle.
See PathBuilder.PushCircle for details.
func PathFromOval ¶
PathFromOval is PathBuilder::from_oval in tiny-skia-path path/src/path_builder.rs. It creates a new Path from an oval.
See PathBuilder.PushOval for details.
func PathFromRect ¶
PathFromRect is PathBuilder::from_rect in tiny-skia-path path/src/path_builder.rs. It creates a new Path from a Rect.
It never fails, because a Rect is always valid.
It creates the segments clockwise: TopLeft -> TopRight -> BottomRight -> BottomLeft.
The contour is closed.
func (*Path) Bounds ¶
Bounds is Path::bounds in tiny-skia-path path/src/path.rs. It returns the bounds of the points of the path.
The value is already computed.
func (*Path) Clear ¶
func (p *Path) Clear() *PathBuilder
Clear is Path::clear in tiny-skia-path path/src/path.rs. It clears the path and returns a PathBuilder that reuses the allocated memory.
Port: Rust consumes the path. Do not use p after Clear.
func (*Path) Clone ¶
Clone is the derived Clone impl of Path in tiny-skia-path path/src/path.rs. It returns a deep copy of the path.
func (*Path) ComputeTightBounds ¶
ComputeTightBounds is Path::compute_tight_bounds in tiny-skia-path path/src/path.rs. It computes the tight bounds of the path.
This operation can be expensive.
func (*Path) Dash ¶
func (p *Path) Dash(dash *StrokeDash, resolutionScale float32) (*Path, bool)
Dash is Path::dash in tiny-skia-path path/src/dash.rs. It converts the path into a dashed one.
ComputeResolutionScale gives resolutionScale.
It returns false when it has to make more than 1_000_000 dashes, or when the final path has an invalid bounding box.
func (*Path) IsEmpty ¶
IsEmpty is Path::is_empty in tiny-skia-path path/src/path.rs. It returns true if the path is empty.
func (*Path) Len ¶
Len is Path::len in tiny-skia-path path/src/path.rs. It returns the number of segments in the path.
func (*Path) Points ¶
Points is Path::points in tiny-skia-path path/src/path.rs. It returns the internal slice of points.
func (*Path) Segments ¶
func (p *Path) Segments() PathSegmentsIter
Segments is Path::segments in tiny-skia-path path/src/path.rs. It returns an iterator over the segments of the path.
func (*Path) String ¶
String is the Debug impl of Path in tiny-skia-path path/src/path.rs. It satisfies the fmt.Stringer interface. It writes the segments as the commands of an SVG path, and the bounds.
Port: Rust writes the struct with the Debug format of Rust. Go writes the same text.
func (*Path) Stroke ¶
Stroke is Path::stroke in tiny-skia-path path/src/stroker.rs. It returns a stroked path.
ComputeResolutionScale gives resolutionScale.
If you plan to stroke many paths, you can use a PathStroker. It keeps the temporary allocations that a stroke needs, and this can make it a bit faster.
It returns false when a point of the path is NaN or infinite (D74).
func (*Path) Transform ¶
Transform is Path::transform in tiny-skia-path path/src/path.rs. It transforms the path in place and returns it.
Some points can become NaN or infinity, so this method can fail.
Port: Rust consumes the path. Go changes p in place and returns p. When it returns false, p holds the transformed points and the old bounds, and it is not valid.
type PathBuilder ¶
type PathBuilder struct {
// contains filtered or unexported fields
}
PathBuilder is PathBuilder in tiny-skia-path path/src/path_builder.rs. It is a path builder.
The zero value is the Default impl of upstream. It differs from NewPathBuilder: it does not require a MoveTo first, so a LineTo on an empty zero value adds no Move(0, 0).
func NewPathBuilder ¶
func NewPathBuilder() *PathBuilder
NewPathBuilder is PathBuilder::new in tiny-skia-path path/src/path_builder.rs. It creates a new builder.
func NewPathBuilderWithCapacity ¶
func NewPathBuilderWithCapacity(verbsCapacity, pointsCapacity int) *PathBuilder
NewPathBuilderWithCapacity is PathBuilder::with_capacity in tiny-skia-path path/src/path_builder.rs. It creates a new builder with the given capacity.
The number of points depends on the type of the verb:
- Move: 1
- Line: 1
- Quad: 2
- Cubic: 3
- Close: 0
func (*PathBuilder) Clear ¶
func (pb *PathBuilder) Clear()
Clear is PathBuilder::clear in tiny-skia-path path/src/path_builder.rs. It resets the builder.
It keeps the allocated memory.
func (*PathBuilder) Clone ¶
func (pb *PathBuilder) Clone() *PathBuilder
Clone is the derived Clone impl of PathBuilder in tiny-skia-path path/src/path_builder.rs. It returns a deep copy of the builder.
func (*PathBuilder) Close ¶
func (pb *PathBuilder) Close()
Close is PathBuilder::close in tiny-skia-path path/src/path_builder.rs. It closes the current contour.
A closed contour connects the first and the last point with a line, and so forms a continuous loop.
It does nothing when the Path is empty or already closed.
An open contour and a closed contour are filled the same way. A stroke of an open contour adds a LineCap at the start and the end of the contour. A stroke of a closed contour adds a LineJoin at the start and the end of the contour.
func (*PathBuilder) CubicTo ¶
func (pb *PathBuilder) CubicTo(x1, y1, x2, y2, x, y float32)
CubicTo is PathBuilder::cubic_to in tiny-skia-path path/src/path_builder.rs. It adds a cubic curve from the last point to x, y.
- If the Path is empty, it adds Move(0, 0) first.
- If the Path ends with Close, it adds Move(last_x, last_y) first.
func (*PathBuilder) Finish ¶
func (pb *PathBuilder) Finish() (*Path, bool)
Finish is PathBuilder::finish in tiny-skia-path path/src/path_builder.rs. It finishes the builder and returns a Path.
It returns false when the Path is empty or has invalid bounds.
Port: Rust consumes the builder. Go moves the memory of pb into the Path and leaves pb as a zero value, in each case.
func (*PathBuilder) IsEmpty ¶
func (pb *PathBuilder) IsEmpty() bool
IsEmpty is PathBuilder::is_empty in tiny-skia-path path/src/path_builder.rs. It checks if the builder has no segments.
func (*PathBuilder) LastPoint ¶
func (pb *PathBuilder) LastPoint() (Point, bool)
LastPoint is PathBuilder::last_point in tiny-skia-path path/src/path_builder.rs. It returns the last point, if there is one.
func (*PathBuilder) Len ¶
func (pb *PathBuilder) Len() int
Len is PathBuilder::len in tiny-skia-path path/src/path_builder.rs. It returns the current number of segments in the builder.
func (*PathBuilder) LineTo ¶
func (pb *PathBuilder) LineTo(x, y float32)
LineTo is PathBuilder::line_to in tiny-skia-path path/src/path_builder.rs. It adds a line from the last point.
- If the Path is empty, it adds Move(0, 0) first.
- If the Path ends with Close, it adds Move(last_x, last_y) first.
func (*PathBuilder) MoveTo ¶
func (pb *PathBuilder) MoveTo(x, y float32)
MoveTo is PathBuilder::move_to in tiny-skia-path path/src/path_builder.rs. It adds the start of a contour.
A MoveTo segment cannot follow a MoveTo segment. If the previous segment was also a MoveTo, the current one overwrites it.
func (*PathBuilder) PushCircle ¶
func (pb *PathBuilder) PushCircle(x, y, r float32)
PushCircle is PathBuilder::push_circle in tiny-skia-path path/src/path_builder.rs. It adds a circle contour.
The contour is closed and has a clockwise direction.
It does nothing when:
- radius <= 0
- a value is not finite or is very large
func (*PathBuilder) PushOval ¶
func (pb *PathBuilder) PushOval(oval Rect)
PushOval is PathBuilder::push_oval in tiny-skia-path path/src/path_builder.rs. It adds an oval contour bounded by the given rectangle.
The contour is closed and has a clockwise direction.
func (*PathBuilder) PushPath ¶
func (pb *PathBuilder) PushPath(other *Path)
PushPath is PathBuilder::push_path in tiny-skia-path path/src/path_builder.rs. It adds a path.
func (*PathBuilder) PushRect ¶
func (pb *PathBuilder) PushRect(rect Rect)
PushRect is PathBuilder::push_rect in tiny-skia-path path/src/path_builder.rs. It adds a rectangle contour.
The contour is closed and has a clockwise direction.
func (*PathBuilder) QuadTo ¶
func (pb *PathBuilder) QuadTo(x1, y1, x, y float32)
QuadTo is PathBuilder::quad_to in tiny-skia-path path/src/path_builder.rs. It adds a quad curve from the last point to x, y.
- If the Path is empty, it adds Move(0, 0) first.
- If the Path ends with Close, it adds Move(last_x, last_y) first.
type PathSegment ¶
type PathSegment struct {
Kind PathSegmentKind
Points [3]Point
}
PathSegment is PathSegment in tiny-skia-path path/src/path.rs. It is a path segment.
Port: the Rust enum carries data, so it becomes a struct with a kind field. Points holds the points of the variant in their order: one for MoveTo and LineTo, two for QuadTo, three for CubicTo and none for Close. The other points are zero, so that two segments compare equal with ==.
type PathSegmentKind ¶
type PathSegmentKind uint8
PathSegmentKind is the kind of a PathSegment. It is the variant of the enum PathSegment in tiny-skia-path path/src/path.rs.
const ( PathSegmentMoveTo PathSegmentKind = iota PathSegmentLineTo PathSegmentQuadTo PathSegmentCubicTo PathSegmentClose )
The values of PathSegmentKind.
func (PathSegmentKind) String ¶
func (k PathSegmentKind) String() string
String satisfies the fmt.Stringer interface.
type PathSegmentsIter ¶
type PathSegmentsIter struct {
// contains filtered or unexported fields
}
PathSegmentsIter is PathSegmentsIter in tiny-skia-path path/src/path.rs. It is an iterator over the segments of a path.
func (PathSegmentsIter) All ¶
func (it PathSegmentsIter) All() iter.Seq[PathSegment]
All returns an iterator over the remaining segments, for use with range. It iterates over a copy of it, so it does not change it.
Port: it ports no upstream function. It is the Go form of the Rust Iterator impl of PathSegmentsIter.
func (*PathSegmentsIter) CurrVerb ¶
func (it *PathSegmentsIter) CurrVerb() PathVerb
CurrVerb is PathSegmentsIter::curr_verb in tiny-skia-path path/src/path.rs. It returns the current verb.
func (*PathSegmentsIter) Next ¶
func (it *PathSegmentsIter) Next() (PathSegment, bool)
Next is Iterator::next of PathSegmentsIter in tiny-skia-path path/src/path.rs. It returns the next segment, or false at the end.
func (*PathSegmentsIter) NextVerb ¶
func (it *PathSegmentsIter) NextVerb() (PathVerb, bool)
NextVerb is PathSegmentsIter::next_verb in tiny-skia-path path/src/path.rs. It returns the next verb.
func (*PathSegmentsIter) SetAutoClose ¶
func (it *PathSegmentsIter) SetAutoClose(flag bool)
SetAutoClose is PathSegmentsIter::set_auto_close in tiny-skia-path path/src/path.rs. It sets the auto closing mode. It is off by default.
When it is on, the iterator returns an extra LineTo segment from the current position to the previous MoveTo, and only then a Close segment.
type PathStroker ¶
type PathStroker struct {
// contains filtered or unexported fields
}
PathStroker is PathStroker in tiny-skia-path path/src/stroker.rs. It is a path stroker.
func NewPathStroker ¶
func NewPathStroker() *PathStroker
NewPathStroker is PathStroker::new in tiny-skia-path path/src/stroker.rs. It creates a new PathStroker. The Default impl of upstream is the same.
type PathVerb ¶
type PathVerb uint8
PathVerb is PathVerb in tiny-skia-path path/src/path.rs. It is a path verb.
The values of PathVerb.
type Point ¶
Point is Point in tiny-skia-path path/src/lib.rs. It is a point.
The point is not guaranteed to be finite.
func PointFromF32x2 ¶
PointFromF32x2 is Point::from_f32x2 in tiny-skia-path path/src/lib.rs. It creates a new Point from an F32x2.
func PointFromXY ¶
PointFromXY is Point::from_xy in tiny-skia-path path/src/lib.rs. It creates a new Point.
func PointZero ¶
func PointZero() Point
PointZero is Point::zero in tiny-skia-path path/src/lib.rs. It creates a point at the position 0x0.
func (*Point) AddAssign ¶
AddAssign is the core::ops::AddAssign impl of Point in tiny-skia-path path/src/lib.rs.
func (Point) Cross ¶
Cross is Point::cross in tiny-skia-path path/src/lib.rs. It returns the cross product of the vector and other.
The vector and other form three-dimensional vectors with a z value of zero. The cross product is a three-dimensional vector with x and y values of zero. Cross returns its z component.
func (Point) Distance ¶
Distance is Point::distance in tiny-skia-path path/src/lib.rs. It returns the Euclidean distance from other.
func (Point) Dot ¶
Dot is Point::dot in tiny-skia-path path/src/lib.rs. It returns the dot product of two points.
func (Point) IsFinite ¶
IsFinite is Point::is_finite in tiny-skia-path path/src/lib.rs. It returns true if both x and y are measurable values.
Both values are other than infinities and NaN.
Port: upstream tests the product x*y, so a product that overflows to infinity also gives false.
func (Point) IsZero ¶
IsZero is Point::is_zero in tiny-skia-path path/src/lib.rs. It returns true if x and y are both zero.
func (Point) Length ¶
Length is Point::length in tiny-skia-path path/src/lib.rs. It returns the Euclidean distance from the origin.
func (*Point) MulAssign ¶
MulAssign is the core::ops::MulAssign impl of Point in tiny-skia-path path/src/lib.rs.
func (*Point) Normalize ¶
Normalize is Point::normalize in tiny-skia-path path/src/lib.rs. It scales (x, y) so that Length returns one, and keeps the ratio of x to y, if it can.
If the length before is nearly zero, it sets the vector to (0, 0) and returns false. Otherwise it returns true.
func (*Point) Scale ¶
Scale is Point::scale in tiny-skia-path path/src/lib.rs. It scales the point in place by scale.
func (*Point) SetLength ¶
SetLength is Point::set_length in tiny-skia-path path/src/lib.rs. It scales the vector so that its distance to the origin is length, if it can.
If the length before is nearly zero, it sets the vector to (0, 0) and returns false. Otherwise it returns true.
func (*Point) SetLengthFrom ¶
SetLengthFrom is Point::set_length_from in tiny-skia-path path/src/lib.rs. It sets the vector to (x, y) scaled to length, if it can.
If the length before is nearly zero, it sets the vector to (0, 0) and returns false. Otherwise it returns true.
func (*Point) SetNormalize ¶
SetNormalize is Point::set_normalize in tiny-skia-path path/src/lib.rs. It sets the vector to (x, y) scaled so that Length returns one, and so that the vector is proportional to (x, y).
If the length of (x, y) is nearly zero, it sets the vector to (0, 0) and returns false. Otherwise it returns true.
type PositiveF32 ¶
type PositiveF32 float32
PositiveF32 is PositiveF32 in strict-num src/lib.rs. It is an immutable, finite float32 that is known to be >= 0.
const PositiveF32Zero PositiveF32 = 0
PositiveF32Zero is PositiveF32::ZERO in strict-num src/lib.rs. It is a PositiveF32 with the value zero.
func NewPositiveF32 ¶
func NewPositiveF32(n float32) (PositiveF32, bool)
NewPositiveF32 is PositiveF32::new in strict-num src/lib.rs. It creates a new PositiveF32 if the given value is >= 0.
It returns false for a negative value, NaN and infinity.
func (PositiveF32) Get ¶
func (n PositiveF32) Get() float32
Get is PositiveF32::get in strict-num src/lib.rs. It returns the value as a primitive type.
func (PositiveF32) GetFinite ¶
func (n PositiveF32) GetFinite() FiniteF32
GetFinite is PositiveF32::get_finite in strict-num src/lib.rs. It returns the value as a FiniteF32.
type QuadCoeff ¶
QuadCoeff is QuadCoeff in tiny-skia-path path/src/path_geometry.rs.
use for : eval(t) == A * t^2 + B * t + C.
func QuadCoeffFromPoints ¶
QuadCoeffFromPoints is QuadCoeff::from_points in tiny-skia-path path/src/path_geometry.rs.
type Rect ¶
type Rect struct {
// contains filtered or unexported fields
}
Rect is Rect in tiny-skia-path path/src/rect.rs. It is a rectangle defined by its left, top, right and bottom edges.
It can have a zero width or height, or both. But not a negative one.
The type guarantees these facts:
- All values are finite.
- The left edge is <= right.
- The top edge is <= bottom.
- The width and the height are <= f32::MAX.
func RectFromLTRB ¶
RectFromLTRB is Rect::from_ltrb in tiny-skia-path path/src/rect.rs. It creates a new Rect.
func RectFromPoints ¶
RectFromPoints is Rect::from_points in tiny-skia-path path/src/rect.rs. It creates a Rect from a slice of points.
It returns false if the slice is empty or if a point holds an infinity or NaN.
func RectFromXYWH ¶
RectFromXYWH is Rect::from_xywh in tiny-skia-path path/src/rect.rs. It creates a new Rect.
func (Rect) BBoxTransform ¶
func (r Rect) BBoxTransform(bbox NonZeroRect) Rect
BBoxTransform is Rect::bbox_transform in tiny-skia-path path/src/rect.rs. It applies a bounding box transform.
func (Rect) Bottom ¶
Bottom is Rect::bottom in tiny-skia-path path/src/rect.rs. It returns the bottom edge.
func (Rect) Height ¶
Height is Rect::height in tiny-skia-path path/src/rect.rs. It returns the height of the rectangle.
func (Rect) Inset ¶
Inset is Rect::inset in tiny-skia-path path/src/rect.rs. It insets the rectangle by the given offset.
func (Rect) Intersect ¶
Intersect is Rect::intersect in tiny-skia-path path/src/rect.rs. It returns the intersection of two rectangles.
It returns false if the rectangles do not intersect.
func (Rect) IsEmpty ¶
IsEmpty is Rect::is_empty in tiny-skia-path path/src/rect.rs. It returns true if the rectangle is empty.
func (Rect) Join ¶
Join is Rect::join in tiny-skia-path path/src/rect.rs. It returns the union of two rectangles.
It returns false if the width or the height overflows.
func (Rect) Outset ¶
Outset is Rect::outset in tiny-skia-path path/src/rect.rs. It outsets the rectangle by the given offset.
func (Rect) Right ¶
Right is Rect::right in tiny-skia-path path/src/rect.rs. It returns the right edge.
func (Rect) Round ¶
Round is Rect::round in tiny-skia-path path/src/rect.rs. It converts the rectangle into an IntRect: it adds 0.5 and discards the fraction.
The width and the height are guaranteed to be >= 1.
func (Rect) RoundOut ¶
RoundOut is Rect::round_out in tiny-skia-path path/src/rect.rs. It converts the rectangle into an IntRect and rounds outwards.
The width and the height are guaranteed to be >= 1.
func (Rect) String ¶
String is the Debug impl of Rect in tiny-skia-path path/src/rect.rs. It satisfies the fmt.Stringer interface.
func (Rect) ToNonZeroRect ¶
func (r Rect) ToNonZeroRect() (NonZeroRect, bool)
ToNonZeroRect is Rect::to_non_zero_rect in tiny-skia-path path/src/rect.rs. It converts the rectangle into a NonZeroRect.
func (Rect) Transform ¶
Transform is Rect::transform in tiny-skia-path path/src/rect.rs. It transforms the rectangle with the given Transform.
If the transform is a skew, the result is a bounding box around the skewed rectangle.
func (Rect) Width ¶
Width is Rect::width in tiny-skia-path path/src/rect.rs. It returns the width of the rectangle.
type Size ¶
type Size struct {
// contains filtered or unexported fields
}
Size is Size in tiny-skia-path path/src/size.rs. It is a size.
The width and the height are guaranteed to be positive, not zero and finite.
func SizeFromWH ¶
SizeFromWH is Size::from_wh in tiny-skia-path path/src/size.rs. It creates a new Size from a width and a height.
func (Size) ExpandTo ¶
ExpandTo is Size::expand_to in tiny-skia-path path/src/size.rs. It expands the size to the given size.
func (Size) Height ¶
Height is Size::height in tiny-skia-path path/src/size.rs. It returns the height.
func (Size) ScaleBy ¶
ScaleBy is Size::scale_by in tiny-skia-path path/src/size.rs. It scales the size by the given factor.
func (Size) ScaleTo ¶
ScaleTo is Size::scale_to in tiny-skia-path path/src/size.rs. It scales the size to the given size.
func (Size) ScaleToHeight ¶
ScaleToHeight is Size::scale_to_height in tiny-skia-path path/src/size.rs. It scales the size to the given height.
func (Size) ScaleToWidth ¶
ScaleToWidth is Size::scale_to_width in tiny-skia-path path/src/size.rs. It scales the size to the given width.
func (Size) ToIntSize ¶
ToIntSize is Size::to_int_size in tiny-skia-path path/src/size.rs. It converts the size into an IntSize.
func (Size) ToNonZeroRect ¶
func (s Size) ToNonZeroRect(x, y float32) NonZeroRect
ToNonZeroRect is Size::to_non_zero_rect in tiny-skia-path path/src/size.rs. It converts the size into a NonZeroRect at the given position.
type Stroke ¶
type Stroke struct {
// Width is the thickness of the stroke.
//
// It must be >= 0.
//
// When it is 0, the stroke is a hairline.
//
// Default: 1.0
Width float32
// MiterLimit is the limit at which a sharp corner is drawn beveled.
//
// Default: 4.0
MiterLimit float32
// LineCap is the line cap of the stroke.
//
// Default: Butt
LineCap LineCap
// LineJoin is the line join of the stroke.
//
// Default: Miter
LineJoin LineJoin
// Dash holds the properties of the stroke dash. Nil is the Rust None.
//
// Default: None
Dash *StrokeDash
}
Stroke is Stroke in tiny-skia-path path/src/stroker.rs. It holds the properties of a stroke.
func DefaultStroke ¶
func DefaultStroke() Stroke
DefaultStroke is the Default impl of Stroke in tiny-skia-path path/src/stroker.rs.
type StrokeDash ¶
type StrokeDash struct {
// contains filtered or unexported fields
}
StrokeDash is StrokeDash in tiny-skia-path path/src/dash.rs. It holds the properties of a stroke dash.
It holds an array of pairs: the first number of a pair is an "on" interval, and the second one is an "off" interval. It also holds a dash offset and internal properties.
The type guarantees these facts:
- The dash array always has an even number of values.
- All values of the dash array are finite and >= 0.
- The dash array has at least two values.
- The sum of all values of the dash array is positive and finite.
- The dash offset is finite.
func NewStrokeDash ¶
func NewStrokeDash(dashArray []float32, dashOffset float32) (*StrokeDash, bool)
NewStrokeDash is StrokeDash::new in tiny-skia-path path/src/dash.rs. It creates a new stroke dash.
Port: Rust takes ownership of the dash array. Go keeps dashArray, so do not change it after the call.
func (*StrokeDash) Array ¶ added in v0.18.0
func (d *StrokeDash) Array() []float32
Array returns the dash array of the dash. It is the slice that NewStrokeDash took, so do not change it. A writer of PDF or SVG writes the dashes of a stroke with it. It is not in tiny-skia (D69).
func (*StrokeDash) Offset ¶ added in v0.18.0
func (d *StrokeDash) Offset() float32
Offset returns the dash offset of the dash. NewStrokeDash moves the offset that it takes into the range from 0 to the sum of the dash array, so the value can differ from that offset. It gives the same dashes. It is not in tiny-skia (D69).
type Transform ¶
Transform is Transform in tiny-skia-path path/src/transform.rs. It is an affine transformation matrix.
Unlike other types, a Transform is not guaranteed to be valid. This is a quirk of Skia. So Transform(0, 0, 0, 0, 0, 0) is allowed, though it is not valid. Values that are not finite are also not an error.
func DefaultTransform ¶
func DefaultTransform() Transform
DefaultTransform is the Default impl of Transform in tiny-skia-path path/src/transform.rs. It returns the identity transform.
func IdentityTransform ¶
func IdentityTransform() Transform
IdentityTransform is Transform::identity in tiny-skia-path path/src/transform.rs. It creates an identity transform.
func TransformFromBBox ¶
func TransformFromBBox(bbox NonZeroRect) Transform
TransformFromBBox is Transform::from_bbox in tiny-skia-path path/src/transform.rs. It converts a rectangle into a bounding box Transform.
func TransformFromRotate ¶
TransformFromRotate is Transform::from_rotate in tiny-skia-path path/src/transform.rs. It creates a new rotating Transform.
The angle is in degrees.
func TransformFromRotateAt ¶
TransformFromRotateAt is Transform::from_rotate_at in tiny-skia-path path/src/transform.rs. It creates a new rotating Transform at the given position.
The angle is in degrees.
func TransformFromRow ¶
TransformFromRow is Transform::from_row in tiny-skia-path path/src/transform.rs. It creates a new Transform.
We are using column-major-column-vector matrix notation, therefore it's ky-kx, not kx-ky.
func TransformFromScale ¶
TransformFromScale is Transform::from_scale in tiny-skia-path path/src/transform.rs. It creates a new scaling Transform.
func TransformFromSkew ¶
TransformFromSkew is Transform::from_skew in tiny-skia-path path/src/transform.rs. It creates a new skewing Transform.
func TransformFromTranslate ¶
TransformFromTranslate is Transform::from_translate in tiny-skia-path path/src/transform.rs. It creates a new translating Transform.
func (Transform) GetScale ¶
GetScale is Transform::get_scale in tiny-skia-path path/src/transform.rs. It returns the scale part of the transform.
func (Transform) HasScale ¶
HasScale is Transform::has_scale in tiny-skia-path path/src/transform.rs. It checks that the transform holds a scale part.
func (Transform) HasSkew ¶
HasSkew is Transform::has_skew in tiny-skia-path path/src/transform.rs. It checks that the transform holds a skew part.
func (Transform) HasTranslate ¶
HasTranslate is Transform::has_translate in tiny-skia-path path/src/transform.rs. It checks that the transform holds a translate part.
func (Transform) Invert ¶
Invert is Transform::invert in tiny-skia-path path/src/transform.rs. It returns the inverted transform.
func (Transform) IsFinite ¶
IsFinite is Transform::is_finite in tiny-skia-path path/src/transform.rs. It checks that the transform is finite.
func (Transform) IsIdentity ¶
IsIdentity is Transform::is_identity in tiny-skia-path path/src/transform.rs. It checks that the transform is the identity.
func (Transform) IsScale ¶
IsScale is Transform::is_scale in tiny-skia-path path/src/transform.rs. It checks that the transform only scales.
func (Transform) IsScaleTranslate ¶
IsScaleTranslate is Transform::is_scale_translate in tiny-skia-path path/src/transform.rs. It checks that the transform holds only a scale and a translation.
func (Transform) IsSkew ¶
IsSkew is Transform::is_skew in tiny-skia-path path/src/transform.rs. It checks that the transform only skews.
func (Transform) IsTranslate ¶
IsTranslate is Transform::is_translate in tiny-skia-path path/src/transform.rs. It checks that the transform only translates.
func (Transform) IsValid ¶
IsValid is Transform::is_valid in tiny-skia-path path/src/transform.rs. It checks that the transform is finite and has a scale that is not zero.
func (Transform) MapPoint ¶
MapPoint is Transform::map_point in tiny-skia-path path/src/transform.rs. It transforms a point with the transform.
func (Transform) MapPoints ¶
MapPoints is Transform::map_points in tiny-skia-path path/src/transform.rs. It transforms a slice of points with the transform.
func (Transform) PostConcat ¶
PostConcat is Transform::post_concat in tiny-skia-path path/src/transform.rs. It post-concatenates the transform.
func (Transform) PostRotate ¶
PostRotate is Transform::post_rotate in tiny-skia-path path/src/transform.rs. It post-rotates the transform.
The angle is in degrees.
func (Transform) PostRotateAt ¶
PostRotateAt is Transform::post_rotate_at in tiny-skia-path path/src/transform.rs. It post-rotates the transform around the given position.
The angle is in degrees.
func (Transform) PostScale ¶
PostScale is Transform::post_scale in tiny-skia-path path/src/transform.rs. It post-scales the transform.
func (Transform) PostTranslate ¶
PostTranslate is Transform::post_translate in tiny-skia-path path/src/transform.rs. It post-translates the transform.
func (Transform) PreConcat ¶
PreConcat is Transform::pre_concat in tiny-skia-path path/src/transform.rs. It pre-concatenates the transform.
func (Transform) PreRotate ¶
PreRotate is Transform::pre_rotate in tiny-skia-path path/src/transform.rs. It pre-rotates the transform.
The angle is in degrees.
func (Transform) PreRotateAt ¶
PreRotateAt is Transform::pre_rotate_at in tiny-skia-path path/src/transform.rs. It pre-rotates the transform around the given position.
The angle is in degrees.
func (Transform) PreScale ¶
PreScale is Transform::pre_scale in tiny-skia-path path/src/transform.rs. It pre-scales the transform.
func (Transform) PreTranslate ¶
PreTranslate is Transform::pre_translate in tiny-skia-path path/src/transform.rs. It pre-translates the transform.