Main Page | Modules | Class List | File List | Class 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 #define GAN_IMAGE_MASK_WINDOW gan_image_mask_window_b
00051 #define GAN_IMAGE_CLEAR_WINDOW gan_image_clear_window_b
00052 
00053 /* to generate bitmap-specific code */
00054 #define GAN_BITMAP
00055 
00075 /* This library is free software; you can redistribute it and/or
00076    modify it under the terms of the GNU Lesser General Public
00077    License as published by the Free Software Foundation; either
00078    version 2.1 of the License, or (at your option) any later version.
00079 
00080    This library is distributed in the hope that it will be useful,
00081    but WITHOUT ANY WARRANTY; without even the implied warranty of
00082    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00083    Lesser General Public License for more details.
00084 
00085    You should have received a copy of the GNU Lesser General Public
00086    License along with this library; if not, write to the Free Software
00087    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00088 */
00089 
00090 #include <stdlib.h>
00091 #include <gandalf/common/misc_defs.h>
00092 #include <gandalf/image/image_defs.h>
00093 
00099 #ifdef __cplusplus
00100 extern "C" {
00101 #endif
00102 
00103 /* function declarations */
00104 
00112  struct Gan_Image *gan_image_set_gen_b ( Gan_Image *img,
00113                                       unsigned long height,
00114                                       unsigned long width,
00115                                       unsigned long stride,
00116                                       Gan_Bool alloc_pix_data );
00128  struct Gan_Image *gan_image_form_gen_b (
00129                                  Gan_Image *img,
00130                                  unsigned long height,
00131                                  unsigned long width,
00132                                  unsigned long stride,
00133                                  Gan_Bool alloc_pix_data,
00134                                  Gan_BitWord  *pix_data, size_t pix_data_size,
00135                                  Gan_BitWord **row_data, size_t row_data_size );
00136 
00155  Gan_Bool gan_image_get_active_subwindow_b ( const Gan_Image *image,
00156                                           Gan_Alignment alignment,
00157                                           Gan_ImageWindow *subwin );
00171  Gan_Bool gan_image_mask_window_b ( Gan_Image *pImage,
00172                                  unsigned r0,     unsigned c0,
00173                                  unsigned height, unsigned width );
00174 
00179  Gan_Bool gan_image_clear_window_b ( Gan_Image *pImage,
00180                                   unsigned r0,     unsigned c0,
00181                                   unsigned height, unsigned width );
00186 #if defined(GAN_IMAGE_GET_MINIMUM_PIXEL) && !defined(GAN_BITMAP)
00187 
00191  Gan_Bool GAN_IMAGE_GET_MINIMUM_PIXEL ( const Gan_Image *pImage,
00192                                        const Gan_Image *pMask,
00193                                        Gan_BitWord *minval );
00194  Gan_Bool GAN_IMAGE_GET_MAXIMUM_PIXEL ( const Gan_Image *pImage,
00195                                        const Gan_Image *pMask,
00196                                        Gan_BitWord *maxval );
00200 #endif /* defined(GAN_IMAGE_GET_MINIMUM_PIXEL) && !defined(GAN_BITMAP) */
00201 
00202 #ifdef __cplusplus
00203 }
00204 #endif
00205 
00206 /* declarations of macros defined in individual header files */
00207 
00222 Gan_Image *gan_image_alloc_b ( unsigned long height, unsigned long width );
00223 
00234 Gan_Image *gan_image_form_b ( Gan_Image *img,
00235                             unsigned long height,
00236                             unsigned long width );
00237 
00254 Gan_Image *gan_image_alloc_data_b ( unsigned long height,
00255                                   unsigned long width,
00256                                   unsigned long stride,
00257                                   Gan_BitWord  *pix_data, size_t pix_data_size,
00258                                   Gan_BitWord **row_data, size_t row_data_size );
00259 
00277 Gan_Image *gan_image_form_data_b ( Gan_Image *img,
00278                                  unsigned long height,
00279                                  unsigned long width,
00280                                  unsigned long stride,
00281                                  Gan_BitWord  *pix_data, size_t pix_data_size,
00282                                  Gan_BitWord **row_data, size_t row_data_size );
00283 
00303 Gan_Image *gan_image_set_b ( Gan_Image *img,
00304                            unsigned long height, unsigned long width );
00305 
00322 Gan_Bool gan_image_set_pix_b ( Gan_Image *img,
00323                              unsigned row, unsigned col, Gan_Bool pix );
00324 
00331 Gan_BitWord gan_image_get_pix_b ( const Gan_Image *img,
00332                               unsigned row, unsigned col );
00333 
00349 Gan_Bool gan_image_fill_const_b ( Gan_Image *img, Gan_Bool pix );
00350 
00356 #undef GAN_PIXEL
00357 #undef GAN_PIXEL_FORMAT
00358 #undef GAN_PIXEL_TYPE
00359 #undef GAN_IMTYPE
00360 #undef GAN_IMAGE_FORM_GEN
00361 #undef GAN_IMAGE_SET_GEN
00362 #undef GAN_IMAGE_ALLOC
00363 #undef GAN_IMAGE_ALLOC_DATA
00364 #undef GAN_IMAGE_FORM
00365 #undef GAN_IMAGE_FORM_DATA
00366 #undef GAN_IMAGE_SET
00367 #undef GAN_IMAGE_SET_PIX
00368 #undef GAN_IMAGE_GET_PIX
00369 #undef GAN_IMAGE_GET_PIXPTR
00370 #undef GAN_IMAGE_GET_PIXARR
00371 #undef GAN_IMAGE_FILL_CONST
00372 #undef GAN_IMAGE_GET_ACTIVE_SUBWINDOW
00373 #undef GAN_IMAGE_MASK_WINDOW
00374 #undef GAN_IMAGE_CLEAR_WINDOW
00375 #undef GAN_IMAGE_GET_MINIMUM_PIXEL
00376 #undef GAN_IMAGE_GET_MAXIMUM_PIXEL
00377 #undef GAN_IMAGE_PIXEL_MIN_VAL
00378 #undef GAN_IMAGE_PIXEL_MAX_VAL
00379 #undef GAN_IMAGE_PIXEL_ZERO_VAL
00380 #undef GAN_BITMAP
00381 
00387 #include <gandalf/image/image_defs.h>
00388 
00389 #ifdef __cplusplus
00390 extern "C" {
00391 #endif
00392 
00403 #ifdef NDEBUG
00404 #define gan_image_bit_get_pix_4group(img,row,col)\
00405         (gan_bit_array_get_bit ( &(img)->ba[row],     col     ) && \
00406          gan_bit_array_get_bit ( &(img)->ba[row],     (col)+1 ) && \
00407          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col     ) && \
00408          gan_bit_array_get_bit ( &(img)->ba[(row)+1], (col)+1 ))
00409 #define gan_image_bit_get_pix_5group(img,row,col)\
00410         (gan_bit_array_get_bit ( &(img)->ba[(row)-1], col     ) && \
00411          gan_bit_array_get_bit ( &(img)->ba[row],     (col)-1 ) && \
00412          gan_bit_array_get_bit ( &(img)->ba[row],     col     ) && \
00413          gan_bit_array_get_bit ( &(img)->ba[row],     (col)+1 ) && \
00414          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col     ))
00415 #define gan_image_bit_get_pix_9group(img,row,col)\
00416         (gan_bit_array_get_bit ( &(img)->ba[(row)-1], (col)-1 ) && \
00417          gan_bit_array_get_bit ( &(img)->ba[(row)-1], col     ) && \
00418          gan_bit_array_get_bit ( &(img)->ba[(row)-1], (col)+1 ) && \
00419          gan_bit_array_get_bit ( &(img)->ba[row],     (col)-1 ) && \
00420          gan_bit_array_get_bit ( &(img)->ba[row],     col     ) && \
00421          gan_bit_array_get_bit ( &(img)->ba[row],     (col)+1 ) && \
00422          gan_bit_array_get_bit ( &(img)->ba[(row)+1], (col)-1 ) && \
00423          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col     ) && \
00424          gan_bit_array_get_bit ( &(img)->ba[(row)+1], (col)+1))
00425 #define gan_image_bit_get_pix_3group_horiz(img,row,col)\
00426         (gan_bit_array_get_bit ( &(img)->ba[row], (col)-1 ) && \
00427          gan_bit_array_get_bit ( &(img)->ba[row], col     ) && \
00428          gan_bit_array_get_bit ( &(img)->ba[row], (col)+1 ))
00429 #define gan_image_bit_get_pix_3group_vert(img,row,col)\
00430         (gan_bit_array_get_bit ( &(img)->ba[(row)-1], col ) && \
00431          gan_bit_array_get_bit ( &(img)->ba[row],     col ) && \
00432          gan_bit_array_get_bit ( &(img)->ba[(row)+1], col ))
00433 #else
00434  Gan_Bool gan_image_bit_get_pix_4group ( const Gan_Image *image,
00435                                         unsigned row, unsigned col );
00436  Gan_Bool gan_image_bit_get_pix_5group ( const Gan_Image *image,
00437                                         unsigned row, unsigned col );
00438  Gan_Bool gan_image_bit_get_pix_9group ( const Gan_Image *image,
00439                                         unsigned row, unsigned col );
00440  Gan_Bool gan_image_bit_get_pix_3group_horiz ( const Gan_Image *image,
00441                                               unsigned row, unsigned col );
00442  Gan_Bool gan_image_bit_get_pix_3group_vert ( const Gan_Image *image,
00443                                              unsigned row, unsigned col );
00444 #endif /* #ifdef NDEBUG */
00445 
00446  int gan_image_get_pixel_count_b ( const Gan_Image *image, Gan_Bool val,
00447                                   const Gan_ImageWindow *psubwin );
00448  Gan_Image *gan_image_bit_invert_q ( Gan_Image *image,
00449                                     Gan_Image *result_image );
00450  Gan_Image *gan_image_bit_and_q ( Gan_Image *image1, Gan_Image *image2,
00451                                  Gan_Image *result_image );
00452  Gan_Image *gan_image_bit_nand_q ( Gan_Image *image1, Gan_Image *image2,
00453                                   Gan_Image *result_image );
00454  Gan_Image *gan_image_bit_or_q ( Gan_Image *image1, Gan_Image *image2,
00455                                 Gan_Image *result_image );
00456  Gan_Image *gan_image_bit_eor_q ( Gan_Image *image1, Gan_Image *image2,
00457                                  Gan_Image *result_image );
00458  Gan_Image *gan_image_bit_andnot_q ( Gan_Image *image1, Gan_Image *image2,
00459                                     Gan_Image *result_image );
00460  Gan_Bool gan_image_bit_fill_row ( Gan_Image *image, unsigned y,
00461                                   unsigned x, unsigned width, Gan_Bool pix );
00462  Gan_Bool gan_image_bit_invert_row ( Gan_Image *image, unsigned y,
00463                                     unsigned x, unsigned width );
00464  Gan_Bool gan_image_bit_dilate_horiz ( Gan_Image *image, int no_pixels,
00465                                       Gan_Image *restrict_mask );
00466  Gan_Bool gan_image_bit_dilate_vert ( Gan_Image *image, int no_pixels,
00467                                      Gan_Image *restrict_mask );
00468  Gan_Bool gan_image_bit_shift ( const Gan_Image *image, int vshift, int hshift,
00469                                Gan_Image *result_image );
00470 
00478  Gan_Image *gan_image_bit_invert_s ( Gan_Image *image );
00479 
00487  Gan_Image *gan_image_bit_invert_i ( Gan_Image *image );
00488 
00496  Gan_Image *gan_image_bit_and_s ( Gan_Image *image1, Gan_Image *image2 );
00497 
00505  Gan_Image *gan_image_bit_nand_s ( Gan_Image *image1, Gan_Image *image2 );
00506 
00514  Gan_Image *gan_image_bit_or_s ( Gan_Image *image1, Gan_Image *image2 );
00515 
00523  Gan_Image *gan_image_bit_eor_s ( Gan_Image *image1, Gan_Image *image2 );
00524 
00532  Gan_Image *gan_image_bit_andnot_s ( Gan_Image *image1, Gan_Image *image2 );
00533 
00541  Gan_Image *gan_image_bit_and_i ( Gan_Image *result, Gan_Image *image );
00542 
00550  Gan_Image *gan_image_bit_nand_i ( Gan_Image *result, Gan_Image *image );
00551 
00559  Gan_Image *gan_image_bit_or_i ( Gan_Image *result, Gan_Image *image );
00560 
00568  Gan_Image *gan_image_bit_eor_i ( Gan_Image *result, Gan_Image *image );
00569 
00577  Gan_Image *gan_image_bit_andnot_i ( Gan_Image *result, Gan_Image *image );
00578 
00587 #ifdef __cplusplus
00588 }
00589 #endif
00590 
00591 #endif /* #ifndef _GAN_IMAGE_BIT_H */

Generated on Fri Mar 17 12:44:47 2006 by  doxygen 1.3.9.1