0N/A/*
2362N/A * Copyright (c) 1997, 2003, 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#ifndef MLIB_IMAGE_TYPES_H
0N/A#define MLIB_IMAGE_TYPES_H
0N/A
0N/A#ifdef __cplusplus
0N/Aextern "C" {
0N/A#endif
0N/A
0N/Atypedef enum {
0N/A MLIB_BIT = 0, /* 1-bit data */
0N/A MLIB_BYTE = 1, /* 8-bit unsigned integer data */
0N/A MLIB_SHORT = 2, /* 16-bit signed integer data */
0N/A MLIB_INT = 3, /* 32-bit signed integer data */
0N/A MLIB_FLOAT = 4, /* 32-bit floating-point data */
0N/A MLIB_DOUBLE = 5, /* 64-bit floating-point data */
0N/A MLIB_USHORT = 6 /* 16-bit unsigned integer data */
0N/A} mlib_type;
0N/A
0N/Atypedef enum {
0N/A MLIB_NEAREST = 0, /* nearest neighbor filter */
0N/A MLIB_BILINEAR = 1, /* bilinear filter */
0N/A MLIB_BICUBIC = 2, /* bicubic filter */
0N/A MLIB_BICUBIC2 = 3 /* bicubic2 filter */
0N/A} mlib_filter;
0N/A
0N/Atypedef enum {
0N/A MLIB_EDGE_DST_NO_WRITE = 0, /* no write to dst edge */
0N/A MLIB_EDGE_DST_FILL_ZERO = 1, /* set dst edge to zero */
0N/A MLIB_EDGE_DST_COPY_SRC = 2, /* copy src edge to dst edge */
0N/A MLIB_EDGE_OP_NEAREST = 3, /* use nearest neighbor interpolation
0N/A for edge pixels */
0N/A MLIB_EDGE_OP_DEGRADED = 4, /* use degraded interpolation for
0N/A edge pixels, i.e., bicubic ->
0N/A bilinear -> nearest neighbor */
0N/A MLIB_EDGE_SRC_EXTEND = 5, /* extend src edge by replication */
0N/A MLIB_EDGE_SRC_EXTEND_ZERO = 6, /* extend src edge with zeros */
0N/A MLIB_EDGE_SRC_EXTEND_MIRROR = 7, /* extend src edge with mirrored data */
0N/A MLIB_EDGE_SRC_PADDED = 8 /* use borders specified in mlib_image structure */
0N/A} mlib_edge;
0N/A
0N/Atypedef enum {
0N/A MLIB_BLEND_ZERO = 0,
0N/A MLIB_BLEND_ONE = 1,
0N/A MLIB_BLEND_DST_COLOR = 2,
0N/A MLIB_BLEND_SRC_COLOR = 3,
0N/A MLIB_BLEND_ONE_MINUS_DST_COLOR = 4,
0N/A MLIB_BLEND_ONE_MINUS_SRC_COLOR = 5,
0N/A MLIB_BLEND_DST_ALPHA = 6,
0N/A MLIB_BLEND_SRC_ALPHA = 7,
0N/A MLIB_BLEND_ONE_MINUS_DST_ALPHA = 8,
0N/A MLIB_BLEND_ONE_MINUS_SRC_ALPHA = 9,
0N/A MLIB_BLEND_SRC_ALPHA_SATURATE = 10
0N/A} mlib_blend;
0N/A
0N/Atypedef enum {
0N/A MLIB_DFT_SCALE_NONE = 0, /* forward transform without scaling */
0N/A MLIB_DFT_SCALE_MXN = 1, /* forward transform with scaling of
0N/A 1/(M*N) */
0N/A MLIB_DFT_SCALE_SQRT = 2, /* forward transform with scaling of
0N/A 1/sqrt(M*N) */
0N/A MLIB_IDFT_SCALE_NONE = 3, /* inverse transform without scaling */
0N/A MLIB_IDFT_SCALE_MXN = 4, /* inverse transform with scaling of
0N/A 1/(M*N) */
0N/A MLIB_IDFT_SCALE_SQRT = 5 /* inverse transform with scaling of
0N/A 1/sqrt(M*N) */
0N/A} mlib_fourier_mode;
0N/A
0N/Atypedef enum {
0N/A MLIB_MEDIAN_MASK_RECT = 0, /* Rectangle shaped mask */
0N/A MLIB_MEDIAN_MASK_PLUS = 1, /* Plus shaped mask */
0N/A MLIB_MEDIAN_MASK_X = 2, /* X shaped mask */
0N/A MLIB_MEDIAN_MASK_RECT_SEPARABLE = 3 /* Separable rectangle mask */
0N/A} mlib_median_mask;
0N/A
0N/Atypedef enum { /* constants used for pixel format */
0N/A MLIB_FORMAT_UNKNOWN = 0,
0N/A MLIB_FORMAT_INDEXED = 1,
0N/A MLIB_FORMAT_GRAYSCALE = 2,
0N/A MLIB_FORMAT_RGB = 3,
0N/A MLIB_FORMAT_BGR = 4,
0N/A MLIB_FORMAT_ARGB = 5,
0N/A MLIB_FORMAT_ABGR = 6,
0N/A MLIB_FORMAT_PACKED_ARGB = 7,
0N/A MLIB_FORMAT_PACKED_ABGR = 8,
0N/A MLIB_FORMAT_GRAYSCALE_ALPHA = 9,
0N/A MLIB_FORMAT_RGBA = 10
0N/A} mlib_format;
0N/A
0N/Atypedef struct {
0N/A mlib_type type; /* data type of image */
0N/A mlib_s32 channels; /* number of channels */
0N/A mlib_s32 width; /* width of image in pixels, x dimension */
0N/A mlib_s32 height; /* height of image in pixels, y dimension */
0N/A mlib_s32 stride; /* linestride = bytes to next row */
0N/A mlib_s32 flags; /* collection of helpful hints */
0N/A void *data; /* pointer to first data pixel */
0N/A void *state; /* internal state structure */
0N/A mlib_u8 paddings[4]; /* left, top, right, bottom */
0N/A mlib_s32 bitoffset; /* the offset in bits from the beginning */
0N/A /* of the data buffer to the first pixel */
0N/A mlib_format format; /* pixels format */
0N/A mlib_s32 reserved[7 - 2*sizeof(void*)/4];
0N/A /* Reserved for future use. Also makes */
0N/A /* size of this structure = 64 bytes, which */
0N/A /* is the size of the cache line. */
0N/A} mlib_image;
0N/A
0N/A/*
0N/A * Flags or hints are contained in a 32-bit integer. The bit structure is
0N/A * shown below:
0N/A *
0N/A * 3 2 1
0N/A * 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
0N/A * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0N/A * |S| |U|V| shint | hhint | whint | dhint |
0N/A * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0N/A *
0N/A * S = 0 - attributes have been set (attribute field >= 0)
0N/A * 1 - attributes have not been set (attribute field < 0)
0N/A *
0N/A * U = 0 - mediaLib allocated data space
0N/A * 1 - user allocated data space
0N/A *
0N/A * V = 0 - stride == width => 1-D vector
0N/A * 1 - stride != width
0N/A *
0N/A * shint - last 4 bits of stride
0N/A *
0N/A * hhint - last 4 bits of height
0N/A *
0N/A * whint - last 4 bits of width
0N/A *
0N/A * dhint - last 8 bits of data address
0N/A */
0N/A
0N/Aenum {
0N/A MLIB_IMAGE_ALIGNED64 = 0x3f,
0N/A MLIB_IMAGE_ALIGNED8 = 0x7,
0N/A MLIB_IMAGE_ALIGNED4 = 0x3,
0N/A MLIB_IMAGE_ALIGNED2 = 0x1,
0N/A MLIB_IMAGE_WIDTH8X = 0x700,
0N/A MLIB_IMAGE_WIDTH4X = 0x300,
0N/A MLIB_IMAGE_WIDTH2X = 0x100,
0N/A MLIB_IMAGE_HEIGHT8X = 0x7000,
0N/A MLIB_IMAGE_HEIGHT4X = 0x3000,
0N/A MLIB_IMAGE_HEIGHT2X = 0x1000,
0N/A MLIB_IMAGE_STRIDE8X = 0x70000,
0N/A MLIB_IMAGE_ONEDVECTOR = 0x100000,
0N/A MLIB_IMAGE_USERALLOCATED = 0x200000,
0N/A MLIB_IMAGE_ATTRIBUTESET = 0x7fffffff
0N/A};
0N/A
0N/A#ifdef __cplusplus
0N/A}
0N/A#endif
0N/A
0N/A#endif /* MLIB_IMAGE_TYPES_H */