00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __IMAGERGBA_H__
00010 #define __IMAGERGBA_H__
00011
00012
00013
00015
00016 {
00017 unsigned char r;
00018 unsigned char g;
00019 unsigned char b;
00020 unsigned char a;
00021 } Rgba;
00022
00024 typedef struct
00025 {
00026 float h;
00027 float s;
00028 float v;
00029 unsigned char a;
00030 } Hsva;
00031
00032
00033
00035
00038 typedef struct
00039 {
00040 int width;
00041 int height;
00042
00043 int bytesPerPixel;
00044
00046
00050 Rgba *data;
00051 } ImageRGBA;
00052
00053
00055 extern ImageRGBA *imageRgbaNew(int width, int height);
00056
00058 extern void imageRgbaFree(ImageRGBA *img);
00059
00060
00062 extern ImageRGBA *imageRgbaClone(const ImageRGBA *img);
00063
00064
00066 extern void imageRgbaCopy(const ImageRGBA *src, const ImageRGBA *dest);
00067
00068
00070 extern void imageRgbaClear(ImageRGBA *img);
00071
00073 extern void imageRgbaSet(ImageRGBA *img,
00074 unsigned r, unsigned g, unsigned b, unsigned a);
00075
00076 extern void imageRgbaSetArea(ImageRGBA *img, int x0, int y0, int x1, int y1, Rgba color);
00077
00079 extern ImageRGBA *imageRgbaReadTIFF(const char *fname);
00080
00082 extern int imageRgbaWriteTIFF(const char *fname, const ImageRGBA *img);
00083
00084
00086
00089
00090 extern void imageRgbaDrawLine(ImageRGBA *img, int x0, int y0, int x1, int y1, Rgba colorValue, int lx0 = 0, int ly0 = 0, int lx1 = -1, int ly1 = -1);
00091
00093
00095
00096 extern void imageRgbaInvertLine(ImageRGBA *img, int x0, int y0, int x1, int y1, int lx0 = 0, int ly0 = 0, int lx1 = -1, int ly1 = -1);
00097
00098
00099 extern void imageRgbaDrawHorizontalAreaLine(ImageRGBA *img, int x0, int x1, int y, int colorOffset);
00100 extern void imageRgbaDrawVerticalAreaLine(ImageRGBA *img, int y0, int y1, int x, int colorOffset);
00101
00103
00106 extern void imageRgbaDrawEllipse(ImageRGBA *img, int cx, int cy, int halfaxis_x, int halfaxis_y, Rgba colorValue, int lx0 = 0, int ly0 = 0, int lx1 = -1, int ly1 = -1);
00107
00108
00110
00112 extern void imageRgbaInvertEllipse(ImageRGBA *img, int cx, int cy, int a, int b);
00113
00114
00116
00118 extern inline void imageRgbaDrawPoint(ImageRGBA *img, int x, int y, Rgba colorValue);
00119
00121
00123 extern inline void imageRgbaDrawInvertedPoint(ImageRGBA *img, int x, int y);
00124
00125 Rgba imageRgbaInterpolate(ImageRGBA *img, float x, float y);
00126 int imageRgbaInterpolateSubImage(ImageRGBA *img, float x, float y, int w, int h, int offset);
00127 Rgba imageRgbaInterpolateColors(float x, float y, Rgba topleft, Rgba topright, Rgba bottomleft, Rgba bottomright);
00128
00129 Hsva RGBtoHSV(Rgba RGBColor);
00130 Rgba HSVtoRGB(Hsva HSVColor);
00131
00132 void gaussian(ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, int mode, unsigned char calc = 1);
00133 void horizontal_blur(ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, int mode, unsigned char calc = 1);
00134 void vertical_blur(ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, int mode, unsigned char calc = 1);
00135 void motion_blur(ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, float value2, int mode, unsigned char calc = 1);
00136
00137 void holdHighest(int *stack, int numElements, int newElement);
00138
00139 #endif