Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Extending Gosu / Round-tripping with Devil and Gosu
- By banister Date 2009-10-25 11:56 Edited 2009-10-25 12:25
since it's pretty much dead on these boards recently i figured i'd blab on about some things you can do with Devil in Gosu:

Let's use Devil to manipulate some Gosu Images,

(1) Let's add an 'emboss' effect to a gosu image

img = Gosu::Image.new(window, "horse.png")
img = img.to_devil.emboss.to_gosu(window)

(2) Let's blur, scale, and rotate our gosu image

img = img.to_devil.blur(5).thumbnail(100).rotate(45).to_gosu(window)

(3) Let's take a screenshot of the Gosu::Window, mess with it a bit and then bring the screenshot back into gosu as an image: (note that Gosu::Window#screenshot returns a Devil::Image, not a Gosu::Image)

img = window.screenshot.equalize.sharpen(2, 1).mirror.to_gosu(window)

Note that to accomplish the above we need to do a Round trip: take the gosu image, convert it to a devil image, mess with it, then convert it back to a gosu image.

Yeah i could monkey-patch Gosu::Image so that the round-trip is done internally but personally im getting sick of monkey patching and Devil does enough monkey patching as it is. Feel free to monkey patch it yourself though :)

have fun!
Up Topic Gosu / Extending Gosu / Round-tripping with Devil and Gosu

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill