Class: Iup::ImageRGBA

Inherits:
ImageWidget show all
Defined in:
lib/wrapped/image.rb

Overview

Image made from RGBA values.

Instance Attribute Summary

Attributes inherited from Widget

#handle

Instance Method Summary collapse

Methods inherited from ImageWidget

#color, #colour, #save

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

#define_callback

Constructor Details

#initialize(width, height, pixels, &block) ⇒ ImageRGBA

Constructor creates an image from raw pixels, using 4-values 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



111
112
113
114
115
116
# File 'lib/wrapped/image.rb', line 111

def initialize width, height, pixels, &block
  @handle = IupLib.IupImageRGBA 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