summaryrefslogtreecommitdiff
path: root/engines/kokompe/kokompe/engine/ppm_image.h
blob: 80527f4fed9cd83b9b42ac289577f2938b906391 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include "vector2.h"
#include <ostream>

typedef _vector2<int> point;

class color
{
	public:
		color(int red, int green, int blue)
		{
			r = red;
			g = green;
			b = blue;
		}
		unsigned char r;
		unsigned char g;
		unsigned char b;
};

class ppm_image
{
	private:
		int my_width;
		int my_height;
		int my_size;
		unsigned char* red;
		unsigned char* green;
		unsigned char* blue;
	
	public:
		ppm_image(int width, int height);
		~ppm_image();
		void write_to_stream(std::ostream& os, int scale = 1);
		void set_pixel(const point& location, const color& c);
		void set_pixel(const point& location, 
			const unsigned char new_red,
			const unsigned char new_green,
			const unsigned char new_blue);
};