/* qbism.h * * Copyright (C) 2005-2006 by Andy Goth . * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef SEEN_QBISM_H #define SEEN_QBISM_H #include /* Supported transformation operations. */ typedef enum { XOP_PROJECTION, XOP_SHIFT, XOP_SHIFTBACK, XOP_ROTATE, XOP_ROTATEBACK, XOP_MULTIPLY, XOP_SINE, XOP_CONDITIONAL, XOP_COMPLEMENT, XOP_COUNT } xform_op_t; /* Single transformation instruction. */ typedef struct { xform_op_t opcode; /* Operation to perform. */ int source; /* Index of the source register. */ int control; /* Index of the control register. */ int dest; /* Index of the destination register. */ } xform_t; /* Sequence of transformation instructions. */ typedef struct { xform_t* seq; /* The sequence of instructions. */ int seq_len; /* Number of instructions in the sequence. */ int num_regs; /* Number of registers needed. */ } algo_t; /* RGB pixel or register consisting of red, green, and blue channels. */ typedef union { float c[3]; /* Channels by number. */ struct { float r, g, b; /* Channels by name. */ }; } pixel_t; /* Supported output image formats. */ typedef enum { IF_MIFF8, /* 8 bits/channel ImageMagick MIFF. */ IF_MIFF16, /* 16 bits/channel ImageMagick MIFF. */ IF_BMP /* Micro$oft Windohs BMP format. */ } imgfmt_t; /* Image parameters. */ typedef struct { int width; /* Image width in pixels. */ int height; /* Image height in pixels. */ int oversample; /* Subsampling factor. */ algo_t* algo; /* Algorithm to execute. */ imgfmt_t format; /* Output image format. */ FILE* target; /* Output target file. */ } image_t; /* Function prototypes. */ extern void* xmalloc(size_t bytes); extern void* xrealloc(void* buf, size_t bytes); extern void qbe_read(algo_t* algo, FILE* in); extern void qbe_read(algo_t* algo, FILE* in); extern void qbm_write(algo_t* algo, FILE* out); extern void qbm_write(algo_t* algo, FILE* out); extern void qbism_render_image(image_t* img); #endif /* vim: set ts=4 sts=4 sw=4 tw=80 et: */