bitmap

package bitmap
The Bitmap class represents a 24-bit bitmap image. An instance can be constructed

Concerns

  • bitmap: The Bitmap class represents a 24-bit bitmap image. An instance can be constructed
    • bitmap: The Bitmap class represents a 24-bit bitmap image. An instance can be constructed
    • test_bitmap: This file tests the Bitmap class in the bitmap module

bitmap::bitmap

module bitmap

The Bitmap class represents a 24-bit bitmap image. An instance can be constructed

by calling load or with_size:

var bm1 = new Bitmap.load(path_to_a_bmp_file)
var bm2 = new Bitmap.with_size(400, 300)

The width and height attributes contain the image's width and height, respectively.

Individual pixels can be manipulated by calling the set_pixel function:

set_pixel(x, y, color)

The no-argument grayscale function converts the bitmap to grayscale and is an implementation of this Rossetacode task: http://rosettacode.org/wiki/Grayscale_image

Finally, the bitmap can be saved to a file by calling save:

save(path_to_a_file)

For information on the bitmap format, see http://en.wikipedia.org/wiki/BMP_file_format

A module containing classes for manipulating bitmap images

bitmap::test_bitmap

module test_bitmap

This file tests the Bitmap class in the bitmap module

It has to be called by passing two arguments:

  • An input bitmap file
  • An output bitmap file

It converts the input bitmap to grayscale and save it to the specified output file. In addition, it creates a blank.bmp file in the current directory.

A module for testing the classes in the bitmap module