0N/A/*
2362N/A * Copyright (c) 1997, 2000, 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/*
0N/A * @author Charlton Innovations, Inc.
0N/A */
0N/A
0N/A#ifndef _Included_ImageData
0N/A#define _Included_ImageData
0N/A
0N/A#ifdef __cplusplus
0N/Aextern "C" {
0N/A#endif
0N/A
0N/A#include "colordata.h"
0N/A
0N/A
0N/Atypedef struct ImageDataID {
0N/A jfieldID dataID;
0N/A jfieldID lutDataID;
0N/A jfieldID typeID;
0N/A jfieldID lutDataLengthID;
0N/A jfieldID pixelStrideID;
0N/A jfieldID scanlineStrideID;
0N/A jfieldID numChannelsID;
0N/A jfieldID bytePerChannelID;
0N/A jfieldID pixelsPerDataUnitID;
0N/A
0N/A jfieldID xViewAreaID;
0N/A jfieldID yViewAreaID;
0N/A jfieldID dxViewAreaID;
0N/A jfieldID dyViewAreaID;
0N/A jfieldID xDeviceAreaID;
0N/A jfieldID yDeviceAreaID;
0N/A jfieldID dxDeviceAreaID;
0N/A jfieldID dyDeviceAreaID;
0N/A jfieldID xOutputAreaID;
0N/A jfieldID yOutputAreaID;
0N/A jfieldID dxOutputAreaID;
0N/A jfieldID dyOutputAreaID;
0N/A
0N/A jfieldID intDataID;
0N/A jfieldID shortDataID;
0N/A jfieldID byteDataID;
0N/A
0N/A jfieldID lutArrayID;
0N/A
0N/A jfieldID originXID;
0N/A jfieldID originYID;
0N/A
0N/A jfieldID theResRatioID;
0N/A jfieldID theScaleFactorXID;
0N/A jfieldID theScaleFactorYID;
0N/A
0N/A jfieldID lockMethodID;
0N/A jfieldID lockFunctionID;
0N/A jfieldID platformInfoID;
0N/A jfieldID deviceInfoID;
0N/A jfieldID colorModelID;
0N/A
0N/A jfieldID grayInverseLutDataID;
0N/A} ImageDataID;
0N/A
0N/Aextern ImageDataID gImageData;
0N/A
0N/Aint minImageWidths(JNIEnv *env, int width1, jobject img1, jobject img2);
0N/Aint minImageRows(JNIEnv *env, int rows1, jobject img1, jobject img2);
0N/A
0N/Atypedef int (*deferredLockFunc) (JNIEnv *env, jobject idData);
0N/A
0N/A
0N/Atypedef struct ImageDataIntLockInfo {
0N/A unsigned int *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A unsigned int pixelsPerData;
0N/A
0N/A jintArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned int *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A} ImageDataIntLockInfo;
0N/A
0N/Atypedef struct ImageDataShortLockInfo {
0N/A unsigned short *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A unsigned int pixelsPerData;
0N/A
0N/A jshortArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned short *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A} ImageDataShortLockInfo;
0N/A
0N/Atypedef struct ImageDataByteLockInfo {
0N/A unsigned char *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A unsigned int pixelsPerData;
0N/A
0N/A jbyteArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A} ImageDataByteLockInfo;
0N/A
0N/Atypedef struct ImageDataShortIndexedLockInfo {
0N/A unsigned short *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A unsigned int pixelsPerData;
0N/A
0N/A jshortArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned short *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A
0N/A unsigned int *lockedLut;
0N/A jintArray arrayToLockLut;
0N/A unsigned int *arrayLockedLut;
0N/A unsigned int arrayLutSize;
0N/A} ImageDataShortIndexedLockInfo;
0N/A
0N/Atypedef struct ImageDataByteIndexedLockInfo {
0N/A unsigned char *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A unsigned int pixelsPerData;
0N/A
0N/A jbyteArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A
0N/A unsigned int *lockedLut;
0N/A jintArray arrayToLockLut;
0N/A unsigned int *arrayLockedLut;
0N/A unsigned int arrayLutSize;
0N/A unsigned int minLut[256]; /* provide min size LUT - speed inner loops */
0N/A ColorData *colorData;
0N/A unsigned int lockedForWrite;
0N/A const char* inv_cmap; /* The inverse cmap to use */
0N/A} ImageDataByteIndexedLockInfo;
0N/A
0N/Atypedef struct ImageDataIndex8GrayLockInfo {
0N/A unsigned char *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A
0N/A jbyteArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A
0N/A unsigned int *lockedLut;
0N/A jintArray arrayToLockLut;
0N/A unsigned int *arrayLockedLut;
0N/A unsigned int arrayLutSize;
0N/A unsigned int minLut[256];
0N/A ColorData *colorData;
0N/A unsigned int lockedForWrite;
0N/A const char* inv_cmap; /* The inverse cmap to use */
0N/A
0N/A unsigned int *lockedInverseGrayLut;
0N/A
0N/A} ImageDataIndex8GrayLockInfo;
0N/A
0N/Atypedef struct ImageDataIndex12GrayLockInfo {
0N/A unsigned short *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A
0N/A jshortArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned short *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A
0N/A unsigned int *lockedLut;
0N/A jintArray arrayToLockLut;
0N/A unsigned int *arrayLockedLut;
0N/A unsigned int arrayLutSize;
0N/A unsigned int *minLut; /* Not used right now, and therefore just having a
0N/A pointer instead of an array */
0N/A ColorData *colorData;
0N/A unsigned int lockedForWrite;
0N/A const char* inv_cmap; /* The inverse cmap to use */
0N/A
0N/A unsigned int *lockedInverseGrayLut;
0N/A
0N/A} ImageDataIndex12GrayLockInfo;
0N/A
0N/Atypedef struct ImageDataBitLockInfo {
0N/A unsigned char *lockedBuffer; /* filled if buffer previously locked */
0N/A deferredLockFunc lockFunction; /* ptr to lock function (optional) */
0N/A unsigned int xOutput,yOutput; /* top-left of clipped output area */
0N/A unsigned int scanStride;
0N/A unsigned int bytePerChannel;
0N/A unsigned int pixelStride;
0N/A unsigned int pixelsPerData;
0N/A
0N/A jbyteArray arrayToLock; /* filled if buffer not previously locked */
0N/A unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
0N/A int arrayLockedOffset; /* offset from start of array to copy image */
0N/A} ImageDataBitLockInfo;
0N/A
0N/Aint offsetOfAlphaData(JNIEnv *env, jobject img, int scanStride);
0N/A#define offsetOfSrcData(env, img, srcStride, srcBump, offsetVar) \
0N/A do { \
0N/A int x1, y1; \
0N/A int x2, y2; \
0N/A x1 = (*env)->GetIntField(env, img, gImageData.xDeviceAreaID); \
0N/A y1 = (*env)->GetIntField(env, img, gImageData.yDeviceAreaID); \
0N/A x2 = (*env)->GetIntField(env, img, gImageData.xOutputAreaID); \
0N/A y2 = (*env)->GetIntField(env, img, gImageData.yOutputAreaID); \
0N/A offsetVar = srcBump * (x2 - x1) + srcStride * (y2 - y1); \
0N/A } while (0);
0N/A
0N/Along getPlatformInfoFromImageData(JNIEnv *env, jobject img);
0N/A
0N/AJNIEXPORT void JNICALL
0N/AgetViewOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
0N/A
0N/AJNIEXPORT void JNICALL
0N/AgetDeviceOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
0N/A
0N/AJNIEXPORT void JNICALL
0N/AgetOutputOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
0N/A
0N/AJNIEXPORT void JNICALL
0N/AgetTypeFromImageData(JNIEnv *env, jobject img, int *type);
0N/A
0N/AJNIEXPORT void JNICALL
0N/AgetOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
0N/A
0N/AJNIEXPORT double JNICALL
0N/AgetResRatioFromImageData(JNIEnv *env, jobject img);
0N/A
0N/AJNIEXPORT void JNICALL
0N/AgetScaleFactorFromImageData(JNIEnv *env, jobject img, double *sx, double *sy);
0N/A
0N/AJNIEXPORT int JNICALL
0N/AgetDeviceInfoFromImageData(JNIEnv *env, jobject img);
0N/A
0N/A/*
0N/A * Integer component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getIntImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataIntLockInfo *lockInfo);
0N/AJNIEXPORT unsigned int * JNICALL lockIntImageData(
0N/A JNIEnv *env, ImageDataIntLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockIntImageData(
0N/A JNIEnv *env, ImageDataIntLockInfo *lockInfo);
0N/A
0N/A/*
0N/A * Short component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getShortImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataShortLockInfo *lockInfo);
0N/AJNIEXPORT unsigned short * JNICALL lockShortImageData(
0N/A JNIEnv *env, ImageDataShortLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockShortImageData(
0N/A JNIEnv *env, ImageDataShortLockInfo *lockInfo);
0N/A
0N/A/*
0N/A * Byte component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getByteImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataByteLockInfo *lockInfo);
0N/AJNIEXPORT unsigned char * JNICALL lockByteImageData(
0N/A JNIEnv *env, ImageDataByteLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockByteImageData(
0N/A JNIEnv *env, ImageDataByteLockInfo *lockInfo);
0N/A
0N/A/*
0N/A * Short Indexed component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getShortIndexedImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataShortIndexedLockInfo *lockInfo);
0N/AJNIEXPORT unsigned short * JNICALL lockShortIndexedImageData(
0N/A JNIEnv *env, ImageDataShortIndexedLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockShortIndexedImageData(
0N/A JNIEnv *env, ImageDataShortIndexedLockInfo *lockInfo);
0N/A
0N/A/*
0N/A * Byte Indexed component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getByteIndexedImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataByteIndexedLockInfo *lockInfo);
0N/AJNIEXPORT unsigned char * JNICALL lockByteIndexedImageData(
0N/A JNIEnv *env, ImageDataByteIndexedLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockByteIndexedImageData(
0N/A JNIEnv *env, ImageDataByteIndexedLockInfo *lockInfo);
0N/A/*
0N/A * Index 8 Gray component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getIndex8GrayImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataIndex8GrayLockInfo *lockInfo);
0N/AJNIEXPORT unsigned char * JNICALL lockIndex8GrayImageData(
0N/A JNIEnv *env, ImageDataIndex8GrayLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockIndex8GrayImageData(
0N/A JNIEnv *env, ImageDataIndex8GrayLockInfo *lockInfo);
0N/A/*
0N/A * Index 12 Gray component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getIndex12GrayImageLockInfo(
0N/A JNIEnv *env, jobject img,
0N/A ImageDataIndex12GrayLockInfo *lockInfo);
0N/AJNIEXPORT unsigned short * JNICALL lockIndex12GrayImageData(
0N/A JNIEnv *env, ImageDataIndex12GrayLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockIndex12GrayImageData(
0N/A JNIEnv *env, ImageDataIndex12GrayLockInfo *lockInfo);
0N/A
0N/A/*
0N/A * Bit component raster handlers
0N/A */
0N/A
0N/AJNIEXPORT void JNICALL getBitImageLockInfo(
0N/A JNIEnv *env, jobject img, ImageDataBitLockInfo *lockInfo);
0N/AJNIEXPORT unsigned char *JNICALL lockBitImageData(
0N/A JNIEnv *env, ImageDataBitLockInfo *lockInfo);
0N/AJNIEXPORT void JNICALL unlockBitImageData(
0N/A JNIEnv *env, ImageDataBitLockInfo *lockInfo);
0N/A
0N/A#ifdef __cplusplus
0N/A};
0N/A#endif
0N/A
0N/A#endif