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::BACKSPACE, Processing::GraphicsContext::BASELINE, Processing::GraphicsContext::BLEND, Processing::GraphicsContext::BLUR, Processing::GraphicsContext::BOTTOM, Processing::GraphicsContext::CAPSLOCK, Processing::GraphicsContext::CENTER, Processing::GraphicsContext::CLEAR, 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::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::HALF_PI, Processing::GraphicsContext::HELP, Processing::GraphicsContext::HOME, Processing::GraphicsContext::HSB, Processing::GraphicsContext::INVERT, Processing::GraphicsContext::LEFT, Processing::GraphicsContext::LIGHTEST, Processing::GraphicsContext::MITER, Processing::GraphicsContext::MULTIPLY, Processing::GraphicsContext::OPTION, Processing::GraphicsContext::PAGEDOWN, Processing::GraphicsContext::PAGEUP, Processing::GraphicsContext::PI, Processing::GraphicsContext::PROJECT, Processing::GraphicsContext::QUARTER_PI, Processing::GraphicsContext::RADIANS, Processing::GraphicsContext::RADIUS, 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::THRESHOLD, Processing::GraphicsContext::TOP, Processing::GraphicsContext::TWO_PI, Processing::GraphicsContext::UP, Processing::GraphicsContext::WIN

Instance Method Summary collapse

Methods included from GraphicsContext

#abs, #acos, #angleMode, #arc, #asin, #atan, #atan2, #background, #bezier, #blend, #blendMode, #ceil, #circle, #clip, #colorMode, #constrain, #copy, #cos, #createCapture, #createGraphics, #createImage, #createShader, #createVector, #curve, #degrees, #dist, #ellipse, #ellipseMode, #exp, #fill, #filter, #floor, #height, #image, #imageMode, #lerp, #line, #loadImage, #loadShader, #log, #mag, #map, #max, #min, #noClip, #noFill, #noStroke, #noTint, #noise, #norm, #point, #pop, #popMatrix, #popStyle, #pow, #push, #pushMatrix, #pushStyle, #quad, #radians, #random, #rect, #rectMode, #resetMatrix, #resetShader, #rotate, #round, #save, #scale, #shader, #sin, #sq, #sqrt, #square, #stroke, #strokeCap, #strokeJoin, #strokeWeight, #tan, #text, #textAlign, #textAscent, #textDescent, #textFont, #textSize, #textWidth, #tint, #translate, #triangle, #width

Constructor Details

#initialize(width, height) ⇒ Graphics

Initialize graphics object.



13
14
15
16
# File 'lib/processing/graphics.rb', line 13

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

Instance Method Details

#beginDraw(&block) ⇒ Object

Start drawing.



20
21
22
23
24
25
26
27
28
# File 'lib/processing/graphics.rb', line 20

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

#endDrawObject

End drawing.



32
33
34
35
36
# File 'lib/processing/graphics.rb', line 32

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