Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Showing posts with label gui. Show all posts
Showing posts with label gui. Show all posts

Sunday, 17 June 2012

A Gui for my pixelation library

Over on my other blog I recently described an application for pixelating pictures in processing, but also using the cfdg program (CF3), here is the program adapted for ruby-processing, with an added gui using "control_panel"




load_libraries 'pde2cfdg', 'control_panel'
import "pde2cfdg"

#
# Two cfdg files are written to the sketch folder one for design one for data,
# this means it easier to edit the design (eg to replace CIRCLE with a custom shape)
# The output png file is written to the sketch folder,
#

attr_reader :cfdg, :dot_size

def setup
    size(640, 512)
    background(255)
    setup_panel
    colorMode(HSB, 1.0)
    @cfdg = ProcessingToCF.new(self)
    cfdg.set_dot_size(dot_size)
    cfdg.setPathToCFDG("/home/tux/CF3/cfdg")
    cfdg.get_input
    cfdg.writeCFDG
end

def setup_panel
    control_panel do |c|
      c.title = "Control:"
      c.slider(:dot_size, 1..6, 3)
      c.button(:re_run)
    end
end

def re_run
  cfdg.set_dot_size(dot_size)
  cfdg.writeCFDG
end

def draw
  if (cfdg.finished)
    img = load_image(cfdg.outFile)
    image(img, 0, 0, img.width, img.height)
  end
end
Here's a screenshot of application in action, the artist is Phil Sutton RA

Thursday, 5 November 2009

jEdit as a cross platform GUI?

I have created a commando file 'rp5.xml' that allows me to run the file I am editing in jEdit (runs 'rp5 run buffer.rb'), directly from jEdit. You can download my file from the jEdit community downloads. It is easy to edit the commando file, so you could add watch as alternative to run.
You could also use a bsh macro to launch the command file, this is mine:-

new console.commando.CommandoDialog(view,"commando.rp5");

Here is a screenshot of the jedit buffer window a running ruby-processing applet, and the associated console pane.


Followers

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2