00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_VIDEO_RENDERBACKENDS_OPENGL_GLIMAGE_H
00023 #define FIFE_VIDEO_RENDERBACKENDS_OPENGL_GLIMAGE_H
00024
00025
00026 #include <vector>
00027
00028
00029 #include "util/base/fife_stdint.h"
00030
00031
00032 #include <SDL_video.h>
00033
00034
00035
00036
00037
00038 #include "video/image.h"
00039
00040 #include "fife_opengl.h"
00041
00042 namespace FIFE {
00043
00044
00045 class SDLImage;
00046
00047
00058 class GLImage : public Image {
00059 public:
00060 GLImage(SDL_Surface* surface);
00061 GLImage(const uint8_t* data, unsigned int width, unsigned int height);
00062 virtual ~GLImage();
00063 void invalidate();
00064 void render(const Rect& rect, SDL_Surface* dst, unsigned char alpha = 255);
00065 void saveImage(const std::string& filename);
00066 bool putPixel(int x, int y, int r, int g, int b, int a = 255);
00067 void drawLine(const Point& p1, const Point& p2, int r, int g, int b, int a = 255);
00068 void drawTriangle(const Point& p1, const Point& p2, const Point& p3, int r, int g, int b, int a = 255);
00069 void drawRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
00070 void fillRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
00071 void drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b, int a = 255);
00072 void drawVertex(const Point& p, const uint8_t size, int r, int g, int b, int a = 255);
00073 void drawLightPrimitive(const Point& p, uint8_t intensity, float radius, int subdivisions, float xstretch, float ystretch, uint8_t red, uint8_t green, uint8_t blue);
00074
00075 protected:
00076 void setClipArea(const Rect& cliparea, bool clear);
00077
00078 private:
00079
00080 float m_col_tex_coord;
00081
00082 float m_row_tex_coord;
00083
00086 GLuint* m_textureids;
00087
00090 void cleanup();
00091
00094 void resetGlimage();
00095
00096
00097
00100 void generateGLTexture();
00101
00109 SDLImage* m_sdlimage;
00110
00111 uint32_t m_chunk_size_w;
00112 uint32_t m_chunk_size_h;
00113
00114 SDL_Color m_colorkey;
00115 };
00116 }
00117
00118 #endif
00119