Main Page   Modules   Compound List   File List   Compound Members   File Members  

image_bit.h

Go to the documentation of this file.
00001 
00014 /* This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2.1 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #ifndef _GAN_IMAGE_BIT_H
00030 #define _GAN_IMAGE_BIT_H
00031 
00032 #include <gandalf/common/bit_array.h>
00033 
00034 #define GAN_PIXEL Gan_BitWord
00035 #define GAN_PIXEL_FORMAT grey-level
00036 #define GAN_PIXEL_TYPE Gan_Bool
00037 #define GAN_IMTYPE b
00038 #define GAN_IMAGE_FORM_GEN gan_image_form_gen_b
00039 #define GAN_IMAGE_SET_GEN gan_image_set_gen_b
00040 #define GAN_IMAGE_ALLOC gan_image_alloc_b
00041 #define GAN_IMAGE_ALLOC_DATA gan_image_alloc_data_b
00042 #define GAN_IMAGE_FORM gan_image_form_b
00043 #define GAN_IMAGE_FORM_DATA gan_image_form_data_b
00044 #define GAN_IMAGE_SET gan_image_set_b
00045 #define GAN_IMAGE_SET_PIX gan_image_set_pix_b
00046 #define GAN_IMAGE_GET_PIX gan_image_get_pix_b
00047 #define GAN_IMAGE_FILL_CONST gan_image_fill_const_b
00048 #define GAN_IMAGE_GET_ACTIVE_SUBWINDOW gan_image_get_active_subwindow_b
00049 #define GAN_IMAGE_MASK_WINDOW gan_image_mask_window_b
00050 
00051 /* to generate bitmap-specific code */
00052 #define GAN_BITMAP
00053 
00073 /* This library is free software; you can redistribute it and/or
00074    modify it under the terms of the GNU Lesser General Public
00075    License as published by the Free Software Foundation; either
00076    version 2.1 of the License, or (at your option) any later version.
00077 
00078    This library is distributed in the hope that it will be useful,
00079    but WITHOUT ANY WARRANTY; without even the implied warranty of
00080    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00081    Lesser General Public License for more details.
00082 
00083    You should have received a copy of the GNU Lesser General Public
00084    License along with this library; if not, write to the Free Software
00085    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00086 */
00087 
00088 #include <stdlib.h>
00089 #include <gandalf/common/misc_defs.h>
00090 #include <gandalf/image/image_defs.h>
00091 
00097 #ifdef __cplusplus
00098 extern "C" {
00099 #endif
00100 
00101 /* function declarations */
00102 struct Gan_Image *gan_image_set_gen_b ( struct Gan_Image *img,
00103                                       unsigned long height,
00104                                       unsigned long width,
00105                                       unsigned long stride,
00106                                       Gan_Bool alloc_pix_data );
00107 struct Gan_Image *gan_image_form_gen_b (
00108                                  struct Gan_Image *img,
00109                                  unsigned long height,
00110                                  unsigned long width,
00111                                  unsigned long stride,
00112                                  Gan_Bool alloc_pix_data,
00113                                  Gan_BitWord  *pix_data, size_t pix_data_size,
00114                                  Gan_BitWord **row_data, size_t row_data_size );
00115 Gan_Bool gan_image_get_active_subwindow_b ( Gan_Image *image,
00116                                           Gan_Alignment alignment,
00117                                           Gan_ImageWindow *subwin );
00118 Gan_Bool gan_image_mask_window_b ( Gan_Image *pImage,
00119                                  unsigned r0,     unsigned c0,
00120                                  unsigned height, unsigned width );
00121 
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125 
00126 /* declarations of macros defined in individual header files */
00127 
00142 Gan_Image *gan_image_alloc_b ( unsigned long height, unsigned long width );
00143 
00154 Gan_Image *gan_image_form_b ( Gan_Image *img,
00155                             unsigned long height,
00156                             unsigned long width );
00157 
00174 Gan_Image *gan_image_alloc_data_b ( unsigned long height,
00175                                   unsigned long width,
00176                                   unsigned long stride,
00177                                   Gan_BitWord  *pix_data, size_t pix_data_size,
00178                                   Gan_BitWord **row_data, size_t row_data_size );
00179 
00197 Gan_Image *gan_image_form_data_b ( Gan_Image *img,
00198                                  unsigned long height,
00199                                  unsigned long width,
00200                                  unsigned long stride,
00201                                  Gan_BitWord  *pix_data, size_t pix_data_size,
00202                                  Gan_BitWord **row_data, size_t row_data_size );
00203 
00223 Gan_Image *gan_image_set_b ( Gan_Image *img,
00224                            unsigned long height, unsigned long width );
00225 
00242 Gan_Bool gan_image_set_pix_b ( Gan_Image *img,
00243                              unsigned row, unsigned col, Gan_Bool pix );
00244 
00251 Gan_BitWord gan_image_get_pix_b ( Gan_Image *img,
00252                               unsigned row, unsigned col );
00253 
00269 Gan_Bool gan_image_fill_const_b ( Gan_Image *img, Gan_Bool pix );
00270 
00276 #undef GAN_PIXEL
00277 #undef GAN_PIXEL_FORMAT
00278 #undef GAN_PIXEL_TYPE
00279 #undef GAN_IMTYPE
00280 #undef GAN_IMAGE_FORM_GEN
00281 #undef GAN_IMAGE_SET_GEN
00282 #undef GAN_IMAGE_ALLOC
00283 #undef GAN_IMAGE_ALLOC_DATA
00284 #undef GAN_IMAGE_FORM
00285 #undef GAN_IMAGE_FORM_DATA
00286 #undef GAN_IMAGE_SET
00287 #undef GAN_IMAGE_SET_PIX
00288 #undef GAN_IMAGE_GET_PIX
00289 #undef GAN_IMAGE_GET_PIXPTR
00290 #undef GAN_IMAGE_GET_PIXARR
00291 #undef GAN_IMAGE_FILL_CONST
00292 #undef GAN_IMAGE_GET_ACTIVE_SUBWINDOW
00293 #undef GAN_IMAGE_MASK_WINDOW
00294 #undef GAN_IMAGE_PIXEL_ZERO_VAL
00295 #undef GAN_BITMAP
00296 
00302 #include <gandalf/image/image_defs.h>
00303 
00304 #ifdef __cplusplus
00305 extern "C" {
00306 #endif
00307 
00318 #ifdef NDEBUG
00319 #define gan_image_bit_get_pix_4group(img,row,col)\
00320         (gan_bit_array_get_bit ( &(img)->ba[row],     col     ) && \
00321          gan_bit_array_get_bit ( &(img)->ba[row],     (col)+1 ) && \
00322          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col     ) && \
00323          gan_bit_array_get_bit ( &(img)->ba[(row)+1], (col)+1 ))
00324 #define gan_image_bit_get_pix_5group(img,row,col)\
00325         (gan_bit_array_get_bit ( &(img)->ba[(row)-1], col     ) && \
00326          gan_bit_array_get_bit ( &(img)->ba[row],     (col)-1 ) && \
00327          gan_bit_array_get_bit ( &(img)->ba[row],     col     ) && \
00328          gan_bit_array_get_bit ( &(img)->ba[row],     (col)+1 ) && \
00329          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col     ))
00330 #define gan_image_bit_get_pix_3group_horiz(img,row,col)\
00331         (gan_bit_array_get_bit ( &(img)->ba[row], (col)-1 ) && \
00332          gan_bit_array_get_bit ( &(img)->ba[row], col     ) && \
00333          gan_bit_array_get_bit ( &(img)->ba[row], (col)+1 ))
00334 #define gan_image_bit_get_pix_3group_vert(img,row,col)\
00335         (gan_bit_array_get_bit ( &(img)->ba[(row)-1], col ) && \
00336          gan_bit_array_get_bit ( &(img)->ba[row],     col ) && \
00337          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col ))
00338 #else
00339 Gan_Bool gan_image_bit_get_pix_4group ( Gan_Image *image,
00340                                         unsigned row, unsigned col );
00341 Gan_Bool gan_image_bit_get_pix_5group ( Gan_Image *image,
00342                                         unsigned row, unsigned col );
00343 Gan_Bool gan_image_bit_get_pix_3group_horiz ( Gan_Image *image,
00344                                               unsigned row, unsigned col );
00345 Gan_Bool gan_image_bit_get_pix_3group_vert ( Gan_Image *image,
00346                                              unsigned row, unsigned col );
00347 #endif /* #ifdef NDEBUG */
00348 
00349 int gan_image_get_pixel_count_b ( Gan_Image *image, Gan_Bool val,
00350                                   Gan_ImageWindow *subwin );
00351 Gan_Image *gan_image_bit_invert_q ( Gan_Image *image,
00352                                     Gan_Image *result_image );
00353 Gan_Image *gan_image_bit_and_q ( Gan_Image *image1, Gan_Image *image2,
00354                                  Gan_Image *result_image );
00355 Gan_Image *gan_image_bit_nand_q ( Gan_Image *image1, Gan_Image *image2,
00356                                   Gan_Image *result_image );
00357 Gan_Image *gan_image_bit_or_q ( Gan_Image *image1, Gan_Image *image2,
00358                                 Gan_Image *result_image );
00359 Gan_Image *gan_image_bit_eor_q ( Gan_Image *image1, Gan_Image *image2,
00360                                  Gan_Image *result_image );
00361 Gan_Image *gan_image_bit_andnot_q ( Gan_Image *image1, Gan_Image *image2,
00362                                     Gan_Image *result_image );
00363 Gan_Bool gan_image_bit_fill_row ( Gan_Image *image, unsigned y,
00364                                   unsigned x, unsigned width, Gan_Bool pix );
00365 Gan_Bool gan_image_bit_invert_row ( Gan_Image *image, unsigned y,
00366                                     unsigned x, unsigned width );
00367 
00375 Gan_Image *gan_image_bit_invert_s ( Gan_Image *image );
00376 
00384 Gan_Image *gan_image_bit_invert_i ( Gan_Image *image );
00385 
00393 Gan_Image *gan_image_bit_and_s ( Gan_Image *image1, Gan_Image *image2 );
00394 
00402 Gan_Image *gan_image_bit_nand_s ( Gan_Image *image1, Gan_Image *image2 );
00403 
00411 Gan_Image *gan_image_bit_or_s ( Gan_Image *image1, Gan_Image *image2 );
00412 
00420 Gan_Image *gan_image_bit_eor_s ( Gan_Image *image1, Gan_Image *image2 );
00421 
00429 Gan_Image *gan_image_bit_andnot_s ( Gan_Image *image1, Gan_Image *image2 );
00430 
00438 Gan_Image *gan_image_bit_and_i ( Gan_Image *result, Gan_Image *image );
00439 
00447 Gan_Image *gan_image_bit_nand_i ( Gan_Image *result, Gan_Image *image );
00448 
00456 Gan_Image *gan_image_bit_or_i ( Gan_Image *result, Gan_Image *image );
00457 
00465 Gan_Image *gan_image_bit_eor_i ( Gan_Image *result, Gan_Image *image );
00466 
00474 Gan_Image *gan_image_bit_andnot_i ( Gan_Image *result, Gan_Image *image );
00475 
00484 #ifdef __cplusplus
00485 }
00486 #endif
00487 
00488 #endif /* #ifndef _GAN_IMAGE_BIT_H */

Generated on Mon Oct 13 16:14:32 2003 by doxygen1.3-rc1