View lib_path.rb
# frozen_string_literal: true
module BuildPath
def library_path(base, name, ext)
File.join(base, 'library', name, "#{name}.#{ext}")
end
def processing_library_path(base, name, ext)
File.join(base, name, 'library', "#{name}.#{ext}")
end
end
View control_panel.md

Inspired by Nodebox, JRubyArt (copied from ruby-processing) provides a way to control the instance variables of your sketch with a control panel. You can create sliders, buttons, menus and checkboxes that set instance variables on your sketch. Since ruby-processing-2.0 you need to explicitly set the panel visible from the processing sketch (see included examples). Start by loading in the control_panel library, and then define your panel like so:

  load_library :control_panel
  attr_reader :panel, :hide

  def setup
    size(200, 200)
    @hide = false
View simple_capture.rb
load_library :glvideo
include_package 'gohai.glvideo'
attr_reader :video
def settings
size(320, 240, P2D)
end
def setup
View read_write_xml_processing.rb
#
# Loading XML Data
# by Daniel Shiffman.
#
# This example demonstrates how to use loadXML
# to retrieve data from an XML file and make objects
# from that data.
#
# Here is what the XML looks like:
#
View Palettes.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import processing.core.*;
import com.cage.colorharmony.*;
View StopWatch.java
package monkstone;
public class StopWatch {
private long startTime, pausedTime;
private boolean paused = true;
public StopWatch() {
startTime = System.nanoTime();
}
View ruby_wordcram.rb
# frozen_string_literal: false
if RUBY_PLATFORM == 'java'
require 'WordCram.jar'
require 'jsoup-1.7.2.jar'
require 'cue.language.jar'
wc = %w(WordAngler WordColorer WordCram WordFonter WordPlacer WordSkipReason)
sh = %w(Colorers ImageShaper Word ShapeBasedPlacer)
WC = wc.concat(sh).freeze
WC.each do |klass|
java_import "wordcram.#{klass}"
View MathToolModule.java
/**
* The purpose of this tool is to allow JRubyArt users to use an alternative
* to processing.org map, lerp and norm methods in their sketches and to implement
* JRubyArt convenenience method grid(width, height, stepW, stepH) { |x, y| do stuff }
* Copyright (c) 2015-17 Martin Prout. This tool is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* Obtain a copy of the license at http://www.gnu.org/licenses/lgpl-2.1.html
View helper_methods.rb
# frozen_string_literal: false
# processing module wrapper
require_relative '../rpextras'
module Processing
# Provides some convenience methods
module HelperMethods
# processings epsilon may not be defined yet
EPSILON ||= 9.999999747378752e-05
# Nice block method to draw to a buffer.
View Boundary.pde
class Boundary {
private float lower;
private float upper;
Boundary(float lower, float upper) {
this.lower = lower;
this.upper = upper;
}
float lower() {