The Green Shoes Manual 1.1.362

Image

An image is a picture in PNG, JPEG or GIF format. Green Shoes can resize images or flow them in with text. Images can be loaded from a file or directly off the web.

To create an image, use the image method in a slot:

 Shoes.app do
   para "Nice, nice, very nice.  Busy, busy, busy."
   image File.join DIR,
     "../static/shoes-manual-apps.png"
  end

When you load any image into Green Shoes, it is cached in memory. This means that if you load up many image elements from the same file, it'll only really load the file once.

You can use web URLs directly as well.

 Shoes.app do
   image "http://is.gd/c0mBtb"
 end

When an image is loaded from the web, it's cached on the hard drive as well as in memory. This prevents a repeat download unless the image has changed. (In case you're wondering: Shoes keeps track of modification times and etags just like a browser would.)

Note: Green Shoes doesn't support the hard drive cache management feature like Red Shoes.

Green Shoes also loads remote images in the background using system threads. So, using remote images will not block Ruby or any intense graphical displays you may have going on.

full_height() » a number

The full pixel height of the image. Normally, you can just use the height method to figure out how many pixels high the image is. But if you've resized the image or styled it to be larger or something, then height will return the scaled size.

The full_height method gives you the height of image (in pixels) as it was stored in the original file.

full_width() » a number

The full pixel width of the image. See the full_height method for an explanation of why you might use this method rather than width.

path() » a string

The URL or file name of the image.

Swaps the image with a different one, loaded from a file or URL.

Rotates the Image element by a certain number of degrees.

 Shoes.app do
   img = image File.join(DIR, '../samples/cy.png')
   img.move 200, 200
   animate do |i|
     img.rotate i*10
   end
 end

Next: ListBox