class Iup::Image
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
Public Class Methods
new(width, height, pixels, &block)
click to toggle source
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
# 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