01: /*
02: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24: package com.sun.mmedia;
25:
26: /**
27: * Utility class that provides I/F to native
28: * image/audio/video format conversion code:
29: *
30: * currently implemented image RGB -to-JPEG & -to-PNG conversion
31: */
32: public final class ImageEncoder {
33:
34: public static final int CONVERT_RGB_TO_JPEG = 1;
35: public static final int CONVERT_RGB_TO_PNG = 2;
36:
37: /**
38: * converts xrgb image to jpeg or png format.
39: * this function is platform independent, since
40: * byte ordder doesn't depend on big-/little-endian platform.
41: *
42: * @param xrgb raw RGB data in form of byte array (4 bytes per pixel)
43: * @param w width of frame
44: * @param h height of frame
45: * @param qual quality - for JPEG
46: * @param compressed data to be output
47: * @param encType 1 for JPEG, 2 for PNG
48: * @return the size of the compressed data
49: */
50: public static native int RGBByteCompress(byte[] xrgb, int w, int h,
51: int qual, byte[] compressed, int encType);
52:
53: /**
54: * converts xrgb image to jpeg or png format
55: * this function is platform DEPENDENT, since
56: * byte order in int depends on big-/little-endian platform !
57: * Current implementation works for little-endian only (x86) !
58: *
59: * @param xrgb raw RGB data in form of int array (32-bit per pixel)
60: * @param w width of frame
61: * @param h height of frame
62: * @param qual quality - for JPEG
63: * @param compressed data to be output
64: * @param encType 1 for JPEG, 2 for PNG
65: * @return the size of the compressed data
66: */
67: public static native int RGBIntCompress(int[] xrgb, int w, int h,
68: int qual, byte[] compressed, int encType);
69: }
|