Add vendor API to software math.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / PencilShelf.java
blob930edd0fe6e1dbfffab32c60d683f16ceca5107c
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;
20 /**
21 * This shelf is responsible for accelerated graphics drawing.
23 * @see PencilBracket
24 * @since 2020/09/25
26 @SquirrelJMEVendorApi
27 public final class PencilShelf
29 /**
30 * Not used.
32 * @since 2020/09/25
34 @SquirrelJMEVendorApi
35 private PencilShelf()
39 /**
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.
48 * @since 2020/09/25
50 @SquirrelJMEVendorApi
51 public static native int capabilities(int __pf)
52 throws MLECallError;
54 /**
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.
63 * @since 2021/12/05
65 @SquirrelJMEVendorApi
66 public static native void hardwareDrawLine(PencilBracket __g,
67 int __x1, int __y1, int __x2, int __y2)
68 throws MLECallError;
70 /**
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.
91 * @since 2022/01/26
93 @SquirrelJMEVendorApi
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)
99 throws MLECallError;
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.
110 * @since 2021/12/05
112 @SquirrelJMEVendorApi
113 public static native void hardwareFillRect(PencilBracket __g,
114 int __x, int __y, int __w, int __h)
115 throws MLECallError;
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
124 * buffer format.
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.
132 * @since 2020/09/25
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,
137 int __sw, int __sh)
138 throws MLECallError;
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.
146 * @since 2021/12/05
148 @SquirrelJMEVendorApi
149 public static native void hardwareSetAlphaColor(PencilBracket __g,
150 int __argb)
151 throws MLECallError;
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.
159 * @since 2021/12/05
161 @SquirrelJMEVendorApi
162 public static native void hardwareSetBlendingMode(PencilBracket __g,
163 int __mode)
164 throws MLECallError;
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.
175 * @since 2021/12/05
177 @SquirrelJMEVendorApi
178 public static native void hardwareSetClip(PencilBracket __g,
179 int __x, int __y, int __w, int __h)
180 throws MLECallError;
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.
188 * @since 2021/12/05
190 @SquirrelJMEVendorApi
191 public static native void hardwareSetStrokeStyle(PencilBracket __g,
192 int __style)
193 throws MLECallError;
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.
202 * @since 2021/12/05
204 @SquirrelJMEVendorApi
205 public static native void hardwareTranslate(PencilBracket __g, int __x,
206 int __y)
207 throws MLECallError;
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.
220 * @since 2021/12/05
222 @SquirrelJMEVendorApi
223 public static native int[] nativeImageLoadRGBA(int __type,
224 byte[] __b, int __o, int __l)
225 throws MLECallError;
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
233 * natively loaded.
234 * @since 2021/12/05
236 @SquirrelJMEVendorApi
237 public static native int nativeImageLoadTypes();