1/* 2 * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 27#ifndef MLIB_IMAGE_TYPES_H 28#define MLIB_IMAGE_TYPES_H 29 30#ifdef __cplusplus 31extern "C" { 32#endif 33 34typedef enum { 35 MLIB_BIT = 0, /* 1-bit data */ 36 MLIB_BYTE = 1, /* 8-bit unsigned integer data */ 37 MLIB_SHORT = 2, /* 16-bit signed integer data */ 38 MLIB_INT = 3, /* 32-bit signed integer data */ 39 MLIB_FLOAT = 4, /* 32-bit floating-point data */ 40 MLIB_DOUBLE = 5, /* 64-bit floating-point data */ 41 MLIB_USHORT = 6 /* 16-bit unsigned integer data */ 42} mlib_type; 43 44typedef enum { 45 MLIB_NEAREST = 0, /* nearest neighbor filter */ 46 MLIB_BILINEAR = 1, /* bilinear filter */ 47 MLIB_BICUBIC = 2, /* bicubic filter */ 48 MLIB_BICUBIC2 = 3 /* bicubic2 filter */ 49} mlib_filter; 50 51typedef enum { 52 MLIB_EDGE_DST_NO_WRITE = 0, /* no write to dst edge */ 53 MLIB_EDGE_DST_FILL_ZERO = 1, /* set dst edge to zero */ 54 MLIB_EDGE_DST_COPY_SRC = 2, /* copy src edge to dst edge */ 55 MLIB_EDGE_OP_NEAREST = 3, /* use nearest neighbor interpolation 56 for edge pixels */ 57 MLIB_EDGE_OP_DEGRADED = 4, /* use degraded interpolation for 58 edge pixels, i.e., bicubic -> 59 bilinear -> nearest neighbor */ 60 MLIB_EDGE_SRC_EXTEND = 5, /* extend src edge by replication */ 61 MLIB_EDGE_SRC_EXTEND_ZERO = 6, /* extend src edge with zeros */ 62 MLIB_EDGE_SRC_EXTEND_MIRROR = 7, /* extend src edge with mirrored data */ 63 MLIB_EDGE_SRC_PADDED = 8 /* use borders specified in mlib_image structure */ 64} mlib_edge; 65 66typedef enum { 67 MLIB_BLEND_ZERO = 0, 68 MLIB_BLEND_ONE = 1, 69 MLIB_BLEND_DST_COLOR = 2, 70 MLIB_BLEND_SRC_COLOR = 3, 71 MLIB_BLEND_ONE_MINUS_DST_COLOR = 4, 72 MLIB_BLEND_ONE_MINUS_SRC_COLOR = 5, 73 MLIB_BLEND_DST_ALPHA = 6, 74 MLIB_BLEND_SRC_ALPHA = 7, 75 MLIB_BLEND_ONE_MINUS_DST_ALPHA = 8, 76 MLIB_BLEND_ONE_MINUS_SRC_ALPHA = 9, 77 MLIB_BLEND_SRC_ALPHA_SATURATE = 10 78} mlib_blend; 79 80typedef enum { 81 MLIB_DFT_SCALE_NONE = 0, /* forward transform without scaling */ 82 MLIB_DFT_SCALE_MXN = 1, /* forward transform with scaling of 83 1/(M*N) */ 84 MLIB_DFT_SCALE_SQRT = 2, /* forward transform with scaling of 85 1/sqrt(M*N) */ 86 MLIB_IDFT_SCALE_NONE = 3, /* inverse transform without scaling */ 87 MLIB_IDFT_SCALE_MXN = 4, /* inverse transform with scaling of 88 1/(M*N) */ 89 MLIB_IDFT_SCALE_SQRT = 5 /* inverse transform with scaling of 90 1/sqrt(M*N) */ 91} mlib_fourier_mode; 92 93typedef enum { 94 MLIB_MEDIAN_MASK_RECT = 0, /* Rectangle shaped mask */ 95 MLIB_MEDIAN_MASK_PLUS = 1, /* Plus shaped mask */ 96 MLIB_MEDIAN_MASK_X = 2, /* X shaped mask */ 97 MLIB_MEDIAN_MASK_RECT_SEPARABLE = 3 /* Separable rectangle mask */ 98} mlib_median_mask; 99 100typedef enum { /* constants used for pixel format */ 101 MLIB_FORMAT_UNKNOWN = 0, 102 MLIB_FORMAT_INDEXED = 1, 103 MLIB_FORMAT_GRAYSCALE = 2, 104 MLIB_FORMAT_RGB = 3, 105 MLIB_FORMAT_BGR = 4, 106 MLIB_FORMAT_ARGB = 5, 107 MLIB_FORMAT_ABGR = 6, 108 MLIB_FORMAT_PACKED_ARGB = 7, 109 MLIB_FORMAT_PACKED_ABGR = 8, 110 MLIB_FORMAT_GRAYSCALE_ALPHA = 9, 111 MLIB_FORMAT_RGBA = 10 112} mlib_format; 113 114typedef struct { 115 mlib_type type; /* data type of image */ 116 mlib_s32 channels; /* number of channels */ 117 mlib_s32 width; /* width of image in pixels, x dimension */ 118 mlib_s32 height; /* height of image in pixels, y dimension */ 119 mlib_s32 stride; /* linestride = bytes to next row */ 120 mlib_s32 flags; /* collection of helpful hints */ 121 void *data; /* pointer to first data pixel */ 122 void *state; /* internal state structure */ 123 mlib_u8 paddings[4]; /* left, top, right, bottom */ 124 mlib_s32 bitoffset; /* the offset in bits from the beginning */ 125 /* of the data buffer to the first pixel */ 126 mlib_format format; /* pixels format */ 127 mlib_s32 reserved[7 - 2*sizeof(void*)/4]; 128 /* Reserved for future use. Also makes */ 129 /* size of this structure = 64 bytes, which */ 130 /* is the size of the cache line. */ 131} mlib_image; 132 133/* 134 * Flags or hints are contained in a 32-bit integer. The bit structure is 135 * shown below: 136 * 137 * 3 2 1 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 139 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 140 * |S| |U|V| shint | hhint | whint | dhint | 141 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 142 * 143 * S = 0 - attributes have been set (attribute field >= 0) 144 * 1 - attributes have not been set (attribute field < 0) 145 * 146 * U = 0 - mediaLib allocated data space 147 * 1 - user allocated data space 148 * 149 * V = 0 - stride == width => 1-D vector 150 * 1 - stride != width 151 * 152 * shint - last 4 bits of stride 153 * 154 * hhint - last 4 bits of height 155 * 156 * whint - last 4 bits of width 157 * 158 * dhint - last 8 bits of data address 159 */ 160 161enum { 162 MLIB_IMAGE_ALIGNED64 = 0x3f, 163 MLIB_IMAGE_ALIGNED8 = 0x7, 164 MLIB_IMAGE_ALIGNED4 = 0x3, 165 MLIB_IMAGE_ALIGNED2 = 0x1, 166 MLIB_IMAGE_WIDTH8X = 0x700, 167 MLIB_IMAGE_WIDTH4X = 0x300, 168 MLIB_IMAGE_WIDTH2X = 0x100, 169 MLIB_IMAGE_HEIGHT8X = 0x7000, 170 MLIB_IMAGE_HEIGHT4X = 0x3000, 171 MLIB_IMAGE_HEIGHT2X = 0x1000, 172 MLIB_IMAGE_STRIDE8X = 0x70000, 173 MLIB_IMAGE_ONEDVECTOR = 0x100000, 174 MLIB_IMAGE_USERALLOCATED = 0x200000, 175 MLIB_IMAGE_ATTRIBUTESET = 0x7fffffff 176}; 177 178#ifdef __cplusplus 179} 180#endif 181 182#endif /* MLIB_IMAGE_TYPES_H */ 183