src/java.desktop/share/native/libawt/awt/image/cvutils/img_globals.h
author ihse
Tue, 13 Feb 2018 10:37:33 +0100
branchihse-remove-mapfiles-branch
changeset 56106 40e61db323c2
parent 47216 71c04702a3d5
child 56721 01b558efd286
permissions -rw-r--r--
First stab at removing mapfiles.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
56106
40e61db323c2 First stab at removing mapfiles.
ihse
parents: 47216
diff changeset
     2
 * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * This file provides some global definitions needed by the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * conversion package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#ifndef IMAGE_GLOBALS_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#define IMAGE_GLOBALS_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
56106
40e61db323c2 First stab at removing mapfiles.
ihse
parents: 47216
diff changeset
    34
#include "jni.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/* Image Conversion function return codes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#define SCALEFAILURE    -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define SCALENOOP       0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define SCALESUCCESS    1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * The constants needed to choose from among the many variants of image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * conversion functions that can be constructed with the standard header
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * files.  The types of input for the image conversion functions are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * broken down into 5 different attributes each with 2 to 4 different
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * variants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *      SCALING:        SCALED or UNSCALED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *      INPUT SIZE:     BYTEIN (8-bit) or INTIN (32-bit)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *      ALPHA:          OPAQUE or ALPHA
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *      ORDER:          TDLR or RANDOM
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *      COLORMODEL:     ICM, DCM, DCM8 (8-bits for each component) or ANY
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * For each attribute, a mask is defined with the "BITS" suffix which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * identifies which bits contain the variation information for that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * particular attribute.  The input information should be analyzed and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * characterized for each of the above categories and the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * bit constants OR'd together to produce a unique constant that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * identifies which conversion function is needed.  The reason that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * attributes of the output space are not indicated in the masks is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * that typically only a single output device type needs to be supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * at a time and so a vector of the functions specific to the necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * output device can be constructed at AWT initialization time and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * indexed into with the constant identifier that characterizes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * input data, which is only known and constantly varies at run-time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define IMGCV_UNSCALED          (0 << 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#define IMGCV_SCALED            (1 << 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define IMGCV_SCALEBITS         (1 << 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define IMGCV_BYTEIN            (0 << 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define IMGCV_INTIN             (1 << 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define IMGCV_INSIZEBITS        (1 << 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define IMGCV_OPAQUE            (0 << 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define IMGCV_ALPHA             (1 << 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
#define IMGCV_ALPHABITS         (1 << 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
#define IMGCV_TDLRORDER         (0 << 3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
#define IMGCV_RANDORDER         (1 << 3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
#define IMGCV_ORDERBITS         (1 << 3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
#define IMGCV_ICM               (0 << 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
#define IMGCV_DCM               (1 << 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#define IMGCV_DCM8              (2 << 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
#define IMGCV_ANYCM             (3 << 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
#define IMGCV_CMBITS            (3 << 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#define NUM_IMGCV               (1 << 6)        /* total # of IMGCV variants */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * The structure which holds the image conversion data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    void *outbuf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    void *maskbuf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    void *fserrors;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
} ImgConvertData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * The standard structure which holds information about the pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * used in the output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    int grayscale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    int bitsperpixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    int rOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    int gOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    int bOff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    int rScale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    int gScale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    int bScale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
} ImgColorData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * The private data member attached to a ColorModel which caches
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * the information needed to characterize and use a ColorModel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * object on the fly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    int type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    struct methodblock *mb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
} ImgCMData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * The standard signature of all of the image conversion functions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * that can be produced with this package of include files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * FIXME!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
typedef int ImgConvertFcn(void *colormodel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                          int srcOX, int srcOY, int srcW, int srcH,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                          void *srcpix, int srcOff, int srcBPP, int srcScan,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                          int srcTotalWidth, int srcTotalHeight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                          int dstTotalWidth, int dstTotalHeight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                          ImgConvertData *cvdata, ImgColorData *clrdata);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * The type of the error matrix used in the ordered dithering code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
typedef unsigned char uns_ordered_dither_array[8][8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
typedef char sgn_ordered_dither_array[8][8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * The function provided for constructing the ordered dithering error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * matrices based on a given quantum (i.e. the amplitude of the maximum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * error values appearing in the matrix which should be the same as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * distance between adjacent allocated component values in the color cube).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 */
56106
40e61db323c2 First stab at removing mapfiles.
ihse
parents: 47216
diff changeset
   148
JNIEXPORT void make_uns_ordered_dither_array(uns_ordered_dither_array oda,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                                          int quantum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
extern void make_sgn_ordered_dither_array(char* oda, int errmin, int errmax);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * The function provided for calculating the contents of the ImgCMData
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * structure which can be attached to ColorModels to simplify the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * work of characterizing their data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
extern ImgCMData *img_getCMData(void *cmh);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
#endif /* IMAGE_GLOBALS_H */