Lines Matching refs:image

36 static void* getPixelAddress (const deImage* image, int x, int y)
38 int offset = ((y*image->width) + x) * deImageFormat_getBytesPerPixel(image->format);
39 DE_ASSERT(deInBounds32(x, 0, image->width));
40 DE_ASSERT(deInBounds32(y, 0, image->height));
41 return (void*)((deUint8*)image->pixels + offset);
46 deImage* image = DE_NEW(deImage);
48 if (!image)
51 image->width = width;
52 image->height = height;
53 image->format = format;
54 image->pixels = deMalloc(width * height * bpp);
55 if (!image->pixels)
57 deFree(image);
60 memset(image->pixels, 0, width * height * bpp);
62 return image;
65 void deImage_destroy (deImage* image)
67 deFree(image->pixels);
68 deFree(image);
71 deARGB deImage_getPixel (const deImage* image, int x, int y)
73 void* addr = getPixelAddress(image, x, y);
74 switch (image->format)
84 void deImage_setPixel (deImage* image, int x, int y, deARGB argb)
86 void* addr = getPixelAddress(image, x, y);
87 switch (image->format)
96 deImage* deImage_convertFormat (const deImage* image, deImageFormat format)
98 int width = image->width;
99 int height = image->height;
104 if (format == image->format)
105 memcpy(converted->pixels, image->pixels, width * height * deImageFormat_getBytesPerPixel(format));
111 deImage_setPixel(converted, x, y, deImage_getPixel(image, x, y));
161 void deImage_copyToUint8RGBA (const deImage* image, deUint8* pixels)
163 int width = image->width;
164 int height = image->height;
170 deARGB pixel = deImage_getPixel(image, x, y);
179 void* deImage_getPixelPtr (const deImage* image)
181 return image->pixels;
184 int deImage_getWidth (const deImage* image)
186 return image->width;
189 int deImage_getHeight (const deImage* image)
191 return image->height;