Class: Iup::ImageWidget
Overview
Parent class of images provides common attributes.
Attributes
- assign_handle
-
write-only sets the name for referring to image.
- bpp
-
read-only Returns the number of bits per pixel.
- channels
-
read-only Returns the number of channels.
- color
-
index, “r g b” -> gets/sets colour index. (Used only in 8-bit images created using
Image) - colour
-
index, “r g b” -> gets/sets colour index. (Used only in 8-bit images created using
Image) - height
-
read-only Height of the image, in pixels.
- hotspot
-
“x:y”, coordinates of spot in image used for mouse click. Default is “0:0”.
- rastersize
-
read-only Size of the image, in pixels, value as “widthxheight”.
- wid
-
read-only Native widget identifier.
- width
-
read-only Width of the image, in pixels.
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#color(index, value) ⇒ Object
:nodoc:.
-
#colour(index, value) ⇒ Object
:nodoc:.
-
#save(filename, format = 'png') ⇒ Object
Saves image to given filename.
Methods inherited from Widget
#assign_handle, #enterwindow_cb, #getfocus_cb, #help_cb, #k_any, #killfocus_cb, #leavewindow_cb, #map_cb, #open_controls, #unmap_cb
Methods included from AttributeBuilders
#define_attribute, #define_id_attribute, #define_id_readonly, #define_id_writeonly, #define_property_attribute, #define_property_writeonly, #define_readonly, #define_writeonly
Methods included from CallbackSetter
Instance Method Details
#color(index, value) ⇒ Object
:nodoc:
37 38 39 |
# File 'lib/wrapped/image.rb', line 37 def color index, value # :nodoc: colour index, value end |
#colour(index, value) ⇒ Object
:nodoc:
33 34 35 |
# File 'lib/wrapped/image.rb', line 33 def colour index, value #:nodoc: IupLib.IupSetAttribute @handle, index.to_s, value end |
#save(filename, format = 'png') ⇒ Object
Saves image to given filename. Optional format is one of: “BMP”, “JPEG”, “GIF”, “TIFF”, “PNG”, “PNM”, “PCX”, “ICO”, etc.
49 50 51 52 53 54 |
# File 'lib/wrapped/image.rb', line 49 def save filename, format = 'png' err = IupIm.IupSaveImage @handle, filename, format if err.zero? raise Exception, 'Could not save image as file' end end |