draw

package
v0.0.0-...-af996ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AntiAliasKind

type AntiAliasKind int

AntiAliasKind holds the type of anti-aliasing that is being performed.

const (
	// AntiAliasKindDefault indicates that the default anti-aliasing for the graphics subsystem and
	// target device should be used.
	AntiAliasKindDefault AntiAliasKind = C.CAIRO_ANTIALIAS_DEFAULT
	// AntiAliasKindNone indicates no anti-aliasing should be used.
	AntiAliasKindNone AntiAliasKind = C.CAIRO_ANTIALIAS_NONE
	// AntiAliasKindGray indicates a single-color anti-aliasing should be used.
	AntiAliasKindGray AntiAliasKind = C.CAIRO_ANTIALIAS_GRAY
	// AntiAliasKindSubPixel indicates anti-aliasing should be perfomed by taking advantage of the
	// order of sub-pixel elements on devices such as LCD panels.
	AntiAliasKindSubPixel AntiAliasKind = C.CAIRO_ANTIALIAS_SUBPIXEL
	// AntiAliasKindFast indicates that some anti-aliasing should be performed, but speed should be
	// preferred over quality.
	AntiAliasKindFast AntiAliasKind = C.CAIRO_ANTIALIAS_FAST
	// AntiAliasKindGood indicates that the backend should balance quality against performance.
	AntiAliasKindGood AntiAliasKind = C.CAIRO_ANTIALIAS_GOOD
	// AntiAliasKindBest indicates that the backend should render at the highest quality,
	// sacrificing speed if necessary.
	AntiAliasKindBest AntiAliasKind = C.CAIRO_ANTIALIAS_BEST
)

type CairoContentType

type CairoContentType C.cairo_content_t

CairoContentType holds the type of content for a surface.

Possible CairoContentTypes.

type CairoContext

type CairoContext *C.cairo_t

CairoContext represents the underlying Cairo graphics context pointer.

type ColorStop

type ColorStop struct {
	Color    color.Color
	Location float64
}

ColorStop provides information about the color and position of one 'color stop' in a Gradient.

func (ColorStop) String

func (cs ColorStop) String() string

String implements the fmt.Stringer interface.

type FillRule

type FillRule int

FillRule holds the type of fill rule to use when filling paths.

const (
	// FillRuleWinding uses this algorithm: if the path crosses the ray from left-to-right, counts
	// +1. If the path crosses the ray from right to left, counts -1. Left and right are determined
	// from the perspective of looking along the ray from the starting point. If the total count
	// is non-zero, the point will be filled.
	FillRuleWinding FillRule = C.CAIRO_FILL_RULE_WINDING
	// FillRuleEvenOdd uses this algorithm: counts the total number of intersections, without regard
	// to the orientation of the contour. If the total number of intersections is odd, the point
	// will be filled.
	FillRuleEvenOdd FillRule = C.CAIRO_FILL_RULE_EVEN_ODD
)

type FilterMode

type FilterMode int

FilterMode defines the type of filtering to be used when reading pixel values.

const (
	// FilterModeFast provides a high-performance filter, with quality similar to FilterModeNearest.
	FilterModeFast FilterMode = C.CAIRO_FILTER_FAST
	// FilterModeGood provides a reasonable-performance filter, with quality similar to
	// FilterModeBilinear.
	FilterModeGood FilterMode = C.CAIRO_FILTER_GOOD
	// FilterModeBest provides the highest quality filter available, but performance may not be
	// suitable for interactive use.
	FilterModeBest FilterMode = C.CAIRO_FILTER_BEST
	// FilterModeNearest provides a nearest-neighbor filter.
	FilterModeNearest FilterMode = C.CAIRO_FILTER_NEAREST
	// FilterModeBilinear provides linear interpolation in two dimensions.
	FilterModeBilinear FilterMode = C.CAIRO_FILTER_BILINEAR
)

type Gradient

type Gradient struct {
	Stops []ColorStop
}

