Class: Iup::ImageRGB

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

Overview

Image made from RGB 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) ⇒ ImageRGB

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



96
97
98
99
100
101
# File 'lib/wrapped/image.rb', line 96

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