Adrian-George Bostan d961079c5d
Add basic image rendering support (#266)
* Add render package
* Add text state
* Add more text operators
* Remove unnecessary files
* Add text font
* Add custom text render method
* Improve text rendering method
* Rename text state methods
* Refactor and document context interface
* Refact text begin/end operators
* Fix graphics state transformations
* Keep original font when doing font substitution
* Take page cropbox into account
* Revert to substitution font if original font measurement is 0
* Add font substitution package
* Implement addition transform.Point methods
* Use transform.Point in the image context package
* Remove unneeded functionality from the render image package
* Fix golint notices in the image rendering package
* Fix go vet notices in the render package
* Fix golint notices in the top-level render package
* Improve render context package documentation
* Document context text state struct.
* Document context text font struct.
* Minor logging improvements
* Add license disclaimer to the render package files
* Avoid using package aliases where possible
* Change style of section comments
* Adapt render package import style to follow the developer guide
* Improve documentation for the internal matrix implementation
* Update render package dependency versions
* Apply crop box post render
* Account for offseted media boxes
* Improve metrics of rendered characters
* Fix text matrix translation
* Change priority of fonts used for measuring rendered characters
* Skip invalid m and l operators on image rendering
* Small fix for v operator
* Fix rendered characters spacing issues
* Refactor naming of internal render packages
2020-03-02 21:22:54 +00:00

48 lines
988 B
Go

/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
*/
package context
import "image/color"
// FillRule represents the fill style used by a context instance.
type FillRule int
// Fill rules.
const (
FillRuleWinding FillRule = iota
FillRuleEvenOdd
)
// LineCap represents the line cap style used by a context instance.
type LineCap int
// Line cap styles.
const (
LineCapRound LineCap = iota
LineCapButt
LineCapSquare
)
// LineJoin represents the line join style used by a context instance.
type LineJoin int
// Line join styles.
const (
LineJoinRound LineJoin = iota
LineJoinBevel
)
// Pattern represents a pattern which can be rendered by a context instance.
type Pattern interface {
ColorAt(x, y int) color.Color
}
// Gradient represents a gradient pattern which can be rendered by a context instance.
type Gradient interface {
Pattern
AddColorStop(offset float64, color color.Color)
}