Documentation ¶
Index ¶
- Constants
- func DrawImage(dst, src *ebiten.Image, colorM ColorM, op *DrawImageOptions)
- func DrawTriangles(dst *ebiten.Image, vertices []ebiten.Vertex, indices []uint16, ...)
- type ColorM
- func (c *ColorM) Apply(clr color.Color) color.Color
- func (c *ColorM) ChangeHSV(hueTheta float64, saturationScale float64, valueScale float64)
- func (c *ColorM) Concat(other ColorM)
- func (c *ColorM) Element(i, j int) float64
- func (c *ColorM) Invert()
- func (c *ColorM) IsInvertible() bool
- func (c *ColorM) ReadElements(body []float32, translation []float32)
- func (c *ColorM) Reset()
- func (c *ColorM) RotateHue(theta float64)
- func (c *ColorM) Scale(r, g, b, a float64)
- func (c *ColorM) ScaleWithColor(clr color.Color)
- func (c *ColorM) SetElement(i, j int, element float64)
- func (c *ColorM) String() string
- func (c *ColorM) Translate(r, g, b, a float64)
- type DrawImageOptions
- type DrawTrianglesOptions
Constants ¶
const Dim = affine.ColorMDim
Dim is a dimension of a ColorM.
Variables ¶
This section is empty.
Functions ¶
func DrawImage ¶
func DrawImage(dst, src *ebiten.Image, colorM ColorM, op *DrawImageOptions)
DrawImage draws src onto dst.
DrawImage is basically the same as ebiten.DrawImage, but with a color matrix.
func DrawTriangles ¶
func DrawTriangles(dst *ebiten.Image, vertices []ebiten.Vertex, indices []uint16, img *ebiten.Image, colorM ColorM, op *DrawTrianglesOptions)
DrawTriangles draws triangles onto dst.
DrawTriangles is basically the same as ebiten.DrawTriangles, but with a color matrix.
Types ¶
type ColorM ¶
type ColorM struct {
// contains filtered or unexported fields
}
ColorM represents a matrix to transform coloring when rendering an image.
ColorM is applied to the straight alpha color while an Image's pixels' format is alpha premultiplied. Before applying a matrix, a color is un-multiplied, and after applying the matrix, the color is multiplied again.
The initial value is identity.
func (*ColorM) Apply ¶
Apply pre-multiplies a vector (r, g, b, a, 1) by the matrix where r, g, b, and a are clr's values in straight-alpha format. In other words, Apply calculates ColorM * (r, g, b, a, 1)^T.
func (*ColorM) ChangeHSV ¶
ChangeHSV changes HSV (Hue-Saturation-Value) values. hueTheta is a radian value to rotate hue. saturationScale is a value to scale saturation. valueScale is a value to scale value (a.k.a. brightness).
This conversion uses RGB to/from YCrCb conversion.
func (*ColorM) Concat ¶
Concat multiplies a color matrix with the other color matrix. This is same as muptiplying the matrix other and the matrix c in this order.
func (*ColorM) Invert ¶
func (c *ColorM) Invert()
Invert inverts the matrix. If c is not invertible, Invert panics.
func (*ColorM) IsInvertible ¶
IsInvertible returns a boolean value indicating whether the matrix c is invertible or not.
func (*ColorM) ReadElements ¶
ReadElements reads the body part and the translation part to the given float32 slices.
len(body) must be 16 and len(translation) must be 4. Otherwise, ReadElements panics.
func (*ColorM) ScaleWithColor ¶
ScaleWithColor scales the matrix by clr.
func (*ColorM) SetElement ¶
SetElement sets an element at (i, j).
type DrawImageOptions ¶
type DrawImageOptions struct { // GeoM is a geometry matrix to draw. // The default (zero) value is identity, which draws the image at (0, 0). GeoM ebiten.GeoM // Blend is a blending way of the source color and the destination color. // The default (zero) value is the regular alpha blending. Blend ebiten.Blend // Filter is a type of texture filter. // The default (zero) value is ebiten.FilterNearest. Filter ebiten.Filter }
DrawImageOptions represents options for DrawImage.
type DrawTrianglesOptions ¶
type DrawTrianglesOptions struct { // ColorScaleMode is the mode of color scales in vertices. // The default (zero) value is ebiten.ColorScaleModeStraightAlpha. ColorScaleMode ebiten.ColorScaleMode // Blend is a blending way of the source color and the destination color. // The default (zero) value is the regular alpha blending. Blend ebiten.Blend // Filter is a type of texture filter. // The default (zero) value is ebiten.FilterNearest. Filter ebiten.Filter // Address is a sampler address mode. // The default (zero) value is ebiten.AddressUnsafe. Address ebiten.Address // FillRule indicates the rule how an overlapped region is rendered. // // The rule EvenOdd is useful when you want to render a complex polygon. // A complex polygon is a non-convex polygon like a concave polygon, a polygon with holes, or a self-intersecting polygon. // See examples/vector for actual usages. // // The default (zero) value is ebiten.FillAll. FillRule ebiten.FillRule // AntiAlias indicates whether the rendering uses anti-alias or not. // AntiAlias is useful especially when you pass vertices from the vector package. // // AntiAlias increases internal draw calls and might affect performance. // Use the build tag `ebitenginedebug` to check the number of draw calls if you care. // // The default (zero) value is false. AntiAlias bool }
DrawTrianglesOptions represents options for DrawTriangles.