0N/A/*
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef SPLASHSCREEN_GFX_H
0N/A#define SPLASHSCREEN_GFX_H
0N/A
0N/A/* splashscreen_gfx is a general purpose code for converting pixmaps between various visuals
0N/A it is not very effective, but is universal and concise */
0N/A
0N/A#include "splashscreen_config.h"
0N/A
0N/Aenum
0N/A{
0N/A BYTE_ORDER_LSBFIRST = 0, // least significant byte first
0N/A BYTE_ORDER_MSBFIRST = 1, // most significant byte first
0N/A BYTE_ORDER_NATIVE = 2 // exactly the same as the arch we're running this on
0N/A // will behave identical to _LSBFIRST or _MSBFIRST,
0N/A // but more effective
0N/A};
0N/A
0N/Aenum
0N/A{
0N/A DITHER_SIZE = 16,
0N/A DITHER_MASK = 15
0N/A};
0N/A
0N/Atypedef struct DitherSettings
0N/A{
0N/A int numColors;
0N/A rgbquad_t colorTable[512];
0N/A unsigned matrix[DITHER_SIZE][DITHER_SIZE];
0N/A} DitherSettings;
0N/A
0N/A/* this structure is similar to Xlib's Visual */
0N/A
0N/Atypedef struct ImageFormat
0N/A{
0N/A rgbquad_t mask[4];
0N/A int shift[4];
0N/A int depthBytes; // 1,2,3 or 4. 3 is not supported for XCVT_BYTE_ORDER_NATIVE.
0N/A int byteOrder; // see BYTE_ORDER_LSBFIRST, BYTE_ORDER_MSBFIRST or BYTE_ORDER_NATIVE
0N/A int fixedBits; // this value is or'ed with the color value on get or put, non-indexed only
0N/A // for indexed color, may be used when pre-decoding the colormap
0N/A rgbquad_t *colorMap; // colormap should be pre-decoded (i.e. an array of rgbquads)
0N/A // when colormap is non-NULL, the source color is an index to a colormap, and
0N/A // masks/shifts are unused.
0N/A unsigned transparentColor; // only for indexed colors. this is transparent color _INDEX_.
0N/A // use a more-than-max value when you don't need transparency.
0N/A int premultiplied;
0N/A DitherSettings *dithers;
0N/A int numColors; // in the colormap, only for indexed color
0N/A rgbquad_t *colorIndex; // color remapping index for dithering mode
0N/A} ImageFormat;
0N/A
0N/A/* this structure defines a rectangular portion of an image buffer. height and/or width may be inverted. */
0N/A
0N/Atypedef struct ImageRect
0N/A{
0N/A int numLines; // number of scanlines in the rectangle
0N/A int numSamples; // number of samples in the line
0N/A int stride; // distance between first samples of n'th and n+1'th scanlines, in bytes
0N/A int depthBytes; // distance between n'th and n+1'th sample in a scanline, in bytes
0N/A void *pBits; // points to sample 0, scanline 0
0N/A ImageFormat *format; // format of the samples
0N/A int row, col, jump; // dithering indexes
0N/A} ImageRect;
0N/A
0N/Aenum
0N/A{
0N/A CVT_COPY,
0N/A CVT_ALPHATEST,
0N/A CVT_BLEND
0N/A};
0N/A
0N/A#define MAX_COLOR_VALUE 255
0N/A#define QUAD_ALPHA_MASK 0xFF000000
0N/A#define QUAD_RED_MASK 0x00FF0000
0N/A#define QUAD_GREEN_MASK 0x0000FF00
0N/A#define QUAD_BLUE_MASK 0x000000FF
0N/A
0N/A#define QUAD_ALPHA_SHIFT 24
0N/A#define QUAD_RED_SHIFT 16
0N/A#define QUAD_GREEN_SHIFT 8
0N/A#define QUAD_BLUE_SHIFT 0
0N/A
0N/A#define QUAD_ALPHA(value) (((value)&QUAD_ALPHA_MASK)>>QUAD_ALPHA_SHIFT)
0N/A#define QUAD_RED(value) (((value)&QUAD_RED_MASK)>>QUAD_RED_SHIFT)
0N/A#define QUAD_GREEN(value) (((value)&QUAD_GREEN_MASK)>>QUAD_GREEN_SHIFT)
0N/A#define QUAD_BLUE(value) (((value)&QUAD_BLUE_MASK)>>QUAD_BLUE_SHIFT)
0N/A
0N/A#define MAKE_QUAD(r,g,b,a) \
0N/A (((a)<<QUAD_ALPHA_SHIFT)&QUAD_ALPHA_MASK)| \
0N/A (((r)<<QUAD_RED_SHIFT)&QUAD_RED_MASK)| \
0N/A (((g)<<QUAD_GREEN_SHIFT)&QUAD_GREEN_MASK)| \
0N/A (((b)<<QUAD_BLUE_SHIFT)&QUAD_BLUE_MASK) \
0N/A
0N/A
0N/A/* alpha testing threshold. what's >= the threshold is considered non-transparent when doing
0N/A conversion operation with CVT_ALPHATEST and when generating shapes/regions with
0N/A BitmapToYXBandedRectangles */
0N/A
0N/A#define ALPHA_THRESHOLD 0x80000000
0N/A
0N/Avoid initRect(ImageRect * pRect, int x, int y, int width, int height, int jump,
0N/A int stride, void *pBits, ImageFormat * format);
0N/Aint convertRect2(ImageRect * pSrcRect, ImageRect * pDstRect, int mode,
0N/A ImageRect * pSrcRect2);
0N/Aint convertRect(ImageRect * pSrcRect, ImageRect * pDstRect, int mode);
0N/Avoid convertLine(void *pSrc, int incSrc, void *pDst, int incDst, int n,
0N/A ImageFormat * srcFormat, ImageFormat * dstFormat, int mode,
0N/A void *pSrc2, int incSrc2, ImageFormat * srcFormat2, int row, int col);
0N/Avoid initFormat(ImageFormat * format, int redMask, int greenMask,
0N/A int blueMask, int alphaMask);
0N/Aint fillRect(rgbquad_t color, ImageRect * pDstRect);
0N/Avoid dumpFormat(ImageFormat * format);
0N/A
0N/Avoid optimizeFormat(ImageFormat * format);
0N/A
0N/Avoid initDither(DitherSettings * pDither, int numColors, int scale);
0N/A
0N/Aint quantizeColors(int maxNumColors, int *numColors);
0N/A
0N/Avoid initColorCube(int *numColors, rgbquad_t * pColorMap,
0N/A DitherSettings * pDithers, rgbquad_t * colorIndex);
0N/Aint platformByteOrder();
0N/A
0N/A#endif