Gradient defines a smooth transition between colors across an area.

func NewEvenlySpacedGradient

func NewEvenlySpacedGradient(colors ...color.Color) *Gradient

NewEvenlySpacedGradient creates a new gradient with the specified colors evenly spread across the whole range.

func NewGradient

func NewGradient(stops ...ColorStop) *Gradient

NewGradient creates a new gradient.

func (*Gradient) Reversed

func (g *Gradient) Reversed() *Gradient

Reversed creates a copy of the current Gradient and inverts the locations of each color stop in that copy.

func (*Gradient) String

func (g *Gradient) String() string

String implements the fmt.Stringer interface.

type Graphics

type Graphics struct {
	// contains filtered or unexported fields
}

Graphics provides a graphics context for drawing into.

func NewGraphics

func NewGraphics(cc CairoContext) *Graphics

NewGraphics creates a new Graphics object with a Cairo graphics context.

func (*Graphics) AddPath

func (gc *Graphics) AddPath(path *Path)

AddPath adds a previously created Path object to the current path.

func (*Graphics) AntiAlias

func (gc *Graphics) AntiAlias() AntiAliasKind

AntiAlias returns the current anti-aliasing mode.

func (*Graphics) Arc

func (gc *Graphics) Arc(cx, cy, radius, startAngleRadians, endAngleRadians float64, clockwise bool)

Arc adds an arc of a circle to the current path, possibly preceded by a straight line segment.

func (*Graphics) BeginPath

func (gc *Graphics) BeginPath()

BeginPath creates a new empty path in the context.

func (*Graphics) BeginSubPath

func (gc *Graphics) BeginSubPath()

BeginSubPath creates a new empty sub-path in the context. Any existing path is not affected.

func (*Graphics) Clip

func (gc *Graphics) Clip()

Clip establishes a new clip region by intersecting the current clip region with the current path as it would be filled by Fill() and according to the current FillRule. After Clip(), the current path will be cleared from the context. The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region. Calling Clip() can only make the clip region smaller, never larger. The current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling Clip() within a Save()/Restore() pair. The only other means of increasing the size of the clip region is ResetClip().

func (*Graphics) ClipPreserve

func (gc *Graphics) ClipPreserve()

ClipPreserve operates as Clip(), but does not clear the path from the context.

func (*Graphics) ClosePath

func (gc *Graphics) ClosePath()

ClosePath closes and terminates the current path’s subpath.

func (*Graphics) CompositingOperator

func (gc *Graphics) CompositingOperator() compositing.Op

CompositingOperator returns the current compositing operator.

func (*Graphics) CurveTo

func (gc *Graphics) CurveTo(cp1x, cp1y, cp2x, cp2y, x, y float64)

CurveTo appends a cubic Bezier curve from the current point, using the provided controls points and end point.

func (*Graphics) Dash

func (gc *Graphics) Dash() (segments []float64, offset float64)

Dash returns the current dash settings.

func (*Graphics) DeviceToUser

func (gc *Graphics) DeviceToUser(ux, uy float64) (x, y float64)

DeviceToUser converts the device-space coordinates to user-space.

func (*Graphics) DeviceToUserDistance

func (gc *Graphics) DeviceToUserDistance(uw, uh float64) (w, h float64)

DeviceToUserDistance converts the device-space distance to user-space.

func (*Graphics) Dispose

func (gc *Graphics) Dispose()

Dispose of the underlying Cairo graphics context

func (*Graphics) DrawImage

func (gc *Graphics) DrawImage(img *Image, where geom.Point)

DrawImage at the specified location.

func (*Graphics) DrawImageInRect

func (gc *Graphics) DrawImageInRect(img *Image, bounds geom.Rect)

DrawImageInRect draws the image in the bounds, scaling if necessary.

func (*Graphics) DrawString

func (gc *Graphics) DrawString(x, y float64, str string, f *font.Font)

DrawString at the specified location using the current font and fill color.

