public class PlutovgImageGenerator extends java.lang.Object implements ImageGenerator
plutovg is a software rasterizer, so unlike its two siblings this encoder has no hardware format
to satisfy: a path reaches plutovg as a sequence of function calls and a gradient as a list of
stops. What it writes is therefore what the backend reads with the least work, and
PlutovgImageDecoder reads the same bytes back for the simulator.
Its class name is load-bearing. The converter resolves this class from the string
plutovg, which the VEE Port declares in its microvg/microvg.properties.
ImageGenerator.Command, ImageGenerator.FillRule, ImageGenerator.Format| Constructor and Description |
|---|
PlutovgImageGenerator(ImageGenerator.Format format)
Creates the vector image generator that encodes the image in the format the plutovg backend
reads.
|
| Modifier and Type | Method and Description |
|---|---|
int |
encodeColor(java.awt.Color color,
float opacity)
Encodes the GPU color from a
Color and an opacity. |
int |
encodeCommand(ImageGenerator.Command command)
Encodes the GPU command from a
ImageGenerator.Command |
byte[] |
encodeGradient(LinearGradient gradient)
Encodes a linear gradient for the GPU.
|
byte[] |
encodePath(Path path)
Encodes a path for the GPU (path header + path commands + path commands parameters).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewByteBufferpublic PlutovgImageGenerator(ImageGenerator.Format format)
format - the path buffer output format requested by the VEE Port, which this generator
accepts and ignorespublic int encodeCommand(ImageGenerator.Command command)
ImageGeneratorImageGenerator.CommandencodeCommand in interface ImageGeneratorcommand - the command to convert.public int encodeColor(java.awt.Color color,
float opacity)
ImageGeneratorColor and an opacity.encodeColor in interface ImageGeneratorcolor - the color to convert.opacity - the opacity to apply, a value between 0f and 1f.public byte[] encodePath(Path path)
ImageGenerator
The Path.encode(PathData) method should be used to browse the commands of the path. These commands are
encoded by ImageGenerator.encodeCommand(Command) and append to the associated path data.
encodePath in interface ImageGeneratorpath - the path to encodepublic byte[] encodeGradient(LinearGradient gradient)
ImageGeneratorencodeGradient in interface ImageGeneratorgradient - the gradient to encode