Package icyllis.arc3d.granite

# Class GraniteDevice

java.lang.Object
icyllis.arc3d.core.RefCnt
icyllis.arc3d.core.Device
icyllis.arc3d.granite.GraniteDevice

All Implemented Interfaces:
  `RefCounted`

public final class GraniteDevice extends Device
The device that is backed by GPU.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clipRect(Rect2fc rect, int clipOp, boolean doAA)`
  `protected void`
  `deallocate()`
  Override this method to invoke de-allocation of the underlying resource.
  `void`
  `discardRC()`
  `void`
  `drawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint)`
  `void`
  `drawAtlasSubRun(SubRunContainer.AtlasSubRun subRun, float originX, float originY, Paint paint)`
  `void`
  `drawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint)`
  `void`
  `drawCircle(float cx, float cy, float radius, Paint paint)`
  `void`
  `drawClipShape(Draw draw, boolean inverseFill)`
  `<GEO> void`
  `drawGeometry(Matrixc localToDevice, GEO geometry, BiConsumer<GEO,Rect2f> boundsFn, Paint paint, GeometryRenderer renderer, @SharedPtr Blender primitiveBlender)`
  `void`
  `drawImageRect(@RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint)`
  `void`
  `drawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint)`
  `void`
  `drawPaint(Paint paint)`
  `void`
  `drawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint)`
  `void`
  `drawPoints(int mode, float[] pts, int offset, int count, Paint paint)`
  `void`
  `drawRect(Rect2fc r, Paint paint)`
  `void`
  `drawRoundRect(RoundRect rr, Paint paint)`
  `void`
  `drawVertices(Vertices vertices, @SharedPtr Blender blender, Paint paint)`
  `void`
  `flushPendingWork()`
  Ensures clip elements are drawn that will clip previous draw calls, snaps all pending work from the `SurfaceDrawContext` as a `RenderPassTask` and records it in the `GraniteDevice`'s `RecordingContext`.
  `protected Rect2ic`
  `getClipBounds()`
  `void`
  `getClipBounds(Rect2i bounds)`
  Returns the bounding box of the current clip, in this device's coordinate space.
  `ClipStack`
  `getClipStack()`
  `@RawPtr ImageViewProxy`
  `getReadView()`
  `RecordingContext`
  `getRecordingContext()`
  `boolean`
  `isClipAA()`
  `boolean`
  `isClipEmpty()`
  `boolean`
  `isClipRect()`
  `boolean`
  `isClipWideOpen()`
  `static @SharedPtr GraniteDevice`
  `make(@RawPtr RecordingContext rc, ImageInfo deviceInfo, int surfaceFlags, int origin, byte initialLoadOp, String label, boolean trackDevice)`
  `static @SharedPtr GraniteDevice`
  `make(@RawPtr RecordingContext rc, @SharedPtr ImageViewProxy targetView, ImageInfo deviceInfo, byte initialLoadOp, boolean trackDevice)`
  `@SharedPtr GraniteImage`
  `makeImageCopy(Rect2ic subset, boolean budgeted, boolean mipmapped, boolean approxFit)`
  `protected void`
  `onDrawGlyphRunList(Canvas canvas, GlyphRunList glyphRunList, Paint paint)`
  `void`
  `popClipStack()`
  `void`
  `pushClipStack()`
  `void`
  `setImmutable()`

  ### Methods inherited from class icyllis.arc3d.core.Device

  `createDevice, drawGlyphRunList, getBounds, getBounds, getDeviceToGlobal, getGlobalBounds, getGlobalToDevice, getHeight, getImageInfo, getLocalToDevice, getLocalToDevice33, getRelativeTransform, getWidth, isPixelAlignedToGlobal, makeSurface, setDeviceCoordinateSystem, setGlobalCTM, setLocalToDevice`

  ### Methods inherited from class icyllis.arc3d.core.RefCnt

  `create, create, getRefCnt, getRefCntAcquire, getRefCntVolatile, move, move, ref, unique, unref`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### make

    @Nullable @SharedPtr public static @SharedPtr GraniteDevice make(@RawPtr @RawPtr RecordingContext rc, @Nonnull ImageInfo deviceInfo, int surfaceFlags, int origin, byte initialLoadOp, String label, boolean trackDevice)

  - ### make

    @Nullable @SharedPtr public static @SharedPtr GraniteDevice make(@RawPtr @RawPtr RecordingContext rc, @SharedPtr @SharedPtr ImageViewProxy targetView, ImageInfo deviceInfo, byte initialLoadOp, boolean trackDevice)

  - ### deallocate

    protected void deallocate()
    Description copied from class: `RefCnt`
    Override this method to invoke de-allocation of the underlying resource.
    Overrides:
      `deallocate` in class `Device`

  - ### setImmutable

    public void setImmutable()

  - ### discardRC

    public void discardRC()

  - ### getRecordingContext

    @Nonnull public RecordingContext getRecordingContext()
    Overrides:
      `getRecordingContext` in class `Device`

  - ### getReadView

    @RawPtr public @RawPtr ImageViewProxy getReadView()
    Returns:
      raw ptr to the read view

  - ### makeImageCopy

    @Nullable @SharedPtr public @SharedPtr GraniteImage makeImageCopy(@Nonnull Rect2ic subset, boolean budgeted, boolean mipmapped, boolean approxFit)

  - ### pushClipStack

    public void pushClipStack()
    Specified by:
      `pushClipStack` in class `Device`

  - ### popClipStack

    public void popClipStack()
    Specified by:
      `popClipStack` in class `Device`

  - ### getClipStack

    public ClipStack getClipStack()

  - ### clipRect

    public void clipRect(Rect2fc rect, int clipOp, boolean doAA)
    Specified by:
      `clipRect` in class `Device`

  - ### isClipAA

    public boolean isClipAA()
    Specified by:
      `isClipAA` in class `Device`

  - ### isClipEmpty

    public boolean isClipEmpty()
    Specified by:
      `isClipEmpty` in class `Device`

  - ### isClipRect

    public boolean isClipRect()
    Specified by:
      `isClipRect` in class `Device`

  - ### isClipWideOpen

    public boolean isClipWideOpen()
    Specified by:
      `isClipWideOpen` in class `Device`

  - ### getClipBounds

    public void getClipBounds(@Nonnull Rect2i bounds)
    Description copied from class: `Device`
    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).
    Specified by:
      `getClipBounds` in class `Device`

  - ### getClipBounds

    protected Rect2ic getClipBounds()
    Specified by:
      `getClipBounds` in class `Device`

  - ### drawPaint

    public void drawPaint(Paint paint)
    Specified by:
      `drawPaint` in class `Device`

  - ### drawPoints

    public void drawPoints(int mode, float[] pts, int offset, int count, Paint paint)
    Specified by:
      `drawPoints` in class `Device`

  - ### drawLine

    public void drawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint)
    Specified by:
      `drawLine` in class `Device`

  - ### drawRect

    public void drawRect(Rect2fc r, Paint paint)
    Specified by:
      `drawRect` in class `Device`

  - ### drawRoundRect

    public void drawRoundRect(RoundRect rr, Paint paint)
    Specified by:
      `drawRoundRect` in class `Device`

  - ### drawCircle

    public void drawCircle(float cx, float cy, float radius, Paint paint)
    Specified by:
      `drawCircle` in class `Device`

  - ### drawArc

    public void drawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint)
    Specified by:
      `drawArc` in class `Device`

  - ### drawPie

    public void drawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint)
    Specified by:
      `drawPie` in class `Device`

  - ### drawChord

    public void drawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint)
    Specified by:
      `drawChord` in class `Device`

  - ### drawImageRect

    public void drawImageRect(@RawPtr @RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint)
    Specified by:
      `drawImageRect` in class `Device`

  - ### onDrawGlyphRunList

    protected void onDrawGlyphRunList(Canvas canvas, GlyphRunList glyphRunList, Paint paint)
    Specified by:
      `onDrawGlyphRunList` in class `Device`

  - ### drawVertices

    public void drawVertices(Vertices vertices, @SharedPtr @SharedPtr Blender blender, Paint paint)
    Specified by:
      `drawVertices` in class `Device`

  - ### drawAtlasSubRun

    public void drawAtlasSubRun(SubRunContainer.AtlasSubRun subRun, float originX, float originY, Paint paint)

  - ### drawGeometry

    public <GEO> void drawGeometry(Matrixc localToDevice, GEO geometry, BiConsumer<GEO,Rect2f> boundsFn, Paint paint, GeometryRenderer renderer, @SharedPtr @SharedPtr Blender primitiveBlender)

  - ### drawClipShape

    public void drawClipShape(Draw draw, boolean inverseFill)

  - ### flushPendingWork

    public void flushPendingWork()
    Ensures clip elements are drawn that will clip previous draw calls, snaps all pending work from the `SurfaceDrawContext` as a `RenderPassTask` and records it in the `GraniteDevice`'s `RecordingContext`.