1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.jvm
.mle
;
12 import cc
.squirreljme
.jvm
.mle
.brackets
.PencilBracket
;
13 import cc
.squirreljme
.jvm
.mle
.constants
.NativeImageLoadParameter
;
14 import cc
.squirreljme
.jvm
.mle
.constants
.NativeImageLoadType
;
15 import cc
.squirreljme
.jvm
.mle
.constants
.PencilCapabilities
;
16 import cc
.squirreljme
.jvm
.mle
.constants
.UIPixelFormat
;
17 import cc
.squirreljme
.jvm
.mle
.exceptions
.MLECallError
;
18 import cc
.squirreljme
.runtime
.cldc
.annotation
.Api
;
21 * This shelf is responsible for accelerated graphics drawing.
27 public final class PencilShelf
40 * Returns the capabilities of the native possibly hardware accelerated
41 * pencil graphics drawing for the given pixel format.
43 * @param __pf The {@link UIPixelFormat} being used for drawing.
44 * @throws MLECallError If the pixel format is not valid.
45 * @return The capabilities, will be the bit-field of
46 * {@link PencilCapabilities}. If there is not capability for this format
47 * then {@code 0} will be returned.
51 public static native int capabilities(int __pf
)
55 * Draws a line in hardware.
57 * @param __g The hardware graphics to draw with.
58 * @param __x1 The starting X coordinate.
59 * @param __y1 The starting Y coordinate.
60 * @param __x2 The ending X coordinate.
61 * @param __y2 The ending Y coordinate.
62 * @throws MLECallError On null arguments.
66 public static native void hardwareDrawLine(PencilBracket __g
,
67 int __x1
, int __y1
, int __x2
, int __y2
)
71 * Draws a region of 32-bit RGB data into the target.
73 * @param __data The source buffer.
74 * @param __off The offset into the buffer.
75 * @param __scanLen The scanline length.
76 * @param __alpha Drawing with the alpha channel?
77 * @param __xSrc The source X position.
78 * @param __ySrc The source Y position.
79 * @param __wSrc The width of the source region.
80 * @param __hSrc The height of the source region.
81 * @param __trans Sprite translation and/or rotation, see
82 * {@code javax.microedition.lcdui.game.Sprite}.
83 * @param __xDest The destination X position, is translated.
84 * @param __yDest The destination Y position, is translated.
85 * @param __anch The anchor point.
86 * @param __wDest The destination width.
87 * @param __hDest The destination height.
88 * @param __origImgWidth Original image width.
89 * @param __origImgHeight Original image height.
90 * @throws MLECallError On null arguments.
94 public static native void hardwareDrawXRGB32Region(
95 PencilBracket __hardware
, int[] __data
, int __off
, int __scanLen
,
96 boolean __alpha
, int __xSrc
, int __ySrc
, int __wSrc
, int __hSrc
,
97 int __trans
, int __xDest
, int __yDest
, int __anch
, int __wDest
,
98 int __hDest
, int __origImgWidth
, int __origImgHeight
)
102 * Performs rectangular fill in hardware.
104 * @param __g The hardware graphics to draw with.
105 * @param __x The X coordinate.
106 * @param __y The Y coordinate.
107 * @param __w The width.
108 * @param __h The height.
109 * @throws MLECallError On {@code null} arguments.
112 @SquirrelJMEVendorApi
113 public static native void hardwareFillRect(PencilBracket __g
,
114 int __x
, int __y
, int __w
, int __h
)
118 * Creates a hardware reference bracket to the native hardware graphics.
120 * @param __pf The {@link UIPixelFormat} used for the draw.
121 * @param __bw The buffer width, this is the scanline width of the buffer.
122 * @param __bh The buffer height.
123 * @param __buf The target buffer to draw to, this is cast to the correct
125 * @param __offset The offset to the start of the buffer.
126 * @param __pal The color palette, may be {@code null}.
127 * @param __sx Starting surface X coordinate.
128 * @param __sy Starting surface Y coordinate.
129 * @param __sw Surface width.
130 * @param __sh Surface height.
131 * @throws MLECallError If the requested graphics are not valid.
134 @SquirrelJMEVendorApi
135 public static native PencilBracket
hardwareGraphics(int __pf
, int __bw
,
136 int __bh
, Object __buf
, int __offset
, int[] __pal
, int __sx
, int __sy
,
141 * Sets the alpha color for graphics.
143 * @param __g The hardware graphics to draw with.
144 * @param __argb The color to set.
145 * @throws MLECallError On {@code null} arguments.
148 @SquirrelJMEVendorApi
149 public static native void hardwareSetAlphaColor(PencilBracket __g
,
154 * Sets the blending mode to use.
156 * @param __g The hardware graphics to draw with.
157 * @param __mode The blending mode to use.
158 * @throws MLECallError On {@code null} arguments.
161 @SquirrelJMEVendorApi
162 public static native void hardwareSetBlendingMode(PencilBracket __g
,
167 * Sets the clipping rectangle position.
169 * @param __g The hardware graphics to draw with.
170 * @param __x The X coordinate.
171 * @param __y The Y coordinate.
172 * @param __w The width.
173 * @param __h The height.
174 * @throws MLECallError On {@code null} arguments.
177 @SquirrelJMEVendorApi
178 public static native void hardwareSetClip(PencilBracket __g
,
179 int __x
, int __y
, int __w
, int __h
)
183 * Sets the stroke style for the hardware graphics.
185 * @param __g The hardware graphics to draw with.
186 * @param __style The stroke type to set.
187 * @throws MLECallError On {@code null} arguments.
190 @SquirrelJMEVendorApi
191 public static native void hardwareSetStrokeStyle(PencilBracket __g
,
196 * Translates drawing operations.
198 * @param __g The hardware graphics to draw with.
199 * @param __x The X translation.
200 * @param __y The Y translation.
201 * @throws MLECallError On {@code null} arguments.
204 @SquirrelJMEVendorApi
205 public static native void hardwareTranslate(PencilBracket __g
, int __x
,
210 * Performs native image loading and returns a semi-modified RGB buffer
211 * where the first values according to {@link NativeImageLoadParameter}
212 * represent information about the image.
214 * @param __type The {@link NativeImageLoadType} to load.
215 * @param __b The buffer.
216 * @param __o The offset.
217 * @param __l The length.
218 * @return The raw RGB for the image with starting parameters.
219 * @throws MLECallError If the image could not be loaded.
222 @SquirrelJMEVendorApi
223 public static native int[] nativeImageLoadRGBA(int __type
,
224 byte[] __b
, int __o
, int __l
)
228 * Returns a bit field of {@link NativeImageLoadType} which indicates which
229 * types of images are capable of being natively loaded on a platform
230 * which requiring byte code to be executed for it.
232 * @return The bit field of {@link NativeImageLoadType} that can be
236 @SquirrelJMEVendorApi
237 public static native int nativeImageLoadTypes();