jdk/src/share/native/sun/awt/medialib/mlib_image_types.h
author bae
Fri, 25 Mar 2011 12:50:59 +0300
changeset 8939 04615dca2a76
parent 5506 202f599c92aa
permissions -rw-r--r--
6989717: media native code compiler warnings Reviewed-by: jgodinez, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2003, 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
#ifndef MLIB_IMAGE_TYPES_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#define MLIB_IMAGE_TYPES_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  MLIB_BIT    = 0,      /* 1-bit data                   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  MLIB_BYTE   = 1,      /* 8-bit unsigned integer data  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  MLIB_SHORT  = 2,      /* 16-bit signed integer data   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  MLIB_INT    = 3,      /* 32-bit signed integer data   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  MLIB_FLOAT  = 4,      /* 32-bit floating-point data   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  MLIB_DOUBLE = 5,      /* 64-bit floating-point data   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  MLIB_USHORT = 6       /* 16-bit unsigned integer data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
} mlib_type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  MLIB_NEAREST  = 0,    /* nearest neighbor filter      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  MLIB_BILINEAR = 1,    /* bilinear filter              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  MLIB_BICUBIC  = 2,    /* bicubic filter               */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  MLIB_BICUBIC2 = 3     /* bicubic2 filter              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
} mlib_filter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  MLIB_EDGE_DST_NO_WRITE      = 0,      /* no write to dst edge */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  MLIB_EDGE_DST_FILL_ZERO     = 1,      /* set dst edge to zero */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  MLIB_EDGE_DST_COPY_SRC      = 2,      /* copy src edge to dst edge */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  MLIB_EDGE_OP_NEAREST        = 3,      /* use nearest neighbor interpolation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                                           for edge pixels */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  MLIB_EDGE_OP_DEGRADED       = 4,      /* use degraded interpolation for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                                           edge pixels, i.e., bicubic ->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                                           bilinear -> nearest neighbor */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  MLIB_EDGE_SRC_EXTEND        = 5,      /* extend src edge by replication */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  MLIB_EDGE_SRC_EXTEND_ZERO   = 6,      /* extend src edge with zeros */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  MLIB_EDGE_SRC_EXTEND_MIRROR = 7,      /* extend src edge with mirrored data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  MLIB_EDGE_SRC_PADDED        = 8       /* use borders specified in mlib_image structure */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
} mlib_edge;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  MLIB_BLEND_ZERO                = 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  MLIB_BLEND_ONE                 = 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  MLIB_BLEND_DST_COLOR           = 2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  MLIB_BLEND_SRC_COLOR           = 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  MLIB_BLEND_ONE_MINUS_DST_COLOR = 4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  MLIB_BLEND_ONE_MINUS_SRC_COLOR = 5,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  MLIB_BLEND_DST_ALPHA           = 6,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  MLIB_BLEND_SRC_ALPHA           = 7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  MLIB_BLEND_ONE_MINUS_DST_ALPHA = 8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
  MLIB_BLEND_ONE_MINUS_SRC_ALPHA = 9,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  MLIB_BLEND_SRC_ALPHA_SATURATE  = 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
} mlib_blend;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  MLIB_DFT_SCALE_NONE     = 0,  /* forward transform without scaling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  MLIB_DFT_SCALE_MXN      = 1,  /* forward transform with scaling of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                                   1/(M*N) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  MLIB_DFT_SCALE_SQRT     = 2,  /* forward transform with scaling of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                                   1/sqrt(M*N) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  MLIB_IDFT_SCALE_NONE    = 3,  /* inverse transform without scaling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  MLIB_IDFT_SCALE_MXN     = 4,  /* inverse transform with scaling of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                                   1/(M*N) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  MLIB_IDFT_SCALE_SQRT    = 5   /* inverse transform with scaling of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                                   1/sqrt(M*N) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
} mlib_fourier_mode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
  MLIB_MEDIAN_MASK_RECT             = 0, /* Rectangle shaped mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  MLIB_MEDIAN_MASK_PLUS             = 1, /* Plus shaped mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
  MLIB_MEDIAN_MASK_X                = 2, /* X shaped mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  MLIB_MEDIAN_MASK_RECT_SEPARABLE   = 3  /* Separable rectangle mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
} mlib_median_mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
typedef enum { /* constants used for pixel format */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  MLIB_FORMAT_UNKNOWN         =  0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  MLIB_FORMAT_INDEXED         =  1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  MLIB_FORMAT_GRAYSCALE       =  2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  MLIB_FORMAT_RGB             =  3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  MLIB_FORMAT_BGR             =  4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  MLIB_FORMAT_ARGB            =  5,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  MLIB_FORMAT_ABGR            =  6,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  MLIB_FORMAT_PACKED_ARGB     =  7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  MLIB_FORMAT_PACKED_ABGR     =  8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  MLIB_FORMAT_GRAYSCALE_ALPHA =  9,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  MLIB_FORMAT_RGBA            = 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
} mlib_format;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  mlib_type   type;        /* data type of image                       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  mlib_s32    channels;    /* number of channels                       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  mlib_s32    width;       /* width of image in pixels, x dimension    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
  mlib_s32    height;      /* height of image in pixels, y dimension   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  mlib_s32    stride;      /* linestride = bytes to next row           */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
  mlib_s32    flags;       /* collection of helpful hints              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
  void        *data;       /* pointer to first data pixel              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
  void        *state;      /* internal state structure                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
  mlib_u8     paddings[4]; /* left, top, right, bottom                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
  mlib_s32    bitoffset;   /* the offset in bits from the beginning    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                           /* of the data buffer to the first pixel    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  mlib_format format;      /* pixels format                            */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
  mlib_s32    reserved[7 - 2*sizeof(void*)/4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                           /* Reserved for future use. Also makes      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                           /* size of this structure = 64 bytes, which */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                           /* is the size of the cache line.           */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
} mlib_image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * Flags or hints are contained in a 32-bit integer. The bit structure is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * shown below:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *      3                   2                   1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *    1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 *   |S|                 |U|V| shint | hhint | whint |     dhint     |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 *      S = 0   - attributes have been set (attribute field >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 *          1   - attributes have not been set (attribute field < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 *      U = 0   - mediaLib allocated data space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *          1   - user allocated data space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *      V = 0   - stride == width => 1-D vector
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *          1   - stride != width
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *      shint   - last 4 bits of stride
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *      hhint   - last 4 bits of height
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 *      whint   - last 4 bits of width
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *      dhint   - last 8 bits of data address
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
  MLIB_IMAGE_ALIGNED64     = 0x3f,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
  MLIB_IMAGE_ALIGNED8      = 0x7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
  MLIB_IMAGE_ALIGNED4      = 0x3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
  MLIB_IMAGE_ALIGNED2      = 0x1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
  MLIB_IMAGE_WIDTH8X       = 0x700,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
  MLIB_IMAGE_WIDTH4X       = 0x300,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
  MLIB_IMAGE_WIDTH2X       = 0x100,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
  MLIB_IMAGE_HEIGHT8X      = 0x7000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
  MLIB_IMAGE_HEIGHT4X      = 0x3000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
  MLIB_IMAGE_HEIGHT2X      = 0x1000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
  MLIB_IMAGE_STRIDE8X      = 0x70000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
  MLIB_IMAGE_ONEDVECTOR    = 0x100000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
  MLIB_IMAGE_USERALLOCATED = 0x200000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
  MLIB_IMAGE_ATTRIBUTESET  = 0x7fffffff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
#endif  /* MLIB_IMAGE_TYPES_H */