func (*Graphics) Ellipse

func (gc *Graphics) Ellipse(bounds geom.Rect)

Ellipse appends an ellipse to the current path.

func (*Graphics) FillClip

func (gc *Graphics) FillClip()

FillClip uses the current Paint to fill the entire clip region.

func (*Graphics) FillClipWithAlpha

func (gc *Graphics) FillClipWithAlpha(alpha float64)

FillClipWithAlpha uses the current Paint to cover the entire clip region, but with the specified 'alpha' value applied.

func (*Graphics) FillEllipse

func (gc *Graphics) FillEllipse(bounds geom.Rect)

FillEllipse fills an ellipse in the specified bounds.

func (*Graphics) FillPath

func (gc *Graphics) FillPath()

FillPath fills the current path, then clears the current path state.

func (*Graphics) FillPathPreserve

func (gc *Graphics) FillPathPreserve()

FillPathPreserve fills the current path without clearing the current path state.

func (*Graphics) FillRect

func (gc *Graphics) FillRect(bounds geom.Rect)

FillRect fills a rectangle in the specified bounds.

func (*Graphics) FillRule

func (gc *Graphics) FillRule() FillRule

FillRule returns the current FillRule.

func (*Graphics) InClip

func (gc *Graphics) InClip(x, y float64) bool

InClip returns true if the specific location would be visible through the current clip.

func (*Graphics) InFill

func (gc *Graphics) InFill(x, y float64) bool

InFill returns true if the specific location would be inside the area affected by FillPath() or FillPathPreserve(). Note that the clip area is not taken into account.

func (*Graphics) InStroke

func (gc *Graphics) InStroke(x, y float64) bool

InStroke returns true if the specific location would be inside the area affected by StrokePath() or StrokePathPreserve(). Note that the clip area is not taken into account.

func (*Graphics) LineCap

func (gc *Graphics) LineCap() LineCap

LineCap returns the current LineCap.

func (*Graphics) LineJoin

func (gc *Graphics) LineJoin() LineJoin

LineJoin returns the current LineJoin.

func (*Graphics) LineTo

func (gc *Graphics) LineTo(x, y float64)

LineTo appends a straight line segment from the current point to the specified point.

func (*Graphics) MaskClipWithImage

func (gc *Graphics) MaskClipWithImage(mask *Image, dx, dy float64)

MaskClipWithImage uses the current Paint to cover the entire clip region, but uses the alpha channel of 'mask' as a mask (i.e. opaque areas of 'mask' are painted with the current Paint, transparent areas are not painted). The image's mask will be offset by 'dx' and 'dy'.

func (*Graphics) MaskClipWithPaint

func (gc *Graphics) MaskClipWithPaint(mask *Paint)

MaskClipWithPaint uses the current Paint to cover the entire clip region, but uses the alpha channel of 'mask' as a mask (i.e. opaque areas of 'mask' are painted with the current Paint, transparent areas are not painted).

func (*Graphics) Matrix

func (gc *Graphics) Matrix() *xmath.Matrix2D

Matrix returns the current transformation matrix.

func (*Graphics) MiterLimit

func (gc *Graphics) MiterLimit() float64

MiterLimit returns the current miter limit.

func (*Graphics) MoveTo

func (gc *Graphics) MoveTo(x, y float64)

MoveTo begins a new subpath at the specified point.

func (*Graphics) Paint

func (gc *Graphics) Paint() *Paint

Paint returns a copy of the current paint. You are responsible for calling its Dispose() method.

func (*Graphics) PopGroup

func (gc *Graphics) PopGroup() *Paint

PopGroup terminates the redirection begun by a call to PushGroup and returns a new Paint containing the results of all drawing operations performed to the group.

func (*Graphics) PopGroupToPaint

func (gc *Graphics) PopGroupToPaint()

PopGroupToPaint terminates the redirection begun by a call to PushGroup and installs the resulting Paint as the current source paint.

func (*Graphics) PushGroup

