~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/sys/image/image.h

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)Image handling headers
  2  */
  3 
  4 #ifndef IMAGE_HEADS_DEFINED
  5 #define IMAGE_HEADS_DEFINED
  6 
  7 /* image related data structures */
  8 
  9 typedef struct imregion
 10 {
 11     Ts_id ts_id;                /* Tina structure identifier */
 12     int     lx, ly;             /* top left */
 13     int     ux, uy;             /* bottom right */
 14 }       Imregion;
 15 #define IMREGION_SWAP_STRING "iiii"
 16 
 17 typedef struct imrect           /* generic image storage */
 18 {
 19     Ts_id ts_id;                /* Tina structure identifier */
 20     Vartype vtype;
 21     int     width, height;      /* of image */
 22     Imregion *region;           /* region covered */
 23     void   *data;               /* array of pointers to rows */
 24     struct list *props;         /* covers all the extras for an edge
 25                                  * rect */
 26 }       Imrect;
 27 #define IMRECT_SWAP_STRING "iiippp"
 28 
 29 /** various image substript macros **/
 30 
 31 #define IM_CHAR(_im,_i,_j)      (((char **)(_im)->data)[(_i)][(_j)])
 32 #define IM_UCHAR(_im,_i,_j)     (((unsigned char **)(_im)->data)[(_i)][(_j)])
 33 #define IM_SHORT(_im,_i,_j)     (((short **)(_im)->data)[(_i)][(_j)])
 34 #define IM_USHORT(_im,_i,_j)    (((unsigned short **)(_im)->data)[(_i)][(_j)])
 35 #define IM_INT(_im,_i,_j)       (((int **)(_im)->data)[(_i)][(_j)])
 36 #define IM_UINT(_im,_i,_j)      (((unsigned int **)(_im)->data)[(_i)][(_j)])
 37 #define IM_FLOAT(_im,_i,_j)     (((float **)(_im)->data)[(_i)][(_j)])
 38 #define IM_DOUBLE(_im,_i,_j)    (((double **)(_im)->data)[(_i)][(_j)])
 39 #define IM_COMPLEX(_im,_i,_j)   (((Complex **)(_im)->data)[(_i)][(_j)])
 40 #define IM_PTR(_im,_i,_j)       (((void ***)(_im)->data)[(_i)][(_j)])
 41 
 42 #define IM_VRAM0(_im,_i,_j)  \
 43 (((Vram **)(_im)->data)[(_i)][(_j)].vram0)
 44 
 45 #define IM_VRAM1(_im,_i,_j) \
 46 (((Vram **)(_im)->data)[(_i)][(_j)].vram1)
 47 
 48 #define IM_VRAM2(_im,_i,_j) \
 49 (((Vram **)(_im)->data)[(_i)][(_j)].vram2)
 50 
 51 #define IM_VRAM3(_im,_i,_j) \
 52 (((Vram **)(_im)->data)[(_i)][(_j)].vram3)
 53 
 54 #define IM_PIX_GET(_im, _i, _j, _gl) \
 55         switch ((_im)->vtype) \
 56         {\
 57              case char_v: (_gl)       = (char) IM_CHAR((_im),(_i),(_j)); \
 58                           break;\
 59              case uchar_v: (_gl)      = (unsigned char) IM_UCHAR((_im),(_i),(_j)); \
 60                           break;\
 61              case short_v: (_gl)      = (short) IM_SHORT((_im),(_i),(_j)); \
 62                           break;\
 63              case ushort_v: (_gl)     = (unsigned short) IM_USHORT((_im),(_i),(_j)); \
 64                           break;\
 65              case int_v: (_gl)        = (int) IM_INT((_im),(_i),(_j)); \
 66                           break;\
 67              case uint_v: (_gl)       = (unsigned int) IM_UINT((_im),(_i),(_j)); \
 68                           break;\
 69              case float_v: (_gl)      = (float) IM_FLOAT((_im),(_i),(_j)); \
 70                           break;\
 71              case double_v: (_gl)     = (double) IM_DOUBLE((_im),(_i),(_j)); \
 72                           break;\
 73              case complex_v: (_gl)    = (double) IM_COMPLEX((_im),(_i),(_j)).x; \
 74                           break;\
 75              case ptr_v: (_gl)        = (int)IM_PTR((_im),(_i),(_j)); \
 76                           break;\
 77              case vram0_v: (_gl)      = (unsigned char) IM_VRAM0((_im),(_i),(_j)); \
 78                           break;\
 79              case vram1_v: (_gl)      = (unsigned char) IM_VRAM1((_im),(_i),(_j)); \
 80                           break;\
 81              case vram2_v: (_gl)      = (unsigned char) IM_VRAM2((_im),(_i),(_j)); \
 82                           break;\
 83              case vram3_v: (_gl)      = (unsigned char) IM_VRAM3((_im),(_i),(_j)); \
 84                           break;\
 85         }
 86 
 87 #define IM_PIX_GETP(_im,_i,_j,_ptr) \
 88         switch ((_im)->vtype) \
 89         {\
 90              case char_v: (_ptr)    = &IM_CHAR((_im),(_i),(_j)); \
 91                           break;\
 92              case uchar_v: (_ptr)   = &IM_UCHAR((_im),(_i),(_j)); \
 93                           break;\
 94              case short_v: (_ptr)   = &IM_SHORT((_im),(_i),(_j)); \
 95                           break;\
 96              case ushort_v: (_ptr)  = &IM_USHORT((_im),(_i),(_j)); \
 97                           break;\
 98              case int_v: (_ptr)     = &IM_INT((_im),(_i),(_j)); \
 99                           break;\
100              case uint_v: (_ptr)    = &IM_UINT((_im),(_i),(_j)); \
101                           break;\
102              case float_v: (_ptr)   = &IM_FLOAT((_im),(_i),(_j)); \
103                           break;\
104              case double_v: (_ptr)  = &IM_DOUBLE((_im),(_i),(_j)); \
105                           break;\
106              case ptr_v: (_ptr)     = IM_PTR((_im),(_i),(_j)); \
107                           break;\
108              case complex_v: (_ptr) = &IM_COMPLEX((_im),(_i),(_j)); \
109                           break;\
110         }
111 
112 #define IM_PIX_GETZ(_im, _i, _j, _gl) \
113     {\
114         if ((_im)->vtype == complex_v)\
115             (_gl) = IM_COMPLEX((_im), (_i), (_j));\
116         else\
117         {\
118             IM_PIX_GET((_im), (_i), (_j), (_gl).x);\
119             (_gl).y = 0.0;\
120         }\
121     }
122 
123 #define IM_PIX_SET(_im,_i,_j,_gl) \
124         switch ((_im)->vtype) \
125         {\
126              case char_v: IM_CHAR((_im),(_i),(_j)) = (char) (_gl); \
127                           break;\
128              case uchar_v: IM_UCHAR((_im),(_i),(_j)) = (unsigned char) (_gl); \
129                           break;\
130              case short_v: IM_SHORT((_im),(_i),(_j)) = (short) (_gl); \
131                           break;\
132              case ushort_v: IM_USHORT((_im),(_i),(_j)) = (unsigned short) (_gl); \
133                           break;\
134              case int_v: IM_INT((_im),(_i),(_j)) = (int) (_gl); \
135                           break;\
136              case uint_v: IM_UINT((_im),(_i),(_j)) = (unsigned int) (_gl); \
137                           break;\
138              case float_v: IM_FLOAT((_im),(_i),(_j)) = (float) (_gl); \
139                           break;\
140              case double_v: IM_DOUBLE((_im),(_i),(_j)) = (double) (_gl); \
141                           break;\
142              case complex_v: IM_COMPLEX((_im),(_i),(_j)).x = (double) (_gl); \
143                           break;\
144              case ptr_v: IM_PTR((_im),(_i),(_j)) = (void *)(int) (_gl); \
145                           break;\
146              case vram0_v: IM_VRAM0((_im),(_i),(_j)) = (unsigned char)(_gl); \
147                           break;\
148              case vram1_v: IM_VRAM1((_im),(_i),(_j)) = (unsigned char)(_gl); \
149                           break;\
150              case vram2_v: IM_VRAM2((_im),(_i),(_j)) = (unsigned char)(_gl); \
151                           break;\
152              case vram3_v: IM_VRAM3((_im),(_i),(_j)) = (unsigned char)(_gl); \
153                           break;\
154         }
155 
156 #define IM_PIX_SETZ(_im, _i, _j, _gl) \
157     {\
158         if ((_im)->vtype == complex_v)\
159             IM_COMPLEX((_im), (_i), (_j)) = (_gl);\
160         else\
161             IM_PIX_SET((_im), (_i), (_j), (_gl).x);\
162     }
163 
164 #define IM_ROW(_im, _i) (((void **)(_im)->data)[(_i)])
165 
166 /* Get a pointer to a row in an image */
167 #define IM_ROW_GET(_im, _i, _row) _row = IM_ROW(_im, _i);
168 
169 /* Put a pointer to a row in an image (row is (void*)) */
170 #define IM_ROW_SET(_im, _i ,_row) IM_ROW(_im, _i) = _row;
171 
172 #define FOR_IM(_roi,_row,_col) for ((_row)=(_roi)->ly; (_row)<(_roi)->uy; (_row)++) \
173                                  for ((_col)=(_roi)->lx; (_col)<(_roi)->ux; (_col)++)
174 
175 #endif                          /* IMAGE_HEADS_DEFINED */
176 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.