|
Line 0
Link Here
|
|
|
1 |
--- src/core/image.h.orig 2017-11-14 12:16:37 UTC |
| 2 |
+++ src/core/image.h |
| 3 |
@@ -22,10 +22,15 @@ |
| 4 |
#ifndef _IMAGE_H |
| 5 |
#define _IMAGE_H |
| 6 |
|
| 7 |
+#include "allegro.h" |
| 8 |
#include "global.h" |
| 9 |
#include "v2d.h" |
| 10 |
|
| 11 |
-/* opaque image type */ |
| 12 |
+/* image structure */ |
| 13 |
+struct image_t { |
| 14 |
+ BITMAP *data; /* this must be the first field */ |
| 15 |
+ int w, h; |
| 16 |
+}; |
| 17 |
typedef struct image_t image_t; |
| 18 |
|
| 19 |
/* image flags (bitwise OR) */ |
| 20 |
@@ -42,13 +47,29 @@ void image_save(const image_t *img, cons |
| 21 |
image_t *image_create_shared(const image_t *parent, int x, int y, int width, int height); /* creates a sub-image */ |
| 22 |
|
| 23 |
/* properties */ |
| 24 |
-inline int image_width(const image_t *img); |
| 25 |
-inline int image_height(const image_t *img); |
| 26 |
uint32 image_rgb(uint8 r, uint8 g, uint8 b); |
| 27 |
void image_color2rgb(uint32 color, uint8 *r, uint8 *g, uint8 *b); |
| 28 |
int image_pixelperfect_collision(const image_t *img1, const image_t *img2, int x1, int y1, int x2, int y2); |
| 29 |
uint32 image_getpixel(const image_t *img, int x, int y); |
| 30 |
|
| 31 |
+/* |
| 32 |
+ * image_width() |
| 33 |
+ * The width of the image |
| 34 |
+ */ |
| 35 |
+inline int image_width(const image_t *img) |
| 36 |
+{ |
| 37 |
+ return img->w; |
| 38 |
+} |
| 39 |
+ |
| 40 |
+/* |
| 41 |
+ * image_height() |
| 42 |
+ * The height of the image |
| 43 |
+ */ |
| 44 |
+inline int image_height(const image_t *img) |
| 45 |
+{ |
| 46 |
+ return img->h; |
| 47 |
+} |
| 48 |
+ |
| 49 |
/* drawing primitives */ |
| 50 |
void image_clear(image_t *img, uint32 color); |
| 51 |
void image_putpixel(image_t *img, int x, int y, uint32 color); |