Next: , Previous: , Up: draw   [Contents][Index]

53.3 Functions and Variables for pictures

Function: get_pixel (pic,x,y)

Returns pixel from picture. Coordinates x and y range from 0 to width-1 and height-1, respectively.

Categories: Package draw ·
Function: make_level_picture
    make_level_picture (data)
    make_level_picture (data,width,height)

Returns a levels picture object. make_level_picture (data) builds the picture object from matrix data. make_level_picture (data,width,height) builds the object from a list of numbers; in this case, both the width and the height must be given.

The returned picture object contains the following four parts:

  1. symbol level
  2. image width
  3. image height
  4. an integer array with pixel data ranging from 0 to 255. Argument data must contain only numbers ranged from 0 to 255; negative numbers are substituted by 0, and those which are greater than 255 are set to 255.

Example:

Level picture from matrix.

(%i1) make_level_picture(matrix([3,2,5],[7,-9,3000]));
(%o1)         picture(level, 3, 2, {Array:  #(3 2 5 7 0 255)})

Level picture from numeric list.

(%i1) make_level_picture([-2,0,54,%pi],2,2);
(%o1)            picture(level, 2, 2, {Array:  #(0 0 54 3)})
Categories: Package draw ·
Function: make_rgb_picture (redlevel,greenlevel,bluelevel)

Returns an rgb-coloured picture object. All three arguments must be levels picture; with red, green and blue levels.

The returned picture object contains the following four parts:

  1. symbol rgb
  2. image width
  3. image height
  4. an integer array of length 3*width*height with pixel data ranging from 0 to 255. Each pixel is represented by three consecutive numbers (red, green, blue).

Example:

(%i1) red: make_level_picture(matrix([3,2],[7,260]));
(%o1)           picture(level, 2, 2, {Array:  #(3 2 7 255)})
(%i2) green: make_level_picture(matrix([54,23],[73,-9]));
(%o2)           picture(level, 2, 2, {Array:  #(54 23 73 0)})
(%i3) blue: make_level_picture(matrix([123,82],[45,32.5698]));
(%o3)          picture(level, 2, 2, {Array:  #(123 82 45 33)})
(%i4) make_rgb_picture(red,green,blue);
(%o4) picture(rgb, 2, 2, 
              {Array:  #(3 54 123 2 23 82 7 73 45 255 0 33)})
Categories: Package draw ·
Function: negative_picture (pic)

Returns the negative of a (level or rgb) picture.

Categories: Package draw ·
Function: picture_equalp (x,y)

Returns true in case of equal pictures, and false otherwise.

Categories: Package draw · Predicate functions ·
Function: picturep (x)

Returns true if the argument is a well formed image, and false otherwise.

Categories: Package draw · Predicate functions ·
Function: read_xpm (xpm_file)

Reads a file in xpm and returns a picture object.

Categories: Package draw ·
Function: rgb2level (pic)

Transforms an rgb picture into a level one by averaging the red, green and blue channels.

Categories: Package draw ·
Function: take_channel (im,color)

If argument color is red, green or blue, function take_channel returns the corresponding color channel of picture im. Example:

(%i1) red: make_level_picture(matrix([3,2],[7,260]));
(%o1)           picture(level, 2, 2, {Array:  #(3 2 7 255)})
(%i2) green: make_level_picture(matrix([54,23],[73,-9]));
(%o2)           picture(level, 2, 2, {Array:  #(54 23 73 0)})
(%i3) blue: make_level_picture(matrix([123,82],[45,32.5698]));
(%o3)          picture(level, 2, 2, {Array:  #(123 82 45 33)})
(%i4) make_rgb_picture(red,green,blue);
(%o4) picture(rgb, 2, 2, 
              {Array:  #(3 54 123 2 23 82 7 73 45 255 0 33)})
(%i5) take_channel(%,'green);  /* simple quote!!! */
(%o5)           picture(level, 2, 2, {Array:  #(54 23 73 0)})
Categories: Package draw ·

Next: , Previous: , Up: draw   [Contents][Index]