Class: Iup::ImageRGBA
- Inherits:
-
ImageWidget
- Object
- Widget
- ImageWidget
- Iup::ImageRGBA
- Defined in:
- lib/wrapped/image.rb
Overview
Image made from RGBA values.
Example
image_data = [
r1,g1,b1,a1,r2,g2,b2,a2, ... r20,g20,b20,a20, # 4x20 sets of RGBA values
... # 20 rows
]
Iup::ImageRGBA.new(20, 20, image_data)
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#initialize(width, height, pixels) {|_self| ... } ⇒ ImageRGBA
constructor
Constructor creates an image from raw pixels.
Methods inherited from ImageWidget
#assign_handle, #bpp, #channels, #height, #hotspot, #rastersize, #save, #wid, #width
Methods inherited from Widget
#active, #assign_handle, #bgcolor, #destroy, #enterwindow_cb=, #fgcolor, #font, #getfocus_cb=, #help_cb=, #k_any=, #killfocus_cb=, #leavewindow_cb=, #map_cb=, #maxsize, #minsize, #open_controls, #size, #unmap_cb=, #visible, #wid, #zorder
Methods included from AttributeBuilders
#define_attribute, #define_id_attribute, #define_id_reader, #define_id_writer, #define_property_attribute, #define_property_reader, #define_property_writer, #define_reader, #define_writer
Methods included from CallbackSetter
Constructor Details
#initialize(width, height, pixels) {|_self| ... } ⇒ ImageRGBA
Constructor creates an image from raw pixels. If a block is given, the new instance is yielded to it.
-
width- width of image in pixels -
height- height of image in pixels -
pixels- an array of pixel values, using 4 values per pixel.
171 172 173 174 175 176 |
# File 'lib/wrapped/image.rb', line 171 def initialize(width, height, pixels) @handle = IupLib.IupImageRGBA(width, height, IupLib.pointer_from_chars(pixels)) # run any provided block on instance, to set up further attributes yield self if block_given? end |