func (gc *Graphics) PushGroup()

PushGroup temporarily redirects drawing to an intermediate surface known as a group. The redirection lasts until the group is completed by a call to PopGroup() or PopGroupToSource(). Groups can be nested arbitrarily deep.

func (*Graphics) QuadCurveTo

func (gc *Graphics) QuadCurveTo(cpx, cpy, x, y float64)

QuadCurveTo appends a quadratic Bezier curve from the current point, using a control point and an end point.

func (*Graphics) Rect

func (gc *Graphics) Rect(bounds geom.Rect)

Rect appends a rectangle to the current path.

func (*Graphics) ResetClip

func (gc *Graphics) ResetClip()

ResetClip resets the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape containing the target surface. Note that code meant to be reusable should not call ResetClip() as it will cause results unexpected by higher-level code which calls Clip(). Consider using Save() and Restore() around Clip() as a more robust means of temporarily restricting the clip region.

func (*Graphics) Restore

func (gc *Graphics) Restore()

Restore sets the current graphics state to the state most recently saved by call to Save().

func (*Graphics) Rotate

func (gc *Graphics) Rotate(angleInRadians float64)

Rotate the coordinate system.

func (*Graphics) Save

func (gc *Graphics) Save()

Save pushes a copy of the current graphics state onto the stack for the context. The current path is not saved as part of this call.

func (*Graphics) Scale

func (gc *Graphics) Scale(x, y float64)

Scale the coordinate system.

func (*Graphics) SetAntiAlias

func (gc *Graphics) SetAntiAlias(kind AntiAliasKind)

SetAntiAlias sets the anti-aliasing mode of the rasterizer used for drawing shapes. This value is a hint and a particular backend may or may not support a particular value. Note that this option does not affect text rendering.

func (*Graphics) SetColor

func (gc *Graphics) SetColor(color color.Color)

SetColor sets the current paint with a color.

func (*Graphics) SetCompositingOperator

func (gc *Graphics) SetCompositingOperator(op compositing.Op)

SetCompositingOperator sets the current compositing operator.

func (*Graphics) SetDash

func (gc *Graphics) SetDash(segments []float64, offset float64)

SetDash sets the dash pattern to be used when stroking. A dash pattern is specified by an array of positive values. Each value provides the length of alternate "on" and "off" portions of the stroke. The offset specifies an offset into the pattern at which the stroke begins. Each "on" segment will have caps applied as if the segment were a separate sub-path. In particular, it is valid to use an "on" length of 0 with LineCapRound or LineCapSquare in order to distribute dots or squares along a path. Note: The length values are in user-space units as evaluated at the time of stroking. This is not necessarily the same as the user space at the time of SetDash(). If 'segments' is nil, dashing is disabled. If 'segments' only contains one value, a symmetric pattern is assumed with alternating on and off portions of the size specified by the single value. If any value in 'segments' is negative, or if all values are 0, this call will be ignored.

func (*Graphics) SetFillRule

func (gc *Graphics) SetFillRule(rule FillRule)

SetFillRule sets the current FillRule.

func (*Graphics) SetIdentityMatrix

func (gc *Graphics) SetIdentityMatrix()

SetIdentityMatrix sets the current transformation matrix to the identity matrix.

func (*Graphics) SetImage

func (gc *Graphics) SetImage(img *Image, dx, dy float64)

SetImage sets the current paint with a tiled image. 'dx' and 'dy' specify the amount to offset the image pattern.

func (*Graphics) SetLineCap

func (gc *Graphics) SetLineCap(cap LineCap)

SetLineCap sets the current LineCap.

func (*Graphics) SetLineJoin

func (gc *Graphics) SetLineJoin(cap LineJoin)

SetLineJoin sets the current LineJoin.

func (*Graphics) SetMatrix

func (gc *Graphics) SetMatrix(matrix *xmath.Matrix2D)

SetMatrix sets the current transformation matrix.

