Package icyllis.arc3d.core
Class Device
java.lang.Object
icyllis.arc3d.core.RefCnt
icyllis.arc3d.core.Device
- All Implemented Interfaces:
RefCounted
- Direct Known Subclasses:
GraniteDevice
,NoPixelsDevice
,RasterDevice
Base class for drawing devices.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
protected Device
createDevice
(ImageInfo info, Paint paint) Create a new device based on CreateInfo.protected void
Override this method to invoke de-allocation of the underlying resource.abstract void
drawArc
(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) abstract void
abstract void
drawCircle
(float cx, float cy, float radius, Paint paint) final void
drawGlyphRunList
(Canvas canvas, GlyphRunList glyphRunList, Paint paint) abstract void
drawImageRect
(@RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) abstract void
abstract void
abstract void
abstract void
drawPoints
(int mode, float[] pts, int offset, int count, Paint paint) abstract void
abstract void
drawRoundRect
(RoundRect rr, Paint paint) abstract void
drawVertices
(Vertices vertices, @SharedPtr Blender blender, Paint paint) final Rect2ic
final void
Return the bounds of the device in the coordinate space of this device.protected abstract Rect2ic
abstract void
getClipBounds
(Rect2i bounds) Returns the bounding box of the current clip, in this device's coordinate space.final Matrix4c
Return the device's coordinate space transform: this maps from the device's coordinate space into the global canvas' space (or root device space).final void
getGlobalBounds
(Rect2i bounds) Return the bounds of the device in the coordinate space of the root canvas.final Matrix4c
Return the inverse of getDeviceToGlobal(), mapping from the global canvas' space (or root device space) into this device's coordinate space.final int
final ImageInfo
Return image info for this device.final Matrix4c
Returns the transformation that maps from the local space to the device's coordinate space.final Matrixc
Returns the transformation that maps from the local space to the device's coordinate space.final void
getRelativeTransform
(Device device, Matrix4 dest) Get the transformation from this device's coordinate system to the provided device space.final int
getWidth()
abstract boolean
isClipAA()
abstract boolean
abstract boolean
abstract boolean
final boolean
Returns true when this device's pixel grid is axis aligned with the global coordinate space, and any relative translation between the two spaces is in integer pixel units.protected Surface
makeSurface
(ImageInfo info) protected abstract void
onDrawGlyphRunList
(Canvas canvas, GlyphRunList glyphRunList, Paint paint) abstract void
abstract void
protected final void
setDeviceCoordinateSystem
(Matrix4c deviceToGlobal, Matrix4c globalToDevice, Matrix4c localToDevice, int bufferOriginX, int bufferOriginY) Configure the device's coordinate spaces, specifying both how its device image maps back to the global space (via 'deviceToGlobal') and the initial transform of the device (via 'localToDevice', i.e.final void
setGlobalCTM
(Matrix4c ctm) final void
setLocalToDevice
(Matrix4c localToDevice)
-
Constructor Details
-
Device
-
-
Method Details
-
deallocate
protected void deallocate()Description copied from class:RefCnt
Override this method to invoke de-allocation of the underlying resource.- Specified by:
deallocate
in classRefCnt
-
getImageInfo
Return image info for this device. -
getWidth
public final int getWidth() -
getHeight
public final int getHeight() -
getBounds
- Returns:
- read-only bounds
-
getBounds
Return the bounds of the device in the coordinate space of this device. -
getGlobalBounds
Return the bounds of the device in the coordinate space of the root canvas. The root device will have its top-left at 0,0, but other devices such as those associated with saveLayer may have a non-zero origin. -
getLocalToDevice
Returns the transformation that maps from the local space to the device's coordinate space. -
getLocalToDevice33
Returns the transformation that maps from the local space to the device's coordinate space. -
getDeviceToGlobal
Return the device's coordinate space transform: this maps from the device's coordinate space into the global canvas' space (or root device space). This includes the translation necessary to account for the device's origin. -
getGlobalToDevice
Return the inverse of getDeviceToGlobal(), mapping from the global canvas' space (or root device space) into this device's coordinate space. -
isPixelAlignedToGlobal
public final boolean isPixelAlignedToGlobal()Returns true when this device's pixel grid is axis aligned with the global coordinate space, and any relative translation between the two spaces is in integer pixel units. -
getRelativeTransform
Get the transformation from this device's coordinate system to the provided device space. This transform can be used to draw this device into the provided device, such that once that device is drawn to the root device, the net effect will be that this device's contents have been transformed by the global transform. -
setGlobalCTM
-
setLocalToDevice
-
getRecordingContext
-
setDeviceCoordinateSystem
protected final void setDeviceCoordinateSystem(@Nullable Matrix4c deviceToGlobal, @Nullable Matrix4c globalToDevice, @Nullable Matrix4c localToDevice, int bufferOriginX, int bufferOriginY) Configure the device's coordinate spaces, specifying both how its device image maps back to the global space (via 'deviceToGlobal') and the initial transform of the device (via 'localToDevice', i.e. what geometry drawn into this device will be transformed with).(bufferOriginX, bufferOriginY) defines where the (0,0) pixel the device's backing buffer is anchored in the device space. The final device-to-global matrix stored by the Device will include a pre-translation by T(deviceOriginX, deviceOriginY), and the final local-to-device matrix will have a post-translation of T(-deviceOriginX, -deviceOriginY).
-
pushClipStack
public abstract void pushClipStack() -
popClipStack
public abstract void popClipStack() -
getClipBounds
Returns the bounding box of the current clip, in this device's coordinate space. No pixels outside these bounds will be touched by draws unless the clip is further modified (at which point this will return the updated bounds). -
getClipBounds
-
clipRect
-
isClipAA
public abstract boolean isClipAA() -
isClipEmpty
public abstract boolean isClipEmpty() -
isClipRect
public abstract boolean isClipRect() -
isClipWideOpen
public abstract boolean isClipWideOpen() -
drawPaint
-
drawPoints
-
drawLine
public abstract void drawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) -
drawRect
-
drawRoundRect
-
drawCircle
-
drawArc
public abstract void drawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) -
drawPie
public abstract void drawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) -
drawChord
public abstract void drawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) -
drawImageRect
-
drawGlyphRunList
-
onDrawGlyphRunList
-
drawVertices
public abstract void drawVertices(Vertices vertices, @SharedPtr @SharedPtr Blender blender, Paint paint) -
makeSurface
-
createDevice
Create a new device based on CreateInfo. If the paint is not null, then it represents a preview of how the new device will be composed with its creator device (this).The subclass may be handed this device in drawDevice(), so it must always return a device that it knows how to draw, and that it knows how to identify if it is not of the same subclass (since drawDevice is passed a BaseDevice). If the subclass cannot fulfill that contract it should return null.
-