Class: Processing::Graphics

Inherits:
Object
  • Object
show all
Includes:
GraphicsContext, Xot::Inspectable
Defined in:
lib/processing/graphics.rb

Overview

Draws graphics into an offscreen buffer

Constant Summary

Constants included from GraphicsContext

Processing::GraphicsContext::ADD, Processing::GraphicsContext::ALT, Processing::GraphicsContext::ARC, Processing::GraphicsContext::BACKSPACE, Processing::GraphicsContext::BASELINE, Processing::GraphicsContext::BEVEL, Processing::GraphicsContext::BLEND, Processing::GraphicsContext::BLUR, Processing::GraphicsContext::BOTTOM, Processing::GraphicsContext::CAPSLOCK, Processing::GraphicsContext::CENTER, Processing::GraphicsContext::CLAMP, Processing::GraphicsContext::CLEAR, Processing::GraphicsContext::CLOSE, Processing::GraphicsContext::COLOR_CODES, Processing::GraphicsContext::COMMAND, Processing::GraphicsContext::CONTROL, Processing::GraphicsContext::CORNER, Processing::GraphicsContext::CORNERS, Processing::GraphicsContext::DARKEST, Processing::GraphicsContext::DEGREES, Processing::GraphicsContext::DELETE, Processing::GraphicsContext::DOWN, Processing::GraphicsContext::ELLIPSE, Processing::GraphicsContext::ENTER, Processing::GraphicsContext::ESC, Processing::GraphicsContext::EXCLUSION, Processing::GraphicsContext::F1, Processing::GraphicsContext::F10, Processing::GraphicsContext::F11, Processing::GraphicsContext::F12, Processing::GraphicsContext::F13, Processing::GraphicsContext::F14, Processing::GraphicsContext::F15, Processing::GraphicsContext::F16, Processing::GraphicsContext::F17, Processing::GraphicsContext::F18, Processing::GraphicsContext::F19, Processing::GraphicsContext::F2, Processing::GraphicsContext::F20, Processing::GraphicsContext::F21, Processing::GraphicsContext::F22, Processing::GraphicsContext::F23, Processing::GraphicsContext::F24, Processing::GraphicsContext::F3, Processing::GraphicsContext::F4, Processing::GraphicsContext::F5, Processing::GraphicsContext::F6, Processing::GraphicsContext::F7, Processing::GraphicsContext::F8, Processing::GraphicsContext::F9, Processing::GraphicsContext::FUNCTION, Processing::GraphicsContext::GRAY, Processing::GraphicsContext::GROUP, Processing::GraphicsContext::HALF_PI, Processing::GraphicsContext::HELP, Processing::GraphicsContext::HOME, Processing::GraphicsContext::HSB, Processing::GraphicsContext::IMAGE, Processing::GraphicsContext::INVERT, Processing::GraphicsContext::LEFT, Processing::GraphicsContext::LIGHTEST, Processing::GraphicsContext::LINE, Processing::GraphicsContext::LINES, Processing::GraphicsContext::MITER, Processing::GraphicsContext::MULTIPLY, Processing::GraphicsContext::NORMAL, Processing::GraphicsContext::OPEN, Processing::GraphicsContext::OPTION, Processing::GraphicsContext::P5JS, Processing::GraphicsContext::PAGEDOWN, Processing::GraphicsContext::PAGEUP, Processing::GraphicsContext::PI, Processing::GraphicsContext::POINTS, Processing::GraphicsContext::PROCESSING, Processing::GraphicsContext::PROJECT, Processing::GraphicsContext::QUAD, Processing::GraphicsContext::QUADS, Processing::GraphicsContext::QUAD_STRIP, Processing::GraphicsContext::QUARTER_PI, Processing::GraphicsContext::RADIANS, Processing::GraphicsContext::RADIUS, Processing::GraphicsContext::RECT, Processing::GraphicsContext::REPEAT, Processing::GraphicsContext::REPLACE, Processing::GraphicsContext::RGB, Processing::GraphicsContext::RGBA, Processing::GraphicsContext::RIGHT, Processing::GraphicsContext::ROUND, Processing::GraphicsContext::SCREEN, Processing::GraphicsContext::SECTION, Processing::GraphicsContext::SHIFT, Processing::GraphicsContext::SPACE, Processing::GraphicsContext::SQUARE, Processing::GraphicsContext::SUBTRACT, Processing::GraphicsContext::TAB, Processing::GraphicsContext::TAU, Processing::GraphicsContext::TESS, Processing::GraphicsContext::THRESHOLD, Processing::GraphicsContext::TOP, Processing::GraphicsContext::TRIANGLE, Processing::GraphicsContext::TRIANGLES, Processing::GraphicsContext::TRIANGLE_FAN, Processing::GraphicsContext::TRIANGLE_STRIP, Processing::GraphicsContext::TWO_PI, Processing::GraphicsContext::UP, Processing::GraphicsContext::WIN