func (*Graphics) SetMiterLimit

func (gc *Graphics) SetMiterLimit(limit float64)

SetMiterLimit sets the current miter limit.

func (*Graphics) SetPaint

func (gc *Graphics) SetPaint(paint *Paint)

SetPaint sets the current paint.

func (*Graphics) SetStrokeWidth

func (gc *Graphics) SetStrokeWidth(width float64)

SetStrokeWidth sets the current stroke width.

func (*Graphics) SetSurface

func (gc *Graphics) SetSurface(surface *Surface, dx, dy float64)

SetSurface sets the current paint with a surface. 'dx' and 'dy' specify the amount to offset the surface pattern.

func (*Graphics) StrokeEllipse

func (gc *Graphics) StrokeEllipse(bounds geom.Rect)

StrokeEllipse draws an ellipse in the specified bounds. To ensure the ellipse is aligned to pixel boundaries, 0.5 is added to the origin coordinates and 1 is subtracted from the size values.

func (*Graphics) StrokeLine

func (gc *Graphics) StrokeLine(x1, y1, x2, y2 float64)

StrokeLine draws a line between two points. To ensure the line is aligned to pixel boundaries, 0.5 is added to each coordinate.

func (*Graphics) StrokePath

func (gc *Graphics) StrokePath()

StrokePath strokes the current path, then clears the current path state.

func (*Graphics) StrokePathPreserve

func (gc *Graphics) StrokePathPreserve()

StrokePathPreserve strokes the current path without clearing the current path state.

func (*Graphics) StrokeRect

func (gc *Graphics) StrokeRect(bounds geom.Rect)

StrokeRect draws a rectangle in the specified bounds. To ensure the rectangle is aligned to pixel boundaries, 0.5 is added to the origin coordinates and 1 is subtracted from the size values.

func (*Graphics) StrokeWidth

func (gc *Graphics) StrokeWidth() float64

StrokeWidth returns the current stroke width.

func (*Graphics) Transform

func (gc *Graphics) Transform(matrix *xmath.Matrix2D)

Transform the coordinate system by the matrix.

func (*Graphics) Translate

func (gc *Graphics) Translate(x, y float64)

Translate the coordinate system.

func (*Graphics) UserToDevice

func (gc *Graphics) UserToDevice(ux, uy float64) (x, y float64)

UserToDevice converts the user-space coordinates to device-space.

func (*Graphics) UserToDeviceDistance

func (gc *Graphics) UserToDeviceDistance(uw, uh float64) (w, h float64)

UserToDeviceDistance converts the user-space distance to device-space.

type Image

type Image struct {
	object.Base
	// contains filtered or unexported fields
}

Image represents a set of pixels that can be drawn to a graphics.Context.

func AcquireImageFromData

func AcquireImageFromData(data *ImageData) *Image

AcquireImageFromData creates a new image from the specified data.

func AcquireImageFromFile

func AcquireImageFromFile(fs http.FileSystem, path string) (img *Image, err error)

AcquireImageFromFile attempts to load an image from the file system.

func AcquireImageFromID

func AcquireImageFromID(id uint64) *Image

AcquireImageFromID attempts to find an already loaded image by its ID and return it. Returns nil if it cannot be found.

func AcquireImageFromURL

func AcquireImageFromURL(url string) (img *Image, err error)

AcquireImageFromURL attempts to load an image from a URL.

func NewImage

func NewImage(width, height int) *Image

NewImage creates a new image.

func (*Image) AcquireDisabled

func (img *Image) AcquireDisabled() *Image

AcquireDisabled returns an image based on this image which is desaturated and ghosted to represent a disabled state.

func (*Image) AcquireImageArea

func (img *Image) AcquireImageArea(bounds geom.Rect) *Image

AcquireImageArea creates a new image from an area within this image.

func (*Image) Data

func (img *Image) Data() *ImageData

Data extracts the raw image data.

func (*Image) DataFromArea

