home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / bomb.tar.gz / bomb.tar / bomb / image.h < prev    next >
C/C++ Source or Header  |  1997-04-25  |  2KB  |  66 lines

  1. /*
  2.     bomb - automatic interactive visual stimulation
  3.     Copyright (C) 1995  Scott Draves <spot@cs.cmu.edu>
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20.  
  21. /* simple image package.
  22.    images are uniformly chunky 32 bit.
  23.    subimages are handled (basically instead of rect struct)
  24.    allocation is bizarre, redo
  25.    */
  26.  
  27. typedef struct {unsigned char r, g, b, a;} Pixel;
  28.  
  29. #define alpha_mask   0xff000000
  30. #define rgb_mask     0x00ffffff
  31. #define alpha_solid  0xff
  32. #define alpha_clear  0x00
  33.  
  34. typedef struct Image {
  35.   Pixel *pixels; /* only a freeable pointer if NULL==parent */
  36.   int width, height, stride;
  37.   int origin_x, origin_y; /* vector from origin of parent to this image */
  38.   struct Image *parent;
  39. } Image;
  40.  
  41. #define TCL_ERROR 0
  42. #define TCL_OK    1
  43.  
  44. /* memory mgt */
  45. extern void image_init(Image *);
  46. extern Image *image_allocate(Image *, int, int);
  47. extern Image *image_subimage(Image *image, Image *of, int x, int y, int w, int h);
  48. extern void image_destroy(Image *);
  49.  
  50. extern Image *image_random_tile(Image *image, Image *of, int size);
  51. extern void image_mean_pixel(Image *img, Pixel *pix);
  52.  
  53. /* io */
  54. extern int image_read(Image *, char *);
  55.  
  56. /* ops */
  57. extern void image_filter_down(Image *from, Image *to);
  58. extern void image_blit(Image *from, Image *to);
  59. extern void image_blit_masked(Image *from, Image *to);
  60. extern void image_fill(Image *, Pixel);
  61. extern void image_random(Image *);
  62.  
  63. /* associative search */
  64. extern void image_match_fast(Image *base, Image *image,
  65.                  Image *best, int ntries, double *best_diff);
  66.