Instance Method Summary collapse

Methods included from GraphicsContext

#abs, #acos, #alpha, #angleMode, #applyMatrix, #arc, #asin, #atan, #atan2, #background, #beginContour, #beginShape, #bezier, #bezierDetail, #bezierPoint, #bezierTangent, #bezierVertex, #blend, #blendMode, #blue, #brightness, #ceil, #circle, #clear, #clip, #color, #colorMode, #constrain, #copy, #cos, #createCapture, #createFont, #createGraphics, #createImage, #createShader, #createShape, #createVector, #curve, #curveDetail, #curvePoint, #curveTangent, #curveTightness, #curveVertex, #degrees, #dist, #ellipse, #ellipseMode, #endContour, #endShape, #exp, #fill, #filter, #floor, #green, #height, #hue, #image, #imageMode, #lerp, #lerpColor, #line, #loadFont, #loadImage, #loadPixels, #loadShader, #loadShape, #log, #mag, #map, #max, #min, #noClip, #noFill, #noStroke, #noTint, #noise, #noiseDetail, #noiseSeed, #norm, #pixelDensity, #pixelHeight, #pixelWidth, #pixels, #point, #pop, #popMatrix, #popStyle, #pow, #printMatrix, #push, #pushMatrix, #pushStyle, #quad, #quadraticVertex, #radians, #random, #randomGaussian, #randomSeed, #rect, #rectMode, #red, #renderMode, #requestImage, #resetMatrix, #resetShader, #rotate, #rotateX, #rotateY, #rotateZ, #round, #saturation, #save, #scale, #shader, #shape, #shapeMode, #shearX, #shearY, #sin, #sq, #sqrt, #square, #stroke, #strokeCap, #strokeJoin, #strokeWeight, #tan, #text, #textAlign, #textAscent, #textDescent, #textFont, #textLeading, #textSize, #textWidth, #texture, #textureMode, #textureWrap, #tint, #translate, #triangle, #updatePixels, #vertex, #width

Constructor Details

#initialize(width, height, pixelDensity = 1) ⇒ Graphics

Initialize graphics object.



18
19
20
21
# File 'lib/processing/graphics.rb', line 18

def initialize(width, height, pixelDensity = 1)
  image = Rays::Image.new width, height, Rays::RGBA, pixelDensity
  init__ image, image.painter
end

Instance Method Details

#beginDraw(&block) ⇒ Object

Start drawing.



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/processing/graphics.rb', line 27

def beginDraw(&block)
  @painter__.__send__ :begin_paint
  beginDraw__
  push
  if block
    begin
      block.call self
    ensure
      endDraw
    end
  end
end

#endDrawObject

End drawing.



44
45
46
47
48
# File 'lib/processing/graphics.rb', line 44

def endDraw()
  pop
  endDraw__
  @painter__.__send__ :end_paint
end