On Mon, 7 Feb 2000, Andreas Beck wrote:
> I'll try to give you something to play with below:
>
> /*
> * This is a design study for a Generic Picture Format library
> */
>
>
> /* Startup/Shutdown:
> */
>
> gpfInit(void);
> gpfExit(void);
> gpfPanic(const char *format,...);
>
> /* Opening and Closing picture sources
> */
>
> gpf_handle_t gpfOpen(const char *type,const char *location,const char *options, void
>*locationdata, void *optiondata);
>
> /* Open a file of a given type (NULL for autoselect), from "location".
> * location should be in a recognized standard format which has semantics
> * as determined by the library that handles type.
> * Standard behaviour (especially that of the auto target) should be to
> * accept filenames and URLs. Some special formats should be defined
> * to allow for reading from internal sources, pipes and functions.
> */
>
> gpfClose (gpf_handle_t handle);
>
> /* Close a given stream, flush buffers and free ressources.
> */
>
> gpfFlush(gpf_handle_t handle);
> /* Flush buffers just as close would, but keep the file open.
> * May not make sense on all targets.
> */
>
>
> int gpfSelectImage(gpf_handle_t handle,int imagenumber); /* for multiimage Formats */
>
> typedef struct {
> int width,height;
> pixelformat_t pixelformat; /* We can probably borrow from DirectBuffer here */
> } gpf_imageinfo_t;
>
> int gpfGetImageInfo(gpf_handle_t handle,gpf_imageinfo_t *info);
>
> /* get the most important image data */
>
typedef void (*gpfIndicatorCallback)(int pos);
> typedef int (*gpfReadCallback)(int x,int y, int width,int height, void *data, int
>pixelwidth);
typedef int (*gpfWriteCallback)(int x,int y, int width,int height, void *data, int
pixelwidth);
gpfRead(gpf_handle_t handle,gpfReadCallback cbR, gpfIndicatorCallback cbI);
>
> /* Try to read the selected image. the callback will be used like you would use
> * write() and PutBox(); I.e. you call it with the rectangle you have data for
> * and it returns the number of pixels it processed. This gives a small complication,
> * if it doesn't accept whole lines, but that can be taken care of by a single
> * glue function that handles the case by trying to first send the rest of
> * incomplete lines.
> *
> * The reader-libs should use reasonably sized buffers, like one line for simple
> * format, or 8 lines for JPG. Don't know yet what to do about interlaced or
> * progressive formats.
*
* If the cbI callback function is not NULL, it will be called 100 times
* during the reading, allowing you to display a progress indicator.
> */
gpfWrite(gpf_handle_t handle, gpfWriteCallback cbW, gpfIndicatorCallback cbI);
/* Similar to gpfRead.
*/
>
>
> CU, ANdy
>
> --
> = Andreas Beck | Email : <[EMAIL PROTECTED]> =
>
Christoph Egger
E-Mail: [EMAIL PROTECTED]