Advertisement
Guest User

Andrew Boktor

a guest
Jun 1st, 2009
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.57 KB | None | 0 0
  1. // Reference:
  2. // http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html
  3. // and Image Denoising CUDA
  4.  
  5.  
  6. /*
  7. This file is part of Steganography.
  8.  
  9. Copyright (C) 2008 Andrew Boktor <andrew.boktor@gmail.com>
  10.             and Marleine Daoud <marleine@gmail.com>
  11.  
  12. Steganography is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. */
  16.  
  17. // uchar4 definition used as struct of image components (ARGB)
  18. typedef struct{
  19.     unsigned char r, g, b, a;
  20. } uchar4;
  21.  
  22. // struct for Bit-Map file header
  23. typedef struct{
  24.     short bf_type; // must always be set to 'BM' to declare that this is a .bmp-file
  25.     int bf_size; // specifies the size of the file in bytes
  26.     short bf_reserved1; // must always be set to zero
  27.     short bf_reserved2; // must always be set to zero
  28.     int bf_Off_Bits; // specifies the offset from the beginning of the file to the bitmap data
  29. } BMPHeader;
  30.  
  31. // struct for Bit-Map file info header
  32. typedef struct{
  33.     int bi_size; // specifies the size of the BITMAPINFOHEADER structure, in bytes
  34.     int bi_width; // specifies the width of the image, in pixels
  35.     int bi_height; // specifies the height of the image, in pixels
  36.     short bi_planes; // specifies the number of planes of the target device, must be set to zero
  37.     short bi_bit_count; // specifies the number of bits per pixel
  38.     unsigned bi_compression; //Specifies the type of compression, usually set to zero (no compression)
  39.     unsigned bi_size_image; // specifies the size of the image data, in bytes. If there is no compression, it is valid to set this member to zero
  40.     int bixPelsPerMeter; // specifies the the horizontal pixels per meter on the designated targer device, usually set to zero
  41.     int biyPelsPerMeter; // specifies the the vertical pixels per meter on the designated targer device, usually set to zero
  42.     int biclrUsed; // specifies the number of colors used in the bitmap, if set to zero the number of colors is calculated using the biBitCount member
  43.     int biclrImportant; // specifies the number of color that are 'important' for the bitmap, if set to zero, all colors are important
  44. } BMPInfoHeader;
  45.  
  46. void load_bmp_file(uchar4 **dst, int *width, int *height, const char *name, BMPHeader *hdrt, BMPInfoHeader *infoHdrt);
  47. void save_bmp_file(uchar4 **data, BMPHeader *hdr, BMPInfoHeader *infoHdr, const char *filename);
  48. long load_file(uchar4 **dst, const char *name);
  49. long load_file1(char **dst, const char *name);
  50. void save_file(char *dst, const char *name, int size);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement