Compilation fixes with missing import.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / PencilShelf.java
bloba57dffe308ee316291aa23eb45bad2c84449ee3a
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
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;
19 import cc.squirreljme.runtime.cldc.annotation.SquirrelJMEVendorApi;
21 /**
22 * This shelf is responsible for accelerated graphics drawing.
24 * @see PencilBracket
25 * @since 2020/09/25
27 @SquirrelJMEVendorApi
28 public final class PencilShelf
30 /**
31 * Not used.
33 * @since 2020/09/25
35 @SquirrelJMEVendorApi
36 private PencilShelf()
40 /**
41 * Returns the capabilities of the native possibly hardware accelerated
42 * pencil graphics drawing for the given pixel format.
44 * @param __pf The {@link UIPixelFormat} being used for drawing.
45 * @throws MLECallError If the pixel format is not valid.
46 * @return The capabilities, will be the bit-field of
47 * {@link PencilCapabilities}. If there is not capability for this format
48 * then {@code 0} will be returned.
49 * @since 2020/09/25
51 @SquirrelJMEVendorApi
52 public static native int capabilities(int __pf)
53 throws MLECallError;
55 /**
56 * Draws a line in hardware.
58 * @param __g The hardware graphics to draw with.
59 * @param __x1 The starting X coordinate.
60 * @param __y1 The starting Y coordinate.
61 * @param __x2 The ending X coordinate.
62 * @param __y2 The ending Y coordinate.
63 * @throws MLECallError On null arguments.
64 * @since 2021/12/05
66 @SquirrelJMEVendorApi
67 public static native void hardwareDrawLine(PencilBracket __g,
68 int __x1, int __y1, int __x2, int __y2)
69 throws MLECallError;
71 /**
72 * Draws a region of 32-bit RGB data into the target.
74 * @param __data The source buffer.
75 * @param __off The offset into the buffer.
76 * @param __scanLen The scanline length.
77 * @param __alpha Drawing with the alpha channel?
78 * @param __xSrc The source X position.
79 * @param __ySrc The source Y position.
80 * @param __wSrc The width of the source region.
81 * @param __hSrc The height of the source region.
82 * @param __trans Sprite translation and/or rotation, see
83 * {@code javax.microedition.lcdui.game.Sprite}.
84 * @param __xDest The destination X position, is translated.
85 * @param __yDest The destination Y position, is translated.
86 * @param __anch The anchor point.
87 * @param __wDest The destination width.
88 * @param __hDest The destination height.
89 * @param __origImgWidth Original image width.
90 * @param __origImgHeight Original image height.
91 * @throws MLECallError On null arguments.
92 * @since 2022/01/26
94 @SquirrelJMEVendorApi
95 public static native void hardwareDrawXRGB32Region(
96 PencilBracket __hardware, int[] __data, int __off, int __scanLen,
97 boolean __alpha, int __xSrc, int __ySrc, int __wSrc, int __hSrc,
98 int __trans, int __xDest, int __yDest, int __anch, int __wDest,
99 int __hDest, int __origImgWidth, int __origImgHeight)
100 throws MLECallError;
103 * Performs rectangular fill in hardware.
105 * @param __g The hardware graphics to draw with.
106 * @param __x The X coordinate.
107 * @param __y The Y coordinate.
108 * @param __w The width.
109 * @param __h The height.
110 * @throws MLECallError On {@code null} arguments.
111 * @since 2021/12/05
113 @SquirrelJMEVendorApi
114 public static native void hardwareFillRect(PencilBracket __g,
115 int __x, int __y, int __w, int __h)
116 throws MLECallError;
119 * Creates a hardware reference bracket to the native hardware graphics.
121 * @param __pf The {@link UIPixelFormat} used for the draw.
122 * @param __bw The buffer width, this is the scanline width of the buffer.
123 * @param __bh The buffer height.
124 * @param __buf The target buffer to draw to, this is cast to the correct
125 * buffer format.
126 * @param __offset The offset to the start of the buffer.
127 * @param __pal The color palette, may be {@code null}.
128 * @param __sx Starting surface X coordinate.
129 * @param __sy Starting surface Y coordinate.
130 * @param __sw Surface width.
131 * @param __sh Surface height.
132 * @throws MLECallError If the requested graphics are not valid.
133 * @since 2020/09/25
135 @SquirrelJMEVendorApi
136 public static native PencilBracket hardwareGraphics(int __pf, int __bw,
137 int __bh, Object __buf, int __offset, int[] __pal, int __sx, int __sy,
138 int __sw, int __sh)
139 throws MLECallError;
142 * Sets the alpha color for graphics.
144 * @param __g The hardware graphics to draw with.
145 * @param __argb The color to set.
146 * @throws MLECallError On {@code null} arguments.
147 * @since 2021/12/05
149 @SquirrelJMEVendorApi
150 public static native void hardwareSetAlphaColor(PencilBracket __g,
151 int __argb)
152 throws MLECallError;
155 * Sets the blending mode to use.
157 * @param __g The hardware graphics to draw with.
158 * @param __mode The blending mode to use.
159 * @throws MLECallError On {@code null} arguments.
160 * @since 2021/12/05
162 @SquirrelJMEVendorApi
163 public static native void hardwareSetBlendingMode(PencilBracket __g,
164 int __mode)
165 throws MLECallError;
168 * Sets the clipping rectangle position.
170 * @param __g The hardware graphics to draw with.
171 * @param __x The X coordinate.
172 * @param __y The Y coordinate.
173 * @param __w The width.
174 * @param __h The height.
175 * @throws MLECallError On {@code null} arguments.
176 * @since 2021/12/05
178 @SquirrelJMEVendorApi
179 public static native void hardwareSetClip(PencilBracket __g,
180 int __x, int __y, int __w, int __h)
181 throws MLECallError;
184 * Sets the stroke style for the hardware graphics.
186 * @param __g The hardware graphics to draw with.
187 * @param __style The stroke type to set.
188 * @throws MLECallError On {@code null} arguments.
189 * @since 2021/12/05
191 @SquirrelJMEVendorApi
192 public static native void hardwareSetStrokeStyle(PencilBracket __g,
193 int __style)
194 throws MLECallError;
197 * Translates drawing operations.
199 * @param __g The hardware graphics to draw with.
200 * @param __x The X translation.
201 * @param __y The Y translation.
202 * @throws MLECallError On {@code null} arguments.
203 * @since 2021/12/05
205 @SquirrelJMEVendorApi
206 public static native void hardwareTranslate(PencilBracket __g, int __x,
207 int __y)
208 throws MLECallError;
211 * Performs native image loading and returns a semi-modified RGB buffer
212 * where the first values according to {@link NativeImageLoadParameter}
213 * represent information about the image.
215 * @param __type The {@link NativeImageLoadType} to load.
216 * @param __b The buffer.
217 * @param __o The offset.
218 * @param __l The length.
219 * @return The raw RGB for the image with starting parameters.
220 * @throws MLECallError If the image could not be loaded.
221 * @since 2021/12/05
223 @SquirrelJMEVendorApi
224 public static native int[] nativeImageLoadRGBA(int __type,
225 byte[] __b, int __o, int __l)
226 throws MLECallError;
229 * Returns a bit field of {@link NativeImageLoadType} which indicates which
230 * types of images are capable of being natively loaded on a platform
231 * which requiring byte code to be executed for it.
233 * @return The bit field of {@link NativeImageLoadType} that can be
234 * natively loaded.
235 * @since 2021/12/05
237 @SquirrelJMEVendorApi
238 public static native int nativeImageLoadTypes();