hello, i have an issue with an assignment, we need to implement certain shape, but using a bitmap image. We have a header for this, but cannot figure out exactly what to do. The header file is below, any help or tutorial will help a lot, specifically with the part for pixels and depth
thanks,
#ifndef H_BITMAP_IMAGE_HEADER
#define H_BITMAP_IMAGE_HEADER
#include <string>
using namespace std;
class bitmapImage;
/*
A class for working with the Windows Bitmap File Format.
Supports bit depths of 16, 24, and 32 with uncompressed pixel data.
This does not support compressed bitmaps or bit depths of 1,4, or 8.
Compression is rarely used with this file format, though.
Colors can be specified in RGB format (red, green, and blue
intensity values)
Red, Green, Blue colors range from 0-255
(0 -> off to 255 -> full intensity)
For red, it would be (255, 0, 0) and in hex, (0xff0000).
As a single value, 0xff0000 is 16,711,680
For green, it would be (0, 255, 0) and in hex, (0x00ff00).
As a single value, 0x00ff00 is 65,280
*/
class bitmapImage
{
protected:
int width, height;
int **pixelData;
void freePixelData();
// create bitmap object
bitmapImage bm;
// now set pixels to draw your shape. I chose to draw in red
bm.setPixel ( xPosition, yPostion, 0xff0000);
// set many more pixels
// write out image
bm.saveToBitmapFile("C:\some\file.bmp");
You have to set the pixels to draw the shape you want.