goat3dgfx

diff src/image.h @ 0:1873dfd13f2d

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 14 Nov 2013 05:27:09 +0200
parents
children 3d96734fd477
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/image.h	Thu Nov 14 05:27:09 2013 +0200
     1.3 @@ -0,0 +1,38 @@
     1.4 +#ifndef IMAGE_H_
     1.5 +#define IMAGE_H_
     1.6 +
     1.7 +
     1.8 +class Image {
     1.9 +public:
    1.10 +	enum Format {
    1.11 +		FMT_GREY,
    1.12 +		FMT_RGB,
    1.13 +		FMT_RGBA,
    1.14 +		FMT_GREY_FLOAT,
    1.15 +		FMT_RGB_FLOAT,
    1.16 +		FMT_RGBA_FLOAT
    1.17 +	};
    1.18 +
    1.19 +private:
    1.20 +	Format fmt;
    1.21 +	int width, height;
    1.22 +	void *pixels;
    1.23 +
    1.24 +public:
    1.25 +	Image();
    1.26 +	~Image();
    1.27 +
    1.28 +	int get_width() const;
    1.29 +	int get_height() const;
    1.30 +
    1.31 +	Format get_format() const;
    1.32 +
    1.33 +	bool create(int x, int y, Format fmt = FMT_RGBA);
    1.34 +	bool set_pixels(int x, int y, void *pixels, Format fmt = FMT_RGBA);
    1.35 +	void *get_pixels() const;
    1.36 +
    1.37 +	bool load(const char *fname);
    1.38 +	bool save(const char *fname) const;
    1.39 +};
    1.40 +
    1.41 +#endif	// IMAGE_H_