func (img *Image) DataFromArea(bounds geom.Rect) *ImageData

DataFromArea extracts the raw image data from an area within an image.

func (*Image) NewCairoContext

func (img *Image) NewCairoContext() CairoContext

NewCairoContext creates a new CairoContext.

func (*Image) Release

func (img *Image) Release()

Release releases the image. If no other client is using the image, then the underlying OS resources for the image will be disposed of.

func (*Image) Size

func (img *Image) Size() geom.Size

Size returns the size of the image.

func (*Image) String

func (img *Image) String() string

type ImageData

type ImageData struct {
	Width  int
	Height int
	Pixels []color.Color
}

ImageData is the raw information that makes up an Image.

func (*ImageData) At

func (img *ImageData) At(x, y int) gocolor.Color

At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one. (Implementation of image.Image)

func (*ImageData) Bounds

func (img *ImageData) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0). (Implementation of image.Image)

func (*ImageData) ColorModel

func (img *ImageData) ColorModel() gocolor.Model

ColorModel returns the Image's color model. (Implementation of image.Image)

type LineCap

type LineCap int

LineCap indicates how to render the endpoints of a path when stroking it.

const (
	LineCapButt   LineCap = C.CAIRO_LINE_CAP_BUTT
	LineCapRound  LineCap = C.CAIRO_LINE_CAP_ROUND
	LineCapSquare LineCap = C.CAIRO_LINE_CAP_SQUARE
)

Possible line caps.

type LineJoin

type LineJoin int

LineJoin indicates how to join the endpoints of a path when stroking it.

const (
	LineJoinMiter LineJoin = C.CAIRO_LINE_JOIN_MITER
	LineJoinRound LineJoin = C.CAIRO_LINE_JOIN_ROUND
	LineJoinBevel LineJoin = C.CAIRO_LINE_JOIN_BEVEL
)

Possible line joins.

type Paint

type Paint struct {
	// contains filtered or unexported fields
}

Paint holds patterns used when filling and stroking paths.

func NewColorPaint

func NewColorPaint(color color.Color) *Paint

NewColorPaint creates a new Paint from a color.

func NewImagePaint

func NewImagePaint(img *Image) *Paint

NewImagePaint creates a new Paint from an image.

func NewLinearGradientPaint

func NewLinearGradientPaint(gradient *Gradient, sx, sy, ex, ey float64) *Paint

NewLinearGradientPaint creates a new Paint from a gradient that is spread across the specified line.

func NewRadialGradientPaint

func NewRadialGradientPaint(gradient *Gradient, scx, scy, startRadius, ecx, ecy, endRadius float64) *Paint

NewRadialGradientPaint creates a new Paint from a gradient that radiates from one circle to another.

func (*Paint) Dispose

func (p *Paint) Dispose()

Dispose releases the underlying resources used by this Paint.

func (*Paint) FilterMode

func (p *Paint) FilterMode() FilterMode

FilterMode returns the FilterMode of this Paint.

func (*Paint) Kind

func (p *Paint) Kind() PaintKind

Kind returns the PaintKind of this Paint.

func (*Paint) Matrix

func (p *Paint) Matrix() *xmath.Matrix2D

Matrix returns the Matrix of this Paint.

func (*Paint) PaintMode

func (p *Paint) PaintMode() PaintMode

PaintMode returns the PaintMode of this Paint.

func (*Paint) SetFilterMode

func (p *Paint) SetFilterMode(mode FilterMode)

SetFilterMode sets the FilterMode of this Paint.

func (*Paint) SetMatrix

func (p *Paint) SetMatrix(matrix *xmath.Matrix2D)

SetMatrix sets the Matrix of this Paint.

func (*Paint) SetPaintMode

func (p *Paint) SetPaintMode(mode PaintMode)

SetPaintMode sets the PaintMode of this Paint.

type PaintKind

type PaintKind int

PaintKind defines the possible types of Paint.

