home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / gutenprint / image.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-03-15  |  4.6 KB  |  147 lines

  1. /*
  2.  * "$Id: image.h,v 1.2 2005/10/18 02:08:16 rlk Exp $"
  3.  *
  4.  *   libgimpprint image functions.
  5.  *
  6.  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
  7.  *    Robert Krawitz (rlk@alum.mit.edu)
  8.  *
  9.  *   This program is free software; you can redistribute it and/or modify it
  10.  *   under the terms of the GNU General Public License as published by the Free
  11.  *   Software Foundation; either version 2 of the License, or (at your option)
  12.  *   any later version.
  13.  *
  14.  *   This program is distributed in the hope that it will be useful, but
  15.  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16.  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17.  *   for more details.
  18.  *
  19.  *   You should have received a copy of the GNU General Public License
  20.  *   along with this program; if not, write to the Free Software
  21.  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22.  */
  23.  
  24. /**
  25.  * @file gutenprint/image.h
  26.  * @brief Image functions.
  27.  */
  28.  
  29. #ifndef GUTENPRINT_IMAGE_H
  30. #define GUTENPRINT_IMAGE_H
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. /**
  37.  * The image type is an abstract data type for interfacing with the
  38.  * image creation program.
  39.  *
  40.  * @defgroup image image
  41.  * @{
  42.  */
  43.  
  44. /*
  45.  * Constants...
  46.  */
  47.  
  48. /*! The maximum number of channels. */
  49. #define STP_CHANNEL_LIMIT    (32)
  50.  
  51.  
  52. /** Image status. */
  53. typedef enum
  54. {
  55.   STP_IMAGE_STATUS_OK,   /*!< Everything is OK. */
  56.   STP_IMAGE_STATUS_ABORT /*!< An error occured, or the job was aborted. */
  57. } stp_image_status_t;
  58.  
  59. /**
  60.  * The image type is an abstract data type for interfacing with the
  61.  * image creation program.  It provides callbacks to functions defined
  62.  * within the client application which are called while printing the
  63.  * image.
  64.  */
  65. typedef struct stp_image
  66. {
  67.   /**
  68.    * This callback is used to perform any initialization required by
  69.    * the image layer for the image.  It will be called once per image.
  70.    * @param image the image in use.
  71.    */
  72.   void (*init)(struct stp_image *image);
  73.   /**
  74.    * This callback is called to reset the image to the beginning.  It
  75.    * may (in principle) be called multiple times if a page is being
  76.    * printed more than once.
  77.    * @warning The reset() call may be removed in the future.
  78.    * @param image the image in use.
  79.    */
  80.   void (*reset)(struct stp_image *image);
  81.   /**
  82.    * This callback returns the width of the image in pixels.
  83.    * @param image the image in use.
  84.    */
  85.   int  (*width)(struct stp_image *image);
  86.   /**
  87.    * This callback returns the height of the image in pixels.
  88.    * @param image the image in use.
  89.    */
  90.   int  (*height)(struct stp_image *image);
  91.   /**
  92.    * This callback transfers the data from the image to the gimp-print
  93.    * library.  It is called from the driver layer.  It should copy
  94.    * WIDTH (as returned by the width() member) pixels of data into the
  95.    * data buffer.  It normally returns STP_IMAGE_STATUS_OK; if
  96.    * something goes wrong, or the application wishes to stop producing
  97.    * any further output (e. g. because the user cancelled the print
  98.    * job), it should return STP_IMAGE_STATUS_ABORT.  This will cause
  99.    * the driver to flush any remaining data to the output.  It will
  100.    * always request rows in monotonically ascending order, but it may
  101.    * skip rows (if, for example, the resolution of the input is higher
  102.    * than the resolution of the output).
  103.    * @param image the image in use.
  104.    * @param data a pointer to width() bytes of pixel data.
  105.    * @param byte_limit (image width * number of channels).
  106.    * @param row (unused).
  107.    */
  108.   stp_image_status_t (*get_row)(struct stp_image *image, unsigned char *data,
  109.                                 size_t byte_limit, int row);
  110.  
  111.   /**
  112.    * This callback returns the name of the application.  This is
  113.    * embedded in the output by some drivers.
  114.    */
  115.   const char *(*get_appname)(struct stp_image *image);
  116.   /**
  117.    * This callback is called at the end of each page.
  118.    */
  119.   void (*conclude)(struct stp_image *image);
  120.   /**
  121.    * A pointer to an application-specific state information that might
  122.    * need to be associated with the image object.
  123.    */
  124.   void *rep;
  125. } stp_image_t;
  126.  
  127. extern void stp_image_init(stp_image_t *image);
  128. extern void stp_image_reset(stp_image_t *image);
  129. extern int stp_image_width(stp_image_t *image);
  130. extern int stp_image_height(stp_image_t *image);
  131. extern stp_image_status_t stp_image_get_row(stp_image_t *image,
  132.                         unsigned char *data,
  133.                         size_t limit, int row);
  134. extern const char *stp_image_get_appname(stp_image_t *image);
  135. extern void stp_image_conclude(stp_image_t *image);
  136.  
  137.   /** @} */
  138.  
  139. #ifdef __cplusplus
  140.   }
  141. #endif
  142.  
  143. #endif /* GUTENPRINT_IMAGE_H */
  144. /*
  145.  * End of "$Id: image.h,v 1.2 2005/10/18 02:08:16 rlk Exp $".
  146.  */
  147.