Package ilda

Class IldaRenderer

java.lang.Object
processing.core.PImage
processing.core.PGraphics
be.cmbsoft.ilda.IldaRenderer
All Implemented Interfaces:
Cloneable, processing.core.PConstants

public class IldaRenderer extends processing.core.PGraphics
This class can be used to render ilda files as a subclass of PGraphics.

You can use this class in the same way as you would use another PGraphics. For example you can use most graphic calls on an instance of this class. Usage: as opposed to most PGraphic subclasses, you may use the constructor to create an instance of IldaRenderer. You must call beginDraw() and endDraw() around any graphic calls.

Example: r = new IldaRenderer(ilda);
r.beginDraw();
r.stroke(255,0,0);
r.line(50, 100,25,60); //draws a red line
r.endDraw();

Then you can retrieve the frame(s) with r.getFrames() to export or display.

It is ill advised to create a new IldaRenderer instance in draw(). Multiple frames can be created sequentially using the same instance of IldaRenderer.

  • Nested Class Summary

    Nested classes/interfaces inherited from class processing.core.PGraphics

    processing.core.PGraphics.AsyncImageSaver
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected int
     
    protected IldaFrame
     
    protected float
     
    protected float
     
    protected File
     
    protected IldaPoint
     
    protected float
     
    protected float
     
    protected float
     
    protected boolean
     
    protected ArrayList<IldaFrame>
     

    Fields inherited from class processing.core.PGraphics

    A, AB, AG, ambientB, ambientColor, ambientG, ambientR, AR, asyncImageSaver, autoNormal, B, backgroundA, backgroundAi, backgroundAlpha, backgroundB, backgroundBi, backgroundColor, backgroundG, backgroundGi, backgroundR, backgroundRi, BEEN_LIT, bezierBasisInverse, bezierBasisMatrix, bezierDetail, bezierDrawMatrix, bezierInited, blendMode, cacheMap, calcA, calcAi, calcAlpha, calcB, calcBi, calcColor, calcG, calcGi, calcR, calcRi, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, cosLUT, curveBasisMatrix, curveDetail, curveDrawMatrix, curveInited, curveTightness, curveToBezierMatrix, curveVertexCount, curveVertices, DA, DB, DEFAULT_STROKE_CAP, DEFAULT_STROKE_JOIN, DEFAULT_STROKE_WEIGHT, DEFAULT_VERTICES, defaultFontName, DG, DR, EB, edge, EDGE, EG, ellipseMode, emissiveB, emissiveColor, emissiveG, emissiveR, ER, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, fill, fillA, fillAi, fillAlpha, fillB, fillBi, fillColor, fillG, fillGi, fillR, fillRi, G, HAS_NORMAL, hints, image, imageMode, NORMAL_MODE_AUTO, NORMAL_MODE_SHAPE, NORMAL_MODE_VERTEX, normalMode, normalX, normalY, normalZ, NX, NY, NZ, path, pixelCount, primaryGraphics, R, raw, reapplySettings, rectMode, SA, SB, setAmbient, settingsInited, SG, shape, shapeMode, SHINE, shininess, SINCOS_LENGTH, SINCOS_PRECISION, sinLUT, smooth, SPB, specularB, specularColor, specularG, specularR, SPG, sphereDetailU, sphereDetailV, sphereX, sphereY, sphereZ, SPR, SR, stroke, strokeA, strokeAi, strokeAlpha, strokeB, strokeBi, strokeCap, strokeColor, strokeG, strokeGi, strokeJoin, strokeR, strokeRi, strokeWeight, surface, SW, textAlign, textAlignY, textBreakCount, textBreakStart, textBreakStop, textBuffer, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, textWidthBuffer, tint, tintA, tintAi, tintAlpha, tintB, tintBi, tintColor, tintG, tintGi, tintR, tintRi, TX, TY, TZ, U, V, VERTEX_FIELD_COUNT, vertexCount, vertices, VW, VX, VY, VZ, warnings

    Fields inherited from class processing.core.PImage

    ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, modified, mx1, mx2, my1, my2, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, width

    Fields inherited from interface processing.core.PConstants

    ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOS, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
  • Constructor Summary

    Constructors
    Constructor
    Description
    IldaRenderer (@NotNull processing.core.PApplet parent)
     
    IldaRenderer (@Nullable processing.core.PApplet parent, int width, int height)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyMatrix (float n00, float n01, float n02, float n10, float n11, float n12)
     
    void
    applyMatrix (float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
     
    protected void
    applyMatrixImpl (float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
    NOT interested in debugging this if it's even bugged maybe it magically works idk idc
    void
     
    void
     
    void
    Always call this before drawing!
    void
    beginShape (int kind)
     
    void
     
    void
    Clears the frame.
    protected void
    defaultFontOrDeath (String method, float size)
     
    void
     
    void
     
    void
    drawIldaFrame (IldaFrame frame, int x, int y)
     
    void
    drawIldaFrame (IldaFrame frame, int x, int y, int w, int h)
    Draw an existing ilda frame inside the renderer
    protected void
    ellipseImpl (float x, float y, float w, float h)
     
    void
     
    void
    Always call this after drawing!
    void
     
    void
    endShape (int kind)
     
    Get the current frame that's being drawn on
    Get all frames stored in the renderer
    int
    How many frames are there?
     
    double
     
    processing.core.PVector
    Get the current translation vector
    boolean
    is2D()
     
    boolean
    is3D()
     
    boolean
    Returns the overwrite setting, whether the renderer keeps drawing on the same frame or if it creates a new frame each time beginDraw() is called.
    void
     
    void
     
    void
     
    void
    resize (int newWidth, int newHeight)
     
    void
    rotate (float angle)
     
    void
    rotate (float angle, float v0, float v1, float v2)
     
    void
    rotateX (float angle)
     
    void
    rotateY (float angle)
     
    void
    rotateZ (float angle)
     
    void
    scale (float x, float y, float z)
     
    void
    setEllipseCorrection (int correction)
    Sets the amount of points the ellipse should overshoot or continue drawing, to avoid a gap .
    void
    setEllipseDetail (float detail)
    Number reflecting the amount of points in an ellipse.
    void
     
    void
    setOptimise (boolean shouldOptimise)
    Should the frame be optimised for rendering?
    void
    setOverwrite (boolean overwrite)
    If set to true, no new frame will be added to the frame list when calling EndDraw().
    void
    setPath (String path)
    Currently saving is not implemented in the renderer, use writeFile() in the main ilda class instead.
    void
    setTextDetail (double textDetail)
    Defines a minimal distance, in terms of fraction of the size of the font, in which no points are generated.
    protected void
    setTranslation (float x, float y, float z)
     
    protected void
    textCharImpl (char ch, float x, float y)
    Well wouldn't it be boss if this "just worked"!!!
    void
    translate (float x, float y)
     
    void
    translate (float x, float y, float z)
     
    void
    vertex (float x, float y)
     
    void
    vertex (float x, float y, float z)
     

    Methods inherited from class processing.core.PGraphics

    alpha, ambient, ambient, ambient, ambientFromCalc, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, arc, arcImpl, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, awaitAsyncSaveCompletion, background, background, background, background, background, background, background, backgroundFromCalc, backgroundImpl, backgroundImpl, beginCamera, beginPGL, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierInit, bezierInitCheck, bezierPoint, bezierTangent, bezierVertex, bezierVertex, bezierVertexCheck, bezierVertexCheck, blendMode, blendModeImpl, blue, box, box, brightness, camera, camera, checkSettings, circle, clear, clip, clipImpl, color, color, color, color, color, color, color, color, color, colorCalc, colorCalc, colorCalc, colorCalc, colorCalc, colorCalc, colorCalcARGB, colorMode, colorMode, colorMode, colorMode, createDefaultFont, createFont, createShape, createShape, createShape, createShapeFamily, createShapePrimitive, createSurface, curve, curve, curveDetail, curveInit, curveInitCheck, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, curveVertexCheck, curveVertexCheck, curveVertexSegment, curveVertexSegment, defaultFontOrDeath, defaultSettings, directionalLight, displayable, edge, ellipse, ellipseMode, emissive, emissive, emissive, emissiveFromCalc, endCamera, endPGL, endRaw, fill, fill, fill, fill, fill, fill, fillFromCalc, filter, flush, frustum, getCache, getMatrix, getMatrix, getMatrix, getRaw, getStyle, getStyle, green, handleTextSize, haveRaw, hint, hue, image, image, image, imageImpl, imageMode, is2X, isGL, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, loadShader, loadShader, loadShape, loadShape, modelX, modelY, modelZ, noClip, noFill, noLights, normal, noSmooth, noStroke, noTexture, noTint, ortho, ortho, ortho, perspective, perspective, point, point, pointLight, pop, popStyle, printCamera, printMatrix, printProjection, processImageBeforeAsyncSave, push, pushStyle, quad, quadraticVertex, quadraticVertex, reapplySettings, rect, rect, rect, rectImpl, rectImpl, rectMode, red, removeCache, resetShader, resetShader, saturation, save, scale, scale, screenX, screenX, screenY, screenY, screenZ, setCache, setMatrix, setMatrix, setMatrix, setParent, setPrimary, setSize, shader, shader, shape, shape, shape, shape, shape, shapeMode, shearX, shearY, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, showWarning, smooth, smooth, specular, specular, specular, specularFromCalc, sphere, sphereDetail, sphereDetail, splineForward, spotLight, square, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeFromCalc, strokeJoin, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textCharModelImpl, textDescent, textFont, textFont, textFontImpl, textLeading, textLineAlignImpl, textLineImpl, textMode, textModeCheck, textSentence, textSentenceBreak, textSize, textSizeImpl, texture, textureMode, textureWrap, textWidth, textWidth, textWidth, textWidthImpl, tint, tint, tint, tint, tint, tint, tintFromCalc, triangle, vertex, vertex, vertex, vertexCheck, vertexTexture

    Methods inherited from class processing.core.PImage

    blend, blend, blendColor, blurAlpha, blurARGB, blurRGB, buildBlurKernel, checkAlpha, clone, copy, copy, copy, dilate, erode, filter, filter, get, get, get, getImage, getImpl, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, init, isLoaded, isModified, loadPixels, loadTGA, mask, mask, saveImpl, saveTGA, set, set, setImpl, setLoaded, setLoaded, setModified, setModified, updatePixels, updatePixels

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • file

      protected File file
    • currentFrame

      protected IldaFrame currentFrame
    • count

      protected int count
    • theFrames

      protected ArrayList<IldaFrame> theFrames
    • invWidth

      protected float invWidth
    • invHeight

      protected float invHeight
    • shouldBlank

      protected boolean shouldBlank
    • closedShape

      protected boolean closedShape
    • firstPoint

      protected IldaPoint firstPoint
    • depth

      protected float depth
    • ellipseDetail

      protected float ellipseDetail
    • invDepth

      protected float invDepth
  • Constructor Details

    • IldaRenderer

      public IldaRenderer (@NotNull @NotNull processing.core.PApplet parent)
    • IldaRenderer

      public IldaRenderer (@Nullable @Nullable processing.core.PApplet parent, int width, int height)
  • Method Details

    • isOverwrite

      public boolean isOverwrite()
      Returns the overwrite setting, whether the renderer keeps drawing on the same frame or if it creates a new frame each time beginDraw() is called.
      Returns:
      boolean - is false if a new IldaFrame is created upon each draw.
    • setOverwrite

      public void setOverwrite (boolean overwrite)
      If set to true, no new frame will be added to the frame list when calling EndDraw(). Instead, the renderer will keep writing on the same frame. This is useful for drawing applications where you want to keep adding content to the same frame instead of making an animation. False by default.
      Parameters:
      overwrite - boolean - should the renderer keep writing on the same frame?
    • setPath

      public void setPath (String path)
      Currently saving is not implemented in the renderer, use writeFile() in the main ilda class instead.
      Overrides:
      setPath in class processing.core.PGraphics
      Parameters:
      path - should be a path leading to a file
    • resize

      public void resize (int newWidth, int newHeight)
      Overrides:
      resize in class processing.core.PImage
    • beginDraw

      public void beginDraw()
      Always call this before drawing!
      Overrides:
      beginDraw in class processing.core.PGraphics
    • endDraw

      public void endDraw()
      Always call this after drawing!
      Overrides:
      endDraw in class processing.core.PGraphics
    • translate

      public void translate (float x, float y)
      Overrides:
      translate in class processing.core.PGraphics
    • translate

      public void translate (float x, float y, float z)
      Overrides:
      translate in class processing.core.PGraphics
    • resetMatrix

      public void resetMatrix()
      Overrides:
      resetMatrix in class processing.core.PGraphics
    • rotate

      public void rotate (float angle)
      Overrides:
      rotate in class processing.core.PGraphics
    • rotateX

      public void rotateX (float angle)
      Overrides:
      rotateX in class processing.core.PGraphics
    • rotateY

      public void rotateY (float angle)
      Overrides:
      rotateY in class processing.core.PGraphics
    • rotateZ

      public void rotateZ (float angle)
      Overrides:
      rotateZ in class processing.core.PGraphics
    • rotate

      public void rotate (float angle, float v0, float v1, float v2)
      Overrides:
      rotate in class processing.core.PGraphics
    • scale

      public void scale (float x, float y, float z)
      Overrides:
      scale in class processing.core.PGraphics
    • pushMatrix

      public void pushMatrix()
      Overrides:
      pushMatrix in class processing.core.PGraphics
    • popMatrix

      public void popMatrix()
      Overrides:
      popMatrix in class processing.core.PGraphics
    • getTranslation

      public processing.core.PVector getTranslation()
      Get the current translation vector
      Returns:
      the center of the origin relative to the sketch' origin
    • setTranslation

      protected void setTranslation (float x, float y, float z)
    • beginShape

      public void beginShape (int kind)
      Overrides:
      beginShape in class processing.core.PGraphics
    • beginContour

      public void beginContour()
      Overrides:
      beginContour in class processing.core.PGraphics
    • vertex

      public void vertex (float x, float y)
      Overrides:
      vertex in class processing.core.PGraphics
    • vertex

      public void vertex (float x, float y, float z)
      Overrides:
      vertex in class processing.core.PGraphics
    • endContour

      public void endContour()
      Overrides:
      endContour in class processing.core.PGraphics
    • endShape

      public void endShape()
      Overrides:
      endShape in class processing.core.PGraphics
    • endShape

      public void endShape (int kind)
      Overrides:
      endShape in class processing.core.PGraphics
    • ellipseImpl

      protected void ellipseImpl (float x, float y, float w, float h)
      Overrides:
      ellipseImpl in class processing.core.PGraphics
    • textCharImpl

      protected void textCharImpl (char ch, float x, float y)
      Well wouldn't it be boss if this "just worked"!!! Should be automatically called by the several text() implementations of the parent PGraphics class
      Overrides:
      textCharImpl in class processing.core.PGraphics
      Parameters:
      ch - the character
      x - position x
      y - position y
    • applyMatrix

      public void applyMatrix (float n00, float n01, float n02, float n10, float n11, float n12)
      Overrides:
      applyMatrix in class processing.core.PGraphics
    • applyMatrix

      public void applyMatrix (float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
      Overrides:
      applyMatrix in class processing.core.PGraphics
    • applyMatrixImpl

      protected void applyMatrixImpl (float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
      NOT interested in debugging this if it's even bugged maybe it magically works idk idc
    • setEllipseDetail

      public void setEllipseDetail (float detail)
      Number reflecting the amount of points in an ellipse. The lower, the fewer points there are. The higher, the more. The default value is 1. Finding a good value is a bit arbitrary. This value is multiplied by the sum of the third and fourth arguments of the ellipse method (the width and height).
      Parameters:
      detail - gets multiplied with (width+height) of the ellipse arguments to get the total points
    • setEllipseCorrection

      public void setEllipseCorrection (int correction)
      Sets the amount of points the ellipse should overshoot or continue drawing, to avoid a gap . Can be negative to leave a gap. Default is 0.
      Parameters:
      correction - for how many extra points the ellipse continues
    • defaultFontOrDeath

      protected void defaultFontOrDeath (String method, float size)
      Overrides:
      defaultFontOrDeath in class processing.core.PGraphics
    • drawIldaFrame

      public void drawIldaFrame (IldaFrame frame, int x, int y, int w, int h)
      Draw an existing ilda frame inside the renderer
      Parameters:
      frame - frame to be drawn
      x - x position offset
      y - y position offset
      w - width (rescaling)
      h - height (rescaling)
    • drawIldaFrame

      public void drawIldaFrame (IldaFrame frame, int x, int y)
    • drawIldaFrame

      public void drawIldaFrame (IldaFrame frame)
    • dispose

      public void dispose()
      Overrides:
      dispose in class processing.core.PGraphics
    • is2D

      public boolean is2D()
      Overrides:
      is2D in class processing.core.PGraphics
    • is3D

      public boolean is3D()
      Overrides:
      is3D in class processing.core.PGraphics
    • getFrames

      public List<IldaFrame> getFrames()
      Get all frames stored in the renderer
      Returns:
      all frames in the renderer
    • getCurrentFrame

      public IldaFrame getCurrentFrame()
      Get the current frame that's being drawn on
      Returns:
      current frame
    • getFramesAmount

      public int getFramesAmount()
      How many frames are there?
      Returns:
      how many frames are currently in the renderer
    • clearFrame

      public void clearFrame()
      Clears the frame.
    • clearAllFrames

      public void clearAllFrames()
    • background

      public void background()
    • setOptimise

      public void setOptimise (boolean shouldOptimise)
      Should the frame be optimised for rendering? If set to false, as little points as possible are used to represent the art. If set to true, the frame will be optimised for display using this renderer's OptimisationSettings.
      Parameters:
      shouldOptimise - should the frame be optimised?
    • getOptimisationSettings

      public OptimisationSettings getOptimisationSettings()
    • setOptimisationSettings

      public void setOptimisationSettings (OptimisationSettings settings)
    • getTextDetail

      public double getTextDetail()
    • setTextDetail

      public void setTextDetail (double textDetail)
      Defines a minimal distance, in terms of fraction of the size of the font, in which no points are generated. Necessary to reduce point count in curved letters.
      Parameters:
      textDetail - minimal distance between two points in text characters