Documentation
¶
Index ¶
- func Render(src io.Reader) (image.Image, error)
- type Canvas
- func (cv *Canvas) AddFont(font pango.Font, content []byte) *backend.Font
- func (cv *Canvas) ClosePath()
- func (cv *Canvas) CubicTo(x1, y1, x2, y2, x3, y3 Fl)
- func (cv *Canvas) DrawGradient(gradient backend.GradientLayout, width backend.Fl, height backend.Fl)
- func (cv *Canvas) DrawRasterImage(image backend.RasterImage, width backend.Fl, height backend.Fl)
- func (cv *Canvas) DrawText(texts []backend.TextDrawing)
- func (cv *Canvas) DrawWithOpacity(opacity backend.Fl, group backend.Canvas)
- func (cv *Canvas) GetRectangle() (left, top, right, bottom backend.Fl)
- func (cv *Canvas) LineTo(x, y Fl)
- func (cv *Canvas) MoveTo(x, y Fl)
- func (cv *Canvas) NewGroup(x backend.Fl, y backend.Fl, width backend.Fl, height backend.Fl) backend.Canvas
- func (cv *Canvas) OnNewStack(f func())
- func (cv *Canvas) Paint(op backend.PaintOp)
- func (cv *Canvas) Rectangle(x backend.Fl, y backend.Fl, width backend.Fl, height backend.Fl)
- func (cv *Canvas) State() backend.GraphicState
- type Fl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
func (*Canvas) AddFont ¶
AddFont register a new font to be used in the output and return an object used to store associated metadata. This method will be called several times with the same `font` argument, so caching is advised.
func (*Canvas) DrawGradient ¶
func (cv *Canvas) DrawGradient(gradient backend.GradientLayout, width backend.Fl, height backend.Fl)
DrawGradient draws the given gradient at the current point. Solid gradient are already handled, meaning that only linear and radial must be taken care of.
func (*Canvas) DrawRasterImage ¶
DrawRasterImage draws the given image at the current point, with the given dimensions. Typical format for image.Content are PNG, JPEG, GIF.
func (*Canvas) DrawText ¶
func (cv *Canvas) DrawText(texts []backend.TextDrawing)
DrawText draws the given text using the current fill color. The rendering may be altered by a preivous `SetTextPaint` call. The fonts of the runs have been registred with `AddFont`.
func (*Canvas) DrawWithOpacity ¶
DrawWithOpacity draw the given target to the main target, applying the given opacity (in [0,1]).
func (*Canvas) GetRectangle ¶
Returns the current canvas rectangle
func (*Canvas) NewGroup ¶
func (cv *Canvas) NewGroup(x backend.Fl, y backend.Fl, width backend.Fl, height backend.Fl) backend.Canvas
NewGroup creates a new drawing target with the given bounding box. It may be filled by graphic operations before being passed to the `DrawWithOpacity`, `SetColorPattern` and `DrawAsMask` methods.
func (*Canvas) OnNewStack ¶
func (cv *Canvas) OnNewStack(f func())
OnNewStack save the current graphic stack, execute the given closure, and restore the stack.
func (*Canvas) Paint ¶
Paint actually shows the current path on the target, either stroking, filling or doing both, according to `op`. The result of the operation depends on the current fill and stroke settings. After this call, the current path will be cleared.
func (*Canvas) Rectangle ¶
Adds a rectangle of the given size to the current path, at position “(x, y)“ in user-space coordinates. (X,Y) coordinates are the top left corner of the rectangle. Note that this method may be expressed using MoveTo and LineTo, but may be implemented more efficiently.
func (*Canvas) State ¶
func (cv *Canvas) State() backend.GraphicState