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"
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 |