home *** CD-ROM | disk | FTP | other *** search
- //#ifndef AMIGAMESApal_I
- //#define AMIGAMESApal_I
-
- /*
- * $Id: $
- */
-
- /*
- * Mesa 3-D graphics library
- * Version: 3.1
- * Copyright (C) 1995 Brian Paul (brianp@ssec.wisc.edu)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #ifdef PALETTE_DEFS
- /* first part defines amigaMesa-specifig tag
- * second part defines the choosen palette (aka modelling of available colors)
- * third part defines methog to fetch data (aka encoding of given colors
- *
- * at the moment dithering is only available in RGBMode, that means if we are
- * in index-mode the index-pixels are directly (without dither) mapped to
- * pen-pixels, it could be an improvement to offer dithering even for index-modes
- */
-
- /* dithering */
- #define AMESA_HPCR_DITHER -8 /* hp-color-recovery */
- #define AMESA_GREY_DITHER -4
- #define AMESA_WEIGHTED_DITHER -2 /* default standard 0 */
- #define AMESA_TRUECOLOR_DITHER -1 /* matches below 0 */
- /* matching */
- #define AMESA_HPCR_MATCH 8 /* hp-color-recovery */
- #define AMESA_GREY_MATCH 4
- #define AMESA_WEIGHTED_MATCH 2 /* default standard 0 */
- #define AMESA_TRUECOLOR_MATCH 1 /* matches below 0 */
- /* shifting */
- #define AMESA_TRUECOLOR_SHIFT 0 /* shifts above 0 */
- /* invalid */
- #define AMESA_DEADFOOD 0xDEAD /* dead man */
-
- #define MATCHtoDITHER(bool) ((bool) = -(bool)) /* if in shift-mode dither isn't available */
- #define DITHERtoMATCH(bool) ((bool) = -(bool)) /* if in shift-mode dither isn't available */
-
- #define IS_HPCR(bool) (((bool) == 8) || ((bool) == -8))
- #define IS_GREY(bool) (((bool) == 4) || ((bool) == -4))
- #define IS_WEIGHTED(bool) (((bool) == 2) || ((bool) == -2))
- #define IS_TRUECOLOR(bool) (((bool) >= -1) && ((bool) <= 1))
-
- #define IS_DITHER(bool) ((bool) < 0)
- #define IS_MATCH(bool) ((bool) > 0)
- #define IS_SHIFT(bool) ((bool) == 0)
-
- /*****************************************************************************
- *
- * fetch-macros
- */
-
- /* compositions */
- #define c8toc32(x) (((((((x) << 8) | (x)) << 8) | (x)) << 8) | (x)) /* byte-pen to pattern-pen */
- #define c24tocg(r,g,b) (((r << 5) + (g << 6) + (g << 5) + (b << 3) + b) >> 9) /* rgb-color to 64-grey (quick approximation) */
- #define c24toc8(r,g,b) ((((r) & 0xE0) >> 0) | \
- (((g) & 0xE0) >> 3) | \
- (((b) & 0xE0) >> 6)) /* rgb-color to 332-color */
-
- /* TrueColor-RGB */
- #define TC_RGBA(r,g,b) (((((((r) << 8) | (g)) << 8) | (b)) << 8) | (0)) /* byte-rgb to long-rgba */
- #define TC_ARGB(r,g,b) (((((((0) << 8) | (r)) << 8) | (g)) << 8) | (b)) /* byte-rgb to long-argb */
-
- /* Grey-RGB */
- #define GR_RGBA(am, r, g, b) (am->Palette[c24tocg(r, g, b)].PenNo) /* rgb-color to grey-pen */
-
- /* Palette-Index */
- #define PLD_RGBA(am, r, g, b, x, y) (GetPenDithered(r, g, b, am, x, y)) /* rgb-color to dithered-pen */
- #define PLG_RGBA(am, r, g, b) (GetPen(r, g, b, am)) /* rgb-color to pen */
- #define PL8_RGBA(am, r, g, b) (am->Palette[c24toc8(r, g, b)].PenNo) /* rgb-color to 332-pen */
-
- /* the format of index is RGBI, red|green|blue|index */
- #define MakeRGBP(am, r, g, b, x, y) (TC_RGBA(r, g, b) | PL_RGBA(am, r, g, b, x, y)) /* rgb to long-rgbp */
- /* get the red/green/blue/pen from a given index */
- #define GetRGBP(am, idx) (am->ItoP[(GLubyte)(idx)]) /* index to pen */
- #define GetRGBPLocal(idx) (ItoP[(GLubyte)(idx)]) /* index to pen */
- /* get the red/green/blue/index from a given pen */
- #define GetIndex(am, idx) (am->PtoI[(GLubyte)(idx)]) /* pen to index */
- #define GetIndexLocal(idx) (PtoI[(GLubyte)(idx)]) /* pen to index */
-
- /*****************************************************************************/
-
- #define ColorEntry_orgEntry_r %d
- #define ColorEntry_orgEntry_g %d
- #define ColorEntry_orgEntry_b %d
- #define ColorEntry_orgEntry_a %d
-
- #define ColorEntry_mapEntry_r %d
- #define ColorEntry_mapEntry_g %d
- #define ColorEntry_mapEntry_b %d
- #define ColorEntry_mapEntry_a %d
-
- #define PenNo ColorEntry_mapEntry_a
-
- #define CACHED 0xFF
- #define INVALID 0x00
-
- #define ColorCache_PenCch %d
- #define ColorCache_R %d
- #define ColorCache_B %d
- #define ColorCache_valid %d
-
- #define palNumCols332 256
- #define palNumCols 189
- #define palNumColsGrey 64
- #define palNumColsHPCR 256
-
- #define palNumColsMax 256
-
- #define ERROR_RANGE 512 /* -255 = 0 - 255, 255 = 255 - 0: -255 -> 255 */
- #endif
-
- /*****************************************************************************/
-
- //#endif
-