const (
	PaintKindColor          PaintKind = C.CAIRO_PATTERN_TYPE_SOLID
	PaintKindImage          PaintKind = C.CAIRO_PATTERN_TYPE_SURFACE
	PaintKindLinearGradient PaintKind = C.CAIRO_PATTERN_TYPE_LINEAR
	PaintKindRadialGradient PaintKind = C.CAIRO_PATTERN_TYPE_RADIAL
)

PaintKind possibilities.

type PaintMode

type PaintMode int

PaintMode defines how pixels outside a pattern's space are filled in.

const (
	// PaintModeNone pixels outside of the pattern are fully transparent.
	PaintModeNone PaintMode = C.CAIRO_EXTEND_NONE
	// PaintModeRepeat the pattern is tiled by repeating.
	PaintModeRepeat PaintMode = C.CAIRO_EXTEND_REPEAT
	// PaintModeReflect the pattern is tiled by reflecting at the edges.
	PaintModeReflect PaintMode = C.CAIRO_EXTEND_REFLECT
	// PaintModePad pixels outside of the pattern copy the closest pixel from the source.
	PaintModePad PaintMode = C.CAIRO_EXTEND_PAD
)

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path is a description of a series of shapes or lines.

func NewPath

func NewPath() *Path

NewPath creates a new, empty Path.

func (*Path) Append

func (p *Path) Append(other *Path)

Append the other path to the end of this path.

func (*Path) Arc

func (p *Path) Arc(cx, cy, radius, startAngleRadians, endAngleRadians float64, clockwise bool)

Arc adds an arc of a circle to the current path, possibly preceded by a straight line segment.

func (*Path) BeginSubPath

func (p *Path) BeginSubPath()

BeginSubPath creates a new empty sub-path. Any existing path is not affected.

func (*Path) ClosePath

func (p *Path) ClosePath()

ClosePath closes and terminates the current path’s subpath.

func (*Path) Copy

func (p *Path) Copy() *Path

Copy copies this path's contents into a new path.

func (*Path) CurveTo

func (p *Path) CurveTo(cp1x, cp1y, cp2x, cp2y, x, y float64)

CurveTo appends a cubic Bezier curve from the current point, using the provided controls points and end point.

func (*Path) Ellipse

func (p *Path) Ellipse(bounds geom.Rect)

Ellipse adds an ellipse to the path. The ellipse is a complete subpath, i.e. it starts with a MoveTo and ends with a ClosePath operation.

func (*Path) LineTo

func (p *Path) LineTo(x, y float64)

LineTo appends a straight line segment from the current point to the specified point.

func (*Path) MoveTo

func (p *Path) MoveTo(x, y float64)

MoveTo begins a new subpath at the specified point.

func (*Path) QuadCurveTo

func (p *Path) QuadCurveTo(cpx, cpy, x, y float64)

QuadCurveTo appends a quadratic Bezier curve from the current point, using a control point and an end point.

func (*Path) Rect

func (p *Path) Rect(bounds geom.Rect)

Rect adds a rectangle to the path. The rectangle is a complete subpath, i.e. it starts with a MoveTo and ends with a ClosePath operation.

type Surface

type Surface struct {
	// contains filtered or unexported fields
}

Surface holds the content of a drawing surface.

func NewSurface

func NewSurface(surface unsafe.Pointer, size geom.Size) *Surface

func (*Surface) CreateSimilar

func (surface *Surface) CreateSimilar(contentType CairoContentType, size geom.Size) *Surface

CreateSimilar creates a new surface similar to this surface, but with the specified content type and size.

func (*Surface) Destroy

func (surface *Surface) Destroy()

Destroy a surface.

func (*Surface) NewCairoContext

func (surface *Surface) NewCairoContext() CairoContext

NewCairoContext creates a new CairoContext.

func (*Surface) SetSize

func (surface *Surface) SetSize(size geom.Size)

func (*Surface) Size

func (surface *Surface) Size() geom.Size

Size returns the size in pixels of the surface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL