Class: Iup::Image
- Inherits:
-
ImageWidget
- Object
- Widget
- ImageWidget
- Iup::Image
- Defined in:
- lib/wrapped/image.rb
Overview
Image made from greyscale values. For example:
pixmap_x = [
1,2,3,3,3,3,3,3,3,2,1,
2,1,2,3,3,3,3,3,2,1,2,
3,2,1,2,3,3,3,2,1,2,3,
3,3,2,1,2,3,2,1,2,3,3,
3,3,3,2,1,2,1,2,3,3,3,
3,3,3,3,2,1,2,3,3,3,3,
3,3,3,2,1,2,1,2,3,3,3,
3,3,2,1,2,3,2,1,2,3,3,
3,2,1,2,3,3,3,2,1,2,3,
2,1,2,3,3,3,3,3,2,1,2,
1,2,3,3,3,3,3,3,3,2,1
]
img = Image.new 11, 11, pixmap_x
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#initialize(width, height, pixels, &block) ⇒ Image
constructor
Constructor creates an image from raw pixels, using 1-value per pixel.
Methods inherited from ImageWidget
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
Constructor Details
#initialize(width, height, pixels, &block) ⇒ Image
Constructor creates an image from raw pixels, using 1-value per pixel.
- width
-
width of image in pixels
- height
-
height of image in pixels
- pixels
-
an array of pixel values
- block
-
an optional block to set attributes
81 82 83 84 85 86 |
# File 'lib/wrapped/image.rb', line 81 def initialize width, height, pixels, &block @handle = IupLib.IupImage width, height, IupLib.pointer_from_chars(pixels) # run any provided block on instance, to set up further attributes self.instance_eval &block if block_given? end |