chiark / gitweb /
New inline function ri_rgb; introduce typedef for rgb sample
[ypp-sc-tools.db-test.git] / pctb / convert.h
index 0abdf93c5c48e5ee986a1b50cec5fef03963b26e..b61563fd32449c200b6915484b4fcc9a3d3c7a33 100644 (file)
@@ -51,12 +51,22 @@ typedef struct RgbImage {
    */
 } RgbImage;
 
+typedef unsigned long Rgb;
+
 void identify_rgbimage(const RgbImage *base, Rect portion,
                       char result[MAXIMGIDENT], const char *what);
 RgbImage *alloc_rgb_image(int w, int h);
+void fwrite_ppmraw(FILE *f, const RgbImage *ri);
 
 #define RI_PIXEL(ri,x,y) ((ri)->data + ((y)*(ri)->w + (x)) * 3)
 
+static inline Rgb ri_rgb(const RgbImage *ri, int x, int y) {
+  const unsigned char *rip= RI_PIXEL(ri,x,y);
+  return (rip[0] << 16) |
+         (rip[1] <<  8) |
+         (rip[2]      );
+}
+
 /*----- from structure.c -----*/
 
 void find_structure(const CanonImage *im, int *max_relevant_y_r);
@@ -117,7 +127,6 @@ void take_one_screenshot(void);
 #define MAX_PAGES 100
 extern CanonImage *page_images[MAX_PAGES];
 extern int npages;
-RgbImage *page0_rgbimage;
 
 extern const char *ocean, *pirate;
 extern char *archipelago, *island;