| 1 |
/* RCSid: $Id$ */
|
| 2 |
/*
|
| 3 |
* rpaint.h - header file for image painting.
|
| 4 |
*/
|
| 5 |
|
| 6 |
/* ====================================================================
|
| 7 |
* The Radiance Software License, Version 1.0
|
| 8 |
*
|
| 9 |
* Copyright (c) 1990 - 2002 The Regents of the University of California,
|
| 10 |
* through Lawrence Berkeley National Laboratory. All rights reserved.
|
| 11 |
*
|
| 12 |
* Redistribution and use in source and binary forms, with or without
|
| 13 |
* modification, are permitted provided that the following conditions
|
| 14 |
* are met:
|
| 15 |
*
|
| 16 |
* 1. Redistributions of source code must retain the above copyright
|
| 17 |
* notice, this list of conditions and the following disclaimer.
|
| 18 |
*
|
| 19 |
* 2. Redistributions in binary form must reproduce the above copyright
|
| 20 |
* notice, this list of conditions and the following disclaimer in
|
| 21 |
* the documentation and/or other materials provided with the
|
| 22 |
* distribution.
|
| 23 |
*
|
| 24 |
* 3. The end-user documentation included with the redistribution,
|
| 25 |
* if any, must include the following acknowledgment:
|
| 26 |
* "This product includes Radiance software
|
| 27 |
* (http://radsite.lbl.gov/)
|
| 28 |
* developed by the Lawrence Berkeley National Laboratory
|
| 29 |
* (http://www.lbl.gov/)."
|
| 30 |
* Alternately, this acknowledgment may appear in the software itself,
|
| 31 |
* if and wherever such third-party acknowledgments normally appear.
|
| 32 |
*
|
| 33 |
* 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
|
| 34 |
* and "The Regents of the University of California" must
|
| 35 |
* not be used to endorse or promote products derived from this
|
| 36 |
* software without prior written permission. For written
|
| 37 |
* permission, please contact [email protected].
|
| 38 |
*
|
| 39 |
* 5. Products derived from this software may not be called "Radiance",
|
| 40 |
* nor may "Radiance" appear in their name, without prior written
|
| 41 |
* permission of Lawrence Berkeley National Laboratory.
|
| 42 |
*
|
| 43 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
| 44 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 45 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 46 |
* DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
|
| 47 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 48 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 49 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
| 50 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 51 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 52 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
| 53 |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 54 |
* SUCH DAMAGE.
|
| 55 |
* ====================================================================
|
| 56 |
*
|
| 57 |
* This software consists of voluntary contributions made by many
|
| 58 |
* individuals on behalf of Lawrence Berkeley National Laboratory. For more
|
| 59 |
* information on Lawrence Berkeley National Laboratory, please see
|
| 60 |
* <http://www.lbl.gov/>.
|
| 61 |
*/
|
| 62 |
|
| 63 |
#include "driver.h"
|
| 64 |
|
| 65 |
#include "view.h"
|
| 66 |
|
| 67 |
typedef short COORD; /* an image coordinate */
|
| 68 |
|
| 69 |
typedef struct pnode {
|
| 70 |
struct pnode *kid; /* children */
|
| 71 |
COORD x, y; /* position */
|
| 72 |
COLOR v; /* value */
|
| 73 |
} PNODE; /* a paint node */
|
| 74 |
|
| 75 |
/* child ordering */
|
| 76 |
#define DL 0 /* down left */
|
| 77 |
#define DR 1 /* down right */
|
| 78 |
#define UL 2 /* up left */
|
| 79 |
#define UR 3 /* up right */
|
| 80 |
|
| 81 |
#define newptree() (PNODE *)calloc(4, sizeof(PNODE))
|
| 82 |
|
| 83 |
typedef struct {
|
| 84 |
COORD l, d, r, u; /* left, down, right, up */
|
| 85 |
} RECT; /* a rectangle */
|
| 86 |
|
| 87 |
extern PNODE ptrunk; /* the base of the image tree */
|
| 88 |
|
| 89 |
extern VIEW ourview; /* current view parameters */
|
| 90 |
extern VIEW oldview; /* previous view parameters */
|
| 91 |
extern int hresolu, vresolu; /* image resolution */
|
| 92 |
|
| 93 |
extern int greyscale; /* map colors to brightness? */
|
| 94 |
|
| 95 |
extern int pdepth; /* image depth in current frame */
|
| 96 |
extern RECT pframe; /* current frame rectangle */
|
| 97 |
|
| 98 |
extern double exposure; /* exposure for scene */
|
| 99 |
|
| 100 |
extern struct driver *dev; /* driver functions */
|
| 101 |
|
| 102 |
#ifdef NOPROTO
|
| 103 |
|
| 104 |
extern void devopen();
|
| 105 |
extern void devclose();
|
| 106 |
extern void printdevices();
|
| 107 |
extern void fillreserves();
|
| 108 |
extern void freereserves();
|
| 109 |
extern void command();
|
| 110 |
extern void rsample();
|
| 111 |
extern int refine();
|
| 112 |
extern void getframe();
|
| 113 |
extern void getrepaint();
|
| 114 |
extern void getview();
|
| 115 |
extern void lastview();
|
| 116 |
extern void saveview();
|
| 117 |
extern void loadview();
|
| 118 |
extern void getaim();
|
| 119 |
extern void getmove();
|
| 120 |
extern void getrotate();
|
| 121 |
extern void getpivot();
|
| 122 |
extern void getexposure();
|
| 123 |
extern int getparam();
|
| 124 |
extern void setparam();
|
| 125 |
extern void traceray();
|
| 126 |
extern void writepict();
|
| 127 |
extern int getrect();
|
| 128 |
extern int getinterest();
|
| 129 |
extern float *greyof();
|
| 130 |
extern void paint();
|
| 131 |
extern void newimage();
|
| 132 |
extern void redraw();
|
| 133 |
extern void repaint();
|
| 134 |
extern void paintrec();
|
| 135 |
extern PNODE *findrect();
|
| 136 |
extern void scalepict();
|
| 137 |
extern void getpictcolrs();
|
| 138 |
extern void freepkids();
|
| 139 |
extern void newview();
|
| 140 |
extern void moveview();
|
| 141 |
extern void pcopy();
|
| 142 |
extern void zoomview();
|
| 143 |
|
| 144 |
#else
|
| 145 |
/* defined in rview.c */
|
| 146 |
extern void devopen(char *dname);
|
| 147 |
extern void devclose(void);
|
| 148 |
extern void printdevices(void);
|
| 149 |
extern void fillreserves(void);
|
| 150 |
extern void freereserves(void);
|
| 151 |
extern void command(char *prompt);
|
| 152 |
extern void rsample(void);
|
| 153 |
extern int refine(PNODE *p, int xmin, int ymin,
|
| 154 |
int xmax, int ymax, int pd);
|
| 155 |
/* defined in rv2.c */
|
| 156 |
extern void getframe(char *s);
|
| 157 |
extern void getrepaint(char *s);
|
| 158 |
extern void getview(char *s);
|
| 159 |
extern void lastview(char *s);
|
| 160 |
extern void saveview(char *s);
|
| 161 |
extern void loadview(char *s);
|
| 162 |
extern void getaim(char *s);
|
| 163 |
extern void getmove(char *s);
|
| 164 |
extern void getrotate(char *s);
|
| 165 |
extern void getpivot(char *s);
|
| 166 |
extern void getexposure(char *s);
|
| 167 |
extern int getparam(char *str, char *dsc, int typ, void *p);
|
| 168 |
extern void setparam(char *s);
|
| 169 |
extern void traceray(char *s);
|
| 170 |
extern void writepict(char *s);
|
| 171 |
/* defined in rv3.c */
|
| 172 |
extern int getrect(char *s, RECT *r);
|
| 173 |
extern int getinterest(char *s, int direc, FVECT vec, double *mp);
|
| 174 |
extern float *greyof(COLOR col);
|
| 175 |
extern void paint(PNODE *p, int xmin, int ymin, int xmax, int ymax);
|
| 176 |
extern void newimage(void);
|
| 177 |
extern void redraw(void);
|
| 178 |
extern void repaint(int xmin, int ymin, int xmax, int ymax);
|
| 179 |
extern void paintrect(PNODE *p, int xmin, int ymin,
|
| 180 |
int xmax, int ymax, RECT *r);
|
| 181 |
extern PNODE *findrect(int x, int y, PNODE *p, RECT *r, int pd);
|
| 182 |
extern void scalepict(PNODE *p, double sf);
|
| 183 |
extern void getpictcolrs(int yoff, COLR *scan, PNODE *p,
|
| 184 |
int xsiz, int ysiz);
|
| 185 |
extern void freepkids(PNODE *p);
|
| 186 |
extern void newview(VIEW *vp);
|
| 187 |
extern void moveview(double angle, double elev, double mag, FVECT vc);
|
| 188 |
extern void pcopy(PNODE *p1, PNODE *p2);
|
| 189 |
extern void zoomview(VIEW *vp, double zf);
|
| 190 |
|
| 191 |
#endif
|