Check-in [9fbed3bd18]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove CLIP_RECT, TRANSLATE, GET_TRANSLATE_X, and GET_TRANSLATE_Y from serialized graphics to simplify them; Add capabilities support for the framebuffer; Reduce argument count in drawRegion() so it fits within the system call limits; Add system calls for accelerated graphics support; Shorten FRAMEBUFFER_ to FB_ in RatufaCoat; Shorten FramebufferProperty to Framebuffer since it contains all of the Framebuffer stuff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9fbed3bd18fec8edda820e79e0fe5ebfdf65bacb
User & Date: stephanie.gawroriski 2020-01-09 19:17:35
Context
2020-01-12
14:48
Add SystemCallException and nicer SystemCallError; Initialize UI via format. check-in: 037a21425e user: stephanie.gawroriski tags: trunk
2020-01-09
19:17
Remove CLIP_RECT, TRANSLATE, GET_TRANSLATE_X, and GET_TRANSLATE_Y from serialized graphics to simplify them; Add capabilities support for the framebuffer; Reduce argument count in drawRegion() so it fits within the system call limits; Add system calls for accelerated graphics support; Shorten FRAMEBUFFER_ to FB_ in RatufaCoat; Shorten FramebufferProperty to Framebuffer since it contains all of the Framebuffer stuff. check-in: 9fbed3bd18 user: stephanie.gawroriski tags: trunk
2020-01-05
13:15
Make RatufaCoat's default makefile use -g1 -O3 for compilation flags. check-in: ed044237eb user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/Assembly.java.

1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
				return 0;
				
				// Property of the framebuffer
			case SystemCallIndex.FRAMEBUFFER:
				try
				{
					return SwingFramebuffer.instance().vfb.
						framebufferProperty(__args);
				}
				catch (Throwable t)
				{
					// Print the exception
					t.printStackTrace();
					
					// Drop







|







1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
				return 0;
				
				// Property of the framebuffer
			case SystemCallIndex.FRAMEBUFFER:
				try
				{
					return SwingFramebuffer.instance().vfb.
						framebufferControl(__args);
				}
				catch (Throwable t)
				{
					// Print the exception
					t.printStackTrace();
					
					// Drop

Changes to ratufacoat/sjmecon.h.

577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630









631
632


















































































































633
634
635
636
637
638
639
#define SJME_CALLSTACKITEM_NUM_ITEMS SJME_JINT_C(9)

/*****************************************************************************
*************************** FRAMEBUFFER PROPERTIES ***************************
*****************************************************************************/

/** The ID used for IPC calls for graphics. */
#define SJME_FRAMEBUFFER_IPC_ID SJME_JINT_C(0x47665821)

/** Returns the address of the framebuffer. */
#define SJME_FRAMEBUFFER_PROPERTY_ADDRESS SJME_JINT_C(1)

/** Returns the width of the framebuffer. */
#define SJME_FRAMEBUFFER_PROPERTY_WIDTH SJME_JINT_C(2)

/** Returns the height of the framebuffer. */
#define SJME_FRAMEBUFFER_PROPERTY_HEIGHT SJME_JINT_C(3)

/** Returns the scanline length in pixels. */
#define SJME_FRAMEBUFFER_PROPERTY_SCANLEN SJME_JINT_C(4)

/** Flushes the framebuffer. */
#define SJME_FRAMEBUFFER_PROPERTY_FLUSH SJME_JINT_C(5)

/** Pixel format of the screen. */
#define SJME_FRAMEBUFFER_PROPERTY_FORMAT SJME_JINT_C(6)

/** Returns the scanline length in bytes. */
#define SJME_FRAMEBUFFER_PROPERTY_SCANLEN_BYTES SJME_JINT_C(7)

/** Returns the number of bytes per pixel. */
#define SJME_FRAMEBUFFER_PROPERTY_BYTES_PER_PIXEL SJME_JINT_C(8)

/** Number of pixels in the display. */
#define SJME_FRAMEBUFFER_PROPERTY_NUM_PIXELS SJME_JINT_C(9)

/** Number of bits per pixel. */
#define SJME_FRAMEBUFFER_PROPERTY_BITS_PER_PIXEL SJME_JINT_C(10)

/** Get backlight level. */
#define SJME_FRAMEBUFFER_PROPERTY_BACKLIGHT_LEVEL_GET SJME_JINT_C(11)

/** Set backlight level. */
#define SJME_FRAMEBUFFER_PROPERTY_BACKLIGHT_LEVEL_SET SJME_JINT_C(12)

/** Maximum backlight level. */
#define SJME_FRAMEBUFFER_PROPERTY_BACKLIGHT_LEVEL_MAX SJME_JINT_C(13)

/** Upload integer array. */
#define SJME_FRAMEBUFFER_PROPERTY_UPLOAD_ARRAY_INT SJME_JINT_C(14)

/** The backing object for the framebuffer, if there is one. */
#define SJME_FRAMEBUFFER_PROPERTY_BACKING_ARRAY_OBJECT SJME_JINT_C(15)










/** Maximum properties. */
#define SJME_FRAMEBUFFER_PROPERTY_NUM_PROPERTIES SJME_JINT_C(16)



















































































































/*****************************************************************************
*************************** SUPERVISOR PROPERTIES ****************************
*****************************************************************************/

/** The static field register of the task syscall handler. */
#define SJME_SUPERPROP_TASK_SYSCALL_STATIC_FIELD_POINTER SJME_JINT_C(1)







|


|


|


|


|


|


|


|


|


|


|


|


|


|


|


|

>
>
>
>
>
>
>
>
>

<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640

641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
#define SJME_CALLSTACKITEM_NUM_ITEMS SJME_JINT_C(9)

/*****************************************************************************
*************************** FRAMEBUFFER PROPERTIES ***************************
*****************************************************************************/

/** The ID used for IPC calls for graphics. */
#define SJME_FB_IPC_ID SJME_JINT_C(0x47665821)

/** Returns the address of the framebuffer. */
#define SJME_FB_CONTROL_ADDRESS SJME_JINT_C(1)

/** Returns the width of the framebuffer. */
#define SJME_FB_CONTROL_WIDTH SJME_JINT_C(2)

/** Returns the height of the framebuffer. */
#define SJME_FB_CONTROL_HEIGHT SJME_JINT_C(3)

/** Returns the scanline length in pixels. */
#define SJME_FB_CONTROL_SCANLEN SJME_JINT_C(4)

/** Flushes the framebuffer. */
#define SJME_FB_CONTROL_FLUSH SJME_JINT_C(5)

/** Pixel format of the screen. */
#define SJME_FB_CONTROL_FORMAT SJME_JINT_C(6)

/** Returns the scanline length in bytes. */
#define SJME_FB_CONTROL_SCANLEN_BYTES SJME_JINT_C(7)

/** Returns the number of bytes per pixel. */
#define SJME_FB_CONTROL_BYTES_PER_PIXEL SJME_JINT_C(8)

/** Number of pixels in the display. */
#define SJME_FB_CONTROL_NUM_PIXELS SJME_JINT_C(9)

/** Number of bits per pixel. */
#define SJME_FB_CONTROL_BITS_PER_PIXEL SJME_JINT_C(10)

/** Get backlight level. */
#define SJME_FB_CONTROL_BACKLIGHT_LEVEL_GET SJME_JINT_C(11)

/** Set backlight level. */
#define SJME_FB_CONTROL_BACKLIGHT_LEVEL_SET SJME_JINT_C(12)

/** Maximum backlight level. */
#define SJME_FB_CONTROL_BACKLIGHT_LEVEL_MAX SJME_JINT_C(13)

/** Upload integer array. */
#define SJME_FB_CONTROL_UPLOAD_ARRAY_INT SJME_JINT_C(14)

/** The backing object for the framebuffer, if there is one. */
#define SJME_FB_CONTROL_BACKING_ARRAY_OBJECT SJME_JINT_C(15)

/** Gets the capabilities of the display. */
#define SJME_FB_CONTROL_GET_CAPABILITIES SJME_JINT_C(16)

/** Query acceleration graphics support. */
#define SJME_FB_CONTROL_ACCEL_FUNC_QUERY SJME_JINT_C(17)

/** Invoke accelerated graphics operation. */
#define SJME_FB_CONTROL_ACCEL_FUNC_INVOKE SJME_JINT_C(18)

/** Maximum properties. */

#define SJME_FB_NUM_CONTROLS SJME_JINT_C(19)

/*****************************************************************************
************************** FRAMEBUFFER ACCELERATION **************************
*****************************************************************************/

/** Set color. */
#define SJME_FB_ACCEL_FUNC_SET_COLOR SJME_JINT_C(0)

/** Draw line. */
#define SJME_FB_ACCEL_FUNC_DRAW_LINE SJME_JINT_C(1)

/** Get the X clip. */
#define SJME_FB_ACCEL_FUNC_GET_CLIP_X SJME_JINT_C(2)

/** Get the Y clip. */
#define SJME_FB_ACCEL_FUNC_GET_CLIP_Y SJME_JINT_C(3)

/** Get the width clip. */
#define SJME_FB_ACCEL_FUNC_GET_CLIP_WIDTH SJME_JINT_C(4)

/** Get the height clip. */
#define SJME_FB_ACCEL_FUNC_GET_CLIP_HEIGHT SJME_JINT_C(5)

/** Set the clip. */
#define SJME_FB_ACCEL_FUNC_SET_CLIP SJME_JINT_C(6)

/** Draw rectangle. */
#define SJME_FB_ACCEL_FUNC_DRAW_RECT SJME_JINT_C(7)

/** Get the alpha color. */
#define SJME_FB_ACCEL_FUNC_GET_ALPHA_COLOR SJME_JINT_C(8)

/** Set the alpha color. */
#define SJME_FB_ACCEL_FUNC_SET_ALPHA_COLOR SJME_JINT_C(9)

/** Fill rectangle. */
#define SJME_FB_ACCEL_FUNC_FILL_RECT SJME_JINT_C(10)

/** Sets the fonts for the graphics. */
#define SJME_FB_ACCEL_FUNC_SET_FONT SJME_JINT_C(11)

/** Gets the font to use for drawing. */
#define SJME_FB_ACCEL_FUNC_GET_FONT SJME_JINT_C(12)

/** Draw sub-characters. */
#define SJME_FB_ACCEL_FUNC_DRAW_SUB_CHARS SJME_JINT_C(13)

/** Draw text. */
#define SJME_FB_ACCEL_FUNC_DRAW_TEXT SJME_JINT_C(14)

/** Get stroke style. */
#define SJME_FB_ACCEL_FUNC_GET_STROKE_STYLE SJME_JINT_C(15)

/** Set stroke style. */
#define SJME_FB_ACCEL_FUNC_SET_STROKE_STYLE SJME_JINT_C(16)

/** Copy area. */
#define SJME_FB_ACCEL_FUNC_COPY_AREA SJME_JINT_C(17)

/** Draw arc. */
#define SJME_FB_ACCEL_FUNC_DRAW_ARC SJME_JINT_C(18)

/** Draw ARGB16. */
#define SJME_FB_ACCEL_FUNC_DRAW_ARGB16 SJME_JINT_C(19)

/** Draw character. */
#define SJME_FB_ACCEL_FUNC_DRAW_CHAR SJME_JINT_C(20)

/** Draw characters. */
#define SJME_FB_ACCEL_FUNC_DRAW_CHARS SJME_JINT_C(21)

/** Draw RGB. */
#define SJME_FB_ACCEL_FUNC_DRAW_RGB SJME_JINT_C(22)

/** Draw RGB16. */
#define SJME_FB_ACCEL_FUNC_DRAW_RGB16 SJME_JINT_C(23)

/** Draw round rectangle. */
#define SJME_FB_ACCEL_FUNC_DRAW_ROUND_RECT SJME_JINT_C(24)

/** Fill arc. */
#define SJME_FB_ACCEL_FUNC_FILL_ARC SJME_JINT_C(25)

/** Fill round rectangle. */
#define SJME_FB_ACCEL_FUNC_FILL_ROUND_RECT SJME_JINT_C(26)

/** Fill triangle. */
#define SJME_FB_ACCEL_FUNC_FILL_TRIANGLE SJME_JINT_C(27)

/** Get blending mode. */
#define SJME_FB_ACCEL_FUNC_GET_BLENDING_MODE SJME_JINT_C(28)

/** Get display color. */
#define SJME_FB_ACCEL_FUNC_GET_DISPLAY_COLOR SJME_JINT_C(29)

/** Set blending mode. */
#define SJME_FB_ACCEL_FUNC_SET_BLENDING_MODE SJME_JINT_C(30)

/** Draw region. */
#define SJME_FB_ACCEL_FUNC_DRAW_REGION SJME_JINT_C(31)

/** The number of draw functions. */
#define SJME_FB_NUM_ACCEL_FUNC SJME_JINT_C(32)

/*****************************************************************************
*************************** FRAMEBUFFER CAPABILITY ***************************
*****************************************************************************/

/** Has touch. */
#define SJME_FB_CAPABILITY_TOUCH SJME_JINT_C(0x01)

/** Has keyboard. */
#define SJME_FB_CAPABILITY_KEYBOARD SJME_JINT_C(0x02)

/*****************************************************************************
*************************** SUPERVISOR PROPERTIES ****************************
*****************************************************************************/

/** The static field register of the task syscall handler. */
#define SJME_SUPERPROP_TASK_SYSCALL_STATIC_FIELD_POINTER SJME_JINT_C(1)

Changes to ratufacoat/sjmerc.c.

593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
				return;
			}
			
			/* Depends on the property. */
			switch (args[0])
			{
					/* Framebuffer address. */
				case SJME_FRAMEBUFFER_PROPERTY_ADDRESS:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->framebuffer->fakeptr;
					break;
					
					/* Width of the framebuffer. */
				case SJME_FRAMEBUFFER_PROPERTY_WIDTH:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->width;
					break;
					
					/* Height of the framebuffer. */
				case SJME_FRAMEBUFFER_PROPERTY_HEIGHT:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->height;
					break;
					
					/* Scanline length of the framebuffer. */
				case SJME_FRAMEBUFFER_PROPERTY_SCANLEN:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->scanlen;
					break;
					
					/* Flush the framebuffer. */
				case SJME_FRAMEBUFFER_PROPERTY_FLUSH:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					if (jvm->fbinfo->flush != NULL)
						jvm->fbinfo->flush();
					break;
					
					/* Frame-buffer format. */
				case SJME_FRAMEBUFFER_PROPERTY_FORMAT:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->format;
					break;
					
					/* Scanline length in bytes. */
				case SJME_FRAMEBUFFER_PROPERTY_SCANLEN_BYTES:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->scanlenbytes;
					break;
					
					/* Bytes per pixel. */
				case SJME_FRAMEBUFFER_PROPERTY_BYTES_PER_PIXEL:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->bitsperpixel / 8;
					break;
					
					/* The number of pixels. */
				case SJME_FRAMEBUFFER_PROPERTY_NUM_PIXELS:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->numpixels;
					break;
					
					/* Bits per pixels. */
				case SJME_FRAMEBUFFER_PROPERTY_BITS_PER_PIXEL:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->bitsperpixel;
					break;
				
					/* Unknown property, but there is a framebuffer. */
				default:
					*syserr = SJME_SYSCALL_ERROR_VALUE_OUT_OF_RANGE;







|





|





|





|





|






|





|





|





|





|







593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
				return;
			}
			
			/* Depends on the property. */
			switch (args[0])
			{
					/* Framebuffer address. */
				case SJME_FB_CONTROL_ADDRESS:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->framebuffer->fakeptr;
					break;
					
					/* Width of the framebuffer. */
				case SJME_FB_CONTROL_WIDTH:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->width;
					break;
					
					/* Height of the framebuffer. */
				case SJME_FB_CONTROL_HEIGHT:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->height;
					break;
					
					/* Scanline length of the framebuffer. */
				case SJME_FB_CONTROL_SCANLEN:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->scanlen;
					break;
					
					/* Flush the framebuffer. */
				case SJME_FB_CONTROL_FLUSH:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					if (jvm->fbinfo->flush != NULL)
						jvm->fbinfo->flush();
					break;
					
					/* Frame-buffer format. */
				case SJME_FB_CONTROL_FORMAT:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->format;
					break;
					
					/* Scanline length in bytes. */
				case SJME_FB_CONTROL_SCANLEN_BYTES:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->scanlenbytes;
					break;
					
					/* Bytes per pixel. */
				case SJME_FB_CONTROL_BYTES_PER_PIXEL:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->bitsperpixel / 8;
					break;
					
					/* The number of pixels. */
				case SJME_FB_CONTROL_NUM_PIXELS:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->numpixels;
					break;
					
					/* Bits per pixels. */
				case SJME_FB_CONTROL_BITS_PER_PIXEL:
					*syserr = SJME_SYSCALL_ERROR_NO_ERROR;
					rv->lo = jvm->fbinfo->bitsperpixel;
					break;
				
					/* Unknown property, but there is a framebuffer. */
				default:
					*syserr = SJME_SYSCALL_ERROR_VALUE_OUT_OF_RANGE;

Name change from runt/apis/cldc-compact/cc/squirreljme/jvm/FramebufferProperty.java to runt/apis/cldc-compact/cc/squirreljme/jvm/Framebuffer.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139





140
141
142


























143
144
145
146
147
148
149
...
159
160
161
162
163
164
165
166












































































































































167
168
169
170
171
package cc.squirreljme.jvm;

/**
 * This is used to get/set the property of the framebuffer.
 *
 * @since 2019/06/20
 */
public interface FramebufferProperty
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @return The framebuffer address.
	 */
	public static final byte ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @return The framebuffer width.
	 */
	public static final byte WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @return The framebuffer height.
	 */
	public static final byte HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @return The framebuffer scanline length.
	 */
	public static final byte SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	public static final byte FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @return The pixel format of the screen.
	 */
	public static final byte FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @return The scanline length in bytes.
	 */
	public static final byte SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @return The bytes per pixel.
	 */
	public static final byte BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @return The number of pixels.
	 */
	public static final byte NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @return The bits per pixel.
	 */
	public static final byte BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @return The current backlight level.
	 */
	public static final byte BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @param 1 The level to set.
	 */
	public static final byte BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @return The maximum backlight level.
	 */
	public static final byte BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @param 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	public static final byte UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @return The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	public static final byte BACKING_ARRAY_OBJECT =
		15;
	
	/** The number of framebuffer properties. */





	public static final byte NUM_PROPERTIES =
		16;
	


























	/** Screen is RGB 32-bit. */
	public static final byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	public static final byte FORMAT_BYTE_INDEXED =
		1;
................................................................................
	/** Screen is packed 2 bit values. */
	public static final byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	public static final byte FORMAT_PACKED_FOUR =
		5;
	












































































































































	/** The IPC ID for the graphics callbacks. */
	public static final int IPC_ID =
		0x47665821;
}








|






|







|







|







|





|







|







|







|







|







|







|







|







|








|








|

|
|
>
>
>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
package cc.squirreljme.jvm;

/**
 * This is used to get/set the property of the framebuffer.
 *
 * @since 2019/06/20
 */
public interface Framebuffer
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @return The framebuffer address.
	 */
	public static final byte CONTROL_ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @return The framebuffer width.
	 */
	public static final byte CONTROL_WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @return The framebuffer height.
	 */
	public static final byte CONTROL_HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @return The framebuffer scanline length.
	 */
	public static final byte CONTROL_SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	public static final byte CONTROL_FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @return The pixel format of the screen.
	 */
	public static final byte CONTROL_FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @return The scanline length in bytes.
	 */
	public static final byte CONTROL_SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @return The bytes per pixel.
	 */
	public static final byte CONTROL_BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @return The number of pixels.
	 */
	public static final byte CONTROL_NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @return The bits per pixel.
	 */
	public static final byte CONTROL_BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @return The current backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @param 1 The level to set.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @return The maximum backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @param 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	public static final byte CONTROL_UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @return The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	public static final byte CONTROL_BACKING_ARRAY_OBJECT =
		15;
		
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_GET_CAPABILITIES =
		16;
	
	/**
	 * Query acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @return A non-zero value if this is supported.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_QUERY =
		17;
	
	/**
	 * Perform acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @param ... Parameters to the function.
	 * @return A value that is according to the invoked function, if it is
	 * supported or possible.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_INVOKE =
		18;
	
	/** The number of framebuffer controls. */
	public static final byte NUM_CONTROLS =
		19;
	
	/** Screen is RGB 32-bit. */
	public static final byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	public static final byte FORMAT_BYTE_INDEXED =
		1;
................................................................................
	/** Screen is packed 2 bit values. */
	public static final byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	public static final byte FORMAT_PACKED_FOUR =
		5;
	
	/** Has touch-screen. */
	public static final byte CAPABILITY_TOUCH =
		0x01;
	
	/** Has keyboard. */
	public static final byte CAPABILITY_KEYBOARD =
		0x02;
	
	/** Set color. */
	public static final byte ACCEL_FUNC_SET_COLOR =
		0;
	
	/** Draw line. */
	public static final byte ACCEL_FUNC_DRAW_LINE =
		1;
	
	/** Get the X clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_X =
		2;
	
	/** Get the Y clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_Y =
		3;
	
	/** Get the width clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_WIDTH =
		4;
	
	/** Get the height clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_HEIGHT =
		5;
	
	/** Set the clip. */
	public static final byte ACCEL_FUNC_SET_CLIP =
		6;
	
	/** Draw rectangle. */
	public static final byte ACCEL_FUNC_DRAW_RECT =
		7;
	
	/** Get the alpha color. */
	public static final byte ACCEL_FUNC_GET_ALPHA_COLOR =
		8;
	
	/** Set the alpha color. */
	public static final byte ACCEL_FUNC_SET_ALPHA_COLOR =
		9;
	
	/** Fill rectangle. */
	public static final byte ACCEL_FUNC_FILL_RECT =
		10;
	
	/** Sets the fonts for the graphics. */
	public static final byte ACCEL_FUNC_SET_FONT =
		11;
	
	/** Gets the font to use for drawing. */
	public static final byte ACCEL_FUNC_GET_FONT =
		12;
	
	/** Draw sub-characters. */
	public static final byte ACCEL_FUNC_DRAW_SUB_CHARS =
		13;
	
	/** Draw text. */
	public static final byte ACCEL_FUNC_DRAW_TEXT =
		14;
	
	/** Get stroke style. */
	public static final byte ACCEL_FUNC_GET_STROKE_STYLE =
		15;
	
	/** Set stroke style. */
	public static final byte ACCEL_FUNC_SET_STROKE_STYLE =
		16;
	
	/** Copy area. */
	public static final byte ACCEL_FUNC_COPY_AREA =
		17;
	
	/** Draw arc. */
	public static final byte ACCEL_FUNC_DRAW_ARC =
		18;
	
	/** Draw ARGB16. */
	public static final byte ACCEL_FUNC_DRAW_ARGB16 =
		19;
	
	/** Draw character. */
	public static final byte ACCEL_FUNC_DRAW_CHAR =
		20;
	
	/** Draw characters. */
	public static final byte ACCEL_FUNC_DRAW_CHARS =
		21;
	
	/** Draw RGB. */
	public static final byte ACCEL_FUNC_DRAW_RGB =
		22;
	
	/** Draw RGB16. */
	public static final byte ACCEL_FUNC_DRAW_RGB16 =
		23;
	
	/** Draw round rectangle. */
	public static final byte ACCEL_FUNC_DRAW_ROUND_RECT =
		24;
	
	/** Fill arc. */
	public static final byte ACCEL_FUNC_FILL_ARC =
		25;
	
	/** Fill round rectangle. */
	public static final byte ACCEL_FUNC_FILL_ROUND_RECT =
		26;
	
	/** Fill triangle. */
	public static final byte ACCEL_FUNC_FILL_TRIANGLE =
		27;
	
	/** Get blending mode. */
	public static final byte ACCEL_FUNC_GET_BLENDING_MODE =
		28;
	
	/** Get display color. */
	public static final byte ACCEL_FUNC_GET_DISPLAY_COLOR =
		29;
	
	/** Set blending mode. */
	public static final byte ACCEL_FUNC_SET_BLENDING_MODE =
		30;
	
	/** Draw region. */
	public static final byte ACCEL_FUNC_DRAW_REGION =
		31;
	
	/** Number of acceleration functions. */
	public static final byte NUM_ACCEL_FUNC =
		32;
	
	/** The IPC ID for the graphics callbacks. */
	public static final int IPC_ID =
		0x47665821;
}

Changes to runt/apis/cldc-compact/cc/squirreljme/jvm/SystemCallIndex.java.

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * @return Generally zero as no value is intended to be returned.
	 */
	public static final byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link FramebufferProperty}.
	 *
	 * @param 1 The frame buffer property to select.
	 * @param ... Undefined, this depends on the property selected.
	 * @return Whatever value the frame buffer property will return.
	 */
	public static final byte FRAMEBUFFER =
		24;







|







259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * @return Generally zero as no value is intended to be returned.
	 */
	public static final byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link Framebuffer}.
	 *
	 * @param 1 The frame buffer property to select.
	 * @param ... Undefined, this depends on the property selected.
	 * @return Whatever value the frame buffer property will return.
	 */
	public static final byte FRAMEBUFFER =
		24;

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/AcceleratedGraphics.java.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 * which provides a single instance of accelerated graphics.
 *
 * @since 2018/11/19
 */
public final class AcceleratedGraphics
	extends SerializedGraphics
{
	/** The display to use for drawing the graphics. */
	protected final int display;
	
	/**
	 * Initializes for the given display.
	 *
	 * @param __did The display ID.
	 * @since 2018/11/19
	 */
	AcceleratedGraphics(int __did)
	{
		this.display = __did;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public final Object serialize(GraphicsFunction __func, Object... __args)
	{
		// Forward serialized arguments to the destination host
		return NativeDisplayAccess.accelGfxFunc(this.display,
			__func.ordinal(), __args);
	}
	
	/**
	 * Returns the instance for the given display ID.
	 *
	 * @param __did The display ID.
	 * @return The accelerated graphics instance.
	 * @throws UnsupportedOperationException If accelerated graphics are not
	 * supported.
	 * @since 2018/11/19
	 */
	public static final AcceleratedGraphics instance(int __did)
		throws UnsupportedOperationException
	{
		// {@squirreljme.error EB0a Accelerated graphics operations are not
		// supported for this display. (The display ID)}
		if (!NativeDisplayAccess.accelGfx(__did))
			throw new UnsupportedOperationException("EB0a " + __did);
		
		// Effectively has "new" state
		return new AcceleratedGraphics(__did);
	}
}








<
<
<



<


|

<










|












|




|
|


|



21
22
23
24
25
26
27



28
29
30

31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 * which provides a single instance of accelerated graphics.
 *
 * @since 2018/11/19
 */
public final class AcceleratedGraphics
	extends SerializedGraphics
{



	/**
	 * Initializes for the given display.
	 *

	 * @since 2018/11/19
	 */
	public AcceleratedGraphics()
	{

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public final Object serialize(GraphicsFunction __func, Object... __args)
	{
		// Forward serialized arguments to the destination host
		return NativeDisplayAccess.accelGfxFunc(0,
			__func.ordinal(), __args);
	}
	
	/**
	 * Returns the instance for the given display ID.
	 *
	 * @param __did The display ID.
	 * @return The accelerated graphics instance.
	 * @throws UnsupportedOperationException If accelerated graphics are not
	 * supported.
	 * @since 2018/11/19
	 */
	public static final AcceleratedGraphics instance()
		throws UnsupportedOperationException
	{
		// {@squirreljme.error EB0a Accelerated graphics operations are not
		// supported for this display. (The display ID)}
		if (!NativeDisplayAccess.accelGfx(0))
			throw new UnsupportedOperationException("EB0a " + 0);
		
		// Effectively has "new" state
		return new AcceleratedGraphics();
	}
}

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/GraphicsFunction.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/**
 * This represents a graphical function.
 *
 * @since 2018/11/19
 */
public enum GraphicsFunction
{
	/** Clip rectangle. */
	CLIP_RECT,
	
	/** Set color. */
	SET_COLOR,
	
	/** Draw line. */
	DRAW_LINE,
	
	/** Get the X clip. */
................................................................................
	
	/** Get the width clip. */
	GET_CLIP_WIDTH,
	
	/** Get the height clip. */
	GET_CLIP_HEIGHT,
	
	/** Get X translation. */
	GET_TRANSLATE_X,
	
	/** Get Y translation. */
	GET_TRANSLATE_Y,
	
	/** Translate. */
	TRANSLATE,
	
	/** Set the clip. */
	SET_CLIP,
	
	/** Draw rectangle. */
	DRAW_RECT,
	
	/** Get the alpha color. */
................................................................................
	 */
	public static GraphicsFunction of(int __id)
		throws IllegalArgumentException
	{
		// Depends
		switch (__id)
		{
			case 0:		return CLIP_RECT;
			case 1:		return SET_COLOR;
			case 2:		return DRAW_LINE;
			case 3:		return GET_CLIP_X;
			case 4:		return GET_CLIP_Y;
			case 5:		return GET_CLIP_WIDTH;
			case 6:		return GET_CLIP_HEIGHT;
			case 7:		return GET_TRANSLATE_X;
			case 8:		return GET_TRANSLATE_Y;
			case 9:		return TRANSLATE;
			case 10:	return SET_CLIP;
			case 11:	return DRAW_RECT;
			case 12:	return GET_ALPHA_COLOR;
			case 13:	return SET_ALPHA_COLOR;
			case 14:	return FILL_RECT;
			case 15:	return SET_FONT;
			case 16:	return GET_FONT;
			case 17:	return DRAW_SUB_CHARS;
			case 18:	return DRAW_TEXT;
			case 19:	return GET_STROKE_STYLE;
			case 20:	return SET_STROKE_STYLE;
			case 21:	return COPY_AREA;
			case 22:	return DRAW_ARC;
			case 23:	return DRAW_ARGB16;
			case 24:	return DRAW_CHAR;
			case 25:	return DRAW_CHARS;
			case 26:	return DRAW_RGB;
			case 27:	return DRAW_RGB16;
			case 28:	return DRAW_ROUND_RECT;
			case 29:	return FILL_ARC;
			case 30:	return FILL_ROUND_RECT;
			case 31:	return FILL_TRIANGLE;
			case 32:	return GET_BLENDING_MODE;
			case 33:	return GET_DISPLAY_COLOR;
			case 34:	return SET_BLENDING_MODE;
			case 35:	return DRAW_REGION;
			
				// {@squirreljme.error EB0j Invalid graphics function.
				// (The function ID)}
			default:
				throw new IllegalArgumentException("EB0j " + __id);
		}
	}
}








<
<
<







 







<
<
<
<
<
<
<
<
<







 







<
|
|
|
|
|
|
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|








13
14
15
16
17
18
19



20
21
22
23
24
25
26
..
31
32
33
34
35
36
37









38
39
40
41
42
43
44
...
126
127
128
129
130
131
132

133
134
135
136
137
138



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/**
 * This represents a graphical function.
 *
 * @since 2018/11/19
 */
public enum GraphicsFunction
{



	/** Set color. */
	SET_COLOR,
	
	/** Draw line. */
	DRAW_LINE,
	
	/** Get the X clip. */
................................................................................
	
	/** Get the width clip. */
	GET_CLIP_WIDTH,
	
	/** Get the height clip. */
	GET_CLIP_HEIGHT,
	









	/** Set the clip. */
	SET_CLIP,
	
	/** Draw rectangle. */
	DRAW_RECT,
	
	/** Get the alpha color. */
................................................................................
	 */
	public static GraphicsFunction of(int __id)
		throws IllegalArgumentException
	{
		// Depends
		switch (__id)
		{

			case 0:		return SET_COLOR;
			case 1:		return DRAW_LINE;
			case 2:		return GET_CLIP_X;
			case 3:		return GET_CLIP_Y;
			case 4:		return GET_CLIP_WIDTH;
			case 5:		return GET_CLIP_HEIGHT;



			case 6:		return SET_CLIP;
			case 7:		return DRAW_RECT;
			case 8:		return GET_ALPHA_COLOR;
			case 9:		return SET_ALPHA_COLOR;
			case 10:	return FILL_RECT;
			case 11:	return SET_FONT;
			case 12:	return GET_FONT;
			case 13:	return DRAW_SUB_CHARS;
			case 14:	return DRAW_TEXT;
			case 15:	return GET_STROKE_STYLE;
			case 16:	return SET_STROKE_STYLE;
			case 17:	return COPY_AREA;
			case 18:	return DRAW_ARC;
			case 19:	return DRAW_ARGB16;
			case 20:	return DRAW_CHAR;
			case 21:	return DRAW_CHARS;
			case 22:	return DRAW_RGB;
			case 23:	return DRAW_RGB16;
			case 24:	return DRAW_ROUND_RECT;
			case 25:	return FILL_ARC;
			case 26:	return FILL_ROUND_RECT;
			case 27:	return FILL_TRIANGLE;
			case 28:	return GET_BLENDING_MODE;
			case 29:	return GET_DISPLAY_COLOR;
			case 30:	return SET_BLENDING_MODE;
			case 31:	return DRAW_REGION;
				
				// {@squirreljme.error EB0j Invalid graphics function.
				// (The function ID)}
			default:
				throw new IllegalArgumentException("EB0j " + __id);
		}
	}
}

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/gfx/SerializedGraphics.java.

20
21
22
23
24
25
26




27
28
29
30
31
32






33
34
35
36
37
38
39
..
44
45
46
47
48
49
50


















51
52




53
54
55
56
57
58
59
60
61
62
63



64
65


66
67
68
69
70
71
72
73
74
75



76
77
78
79
80
81
82
83
84
85
86
87
88



89
90
91
92
93
94
95
96
97
98
99



100
101

102
103
104
105
106
107
108
109
110
111
112



113
114
115
116
117
118
119
120
121
...
132
133
134
135
136
137
138



139
140

141
142
143
144
145
146
147
148
149
150
151



152

153
154
155
156
157
158
159
160
161
162
163
164



165
166
167
168
169
170
171
172
173
174
175



176
177

178
179
180
181
182
183
184
...
202
203
204
205
206
207
208



209
210
211
212
213
214
215
216
217
218

219
220
221
222
223
224
225
226
227
228
229
230



231
232
233
234
235
236
237
238
239
240
241
242
243



244
245
246
247
248
249
250
...
252
253
254
255
256
257
258



259
260
261
262
263
264
265
266
267
268
269
270
271



272
273
274
275
276
277
278
279
280
281
282
283



284
285
286
287
288
289
290
291
292
293
294



295
296
297
298
299
300
301
302
303
304
305
306



307
308
309
310
311
312
313
314
315
316
317
318



319
320
321
322
323
324
325
...
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
...
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
...
548
549
550
551
552
553
554



555
556

557
558
559
560
561
562
563
...
624
625
626
627
628
629
630












631
632











633
634
635
636
637
638
639
...
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
...
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
...
922
923
924
925
926
927
928


929
930

931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Text;

/**
 * This class takes any input graphics operations that were performed for it,
 * serializing anything that was sent to it. The serialized graphics can be
 * forwarded somewhere for example for later deserialization.




 *
 * @since 2018/11/19
 */
public abstract class SerializedGraphics
	extends Graphics
{






	/**
	 * This method is called for any operation which serializes to graphics.
	 *
	 * @param __func The graphics operation to perform.
	 * @param __args The input arguments to the function.
	 * @return Any result from the operation.
	 * @since 2018/11/19
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void clipRect(int __x, int __y, int __w, int __h)
	{


















		this.serialize(GraphicsFunction.CLIP_RECT,
			__x, __y, __w, __h);




	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void copyArea(int __sx, int __sy, int __w, int __h,
		int __dx, int __dy, int __anchor)
		throws IllegalArgumentException, IllegalStateException
	{



		this.serialize(GraphicsFunction.COPY_AREA,
			__sx, __sy, __w, __h, __dx, __dy, __anchor);


	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawArc(int __x, int __y, int __w, int __h, int __sa,
		int __aa)
	{



		this.serialize(GraphicsFunction.DRAW_ARC,
			__x, __y, __w, __h, __sa, __aa);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawARGB16(short[] __data, int __off, int __scanlen,
		int __x, int __y, int __w, int __h)
		throws NullPointerException
	{



		this.serialize(GraphicsFunction.DRAW_ARGB16,
			__data, __off, __scanlen, __x, __y, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawChar(char __s, int __x, int __y, int __anchor)
	{



		this.serialize(GraphicsFunction.DRAW_CHAR,
			(int)__s, __x, __y, __anchor);

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawChars(char[] __s, int __o, int __l, int __x,
		int __y, int __anchor)
		throws NullPointerException
	{



		this.serialize(GraphicsFunction.DRAW_CHARS,
			__s, __o, __l, __x, __y, __anchor);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawLine(int __x1, int __y1, int __x2, int __y2)
	{



		this.serialize(GraphicsFunction.DRAW_LINE,
			__x1, __y1, __x2, __y2);

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRGB(int[] __data, int __off, int __scanlen,
		int __x, int __y, int __w, int __h, boolean __alpha)
		throws NullPointerException
	{



		this.serialize(GraphicsFunction.DRAW_RGB,

			__data, __off, __scanlen, __x, __y, __w, __h, (__alpha ? 1 : 0));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRGB16(short[] __data, int __off, int __scanlen,
		int __x, int __y, int __w, int __h)
		throws NullPointerException
	{



		this.serialize(GraphicsFunction.DRAW_RGB16,
			__data, __off, __scanlen, __x, __y, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRect(int __x, int __y, int __w, int __h)
	{



		this.serialize(GraphicsFunction.DRAW_RECT,
			__x, __y, __w, __h);

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	public void drawRegion(Image __src, int __xsrc, int __ysrc,
		int __wsrc, int __hsrc, int __trans, int __xdest, int __ydest,
		int __anch, int __wdest, int __hdest)
		throws IllegalArgumentException, NullPointerException
	{
		if (__src == null)
			throw new NullPointerException("NARG");



		
		// Extract image pixel data before sending over
		int numpixels = __wsrc * __hsrc;
		int[] data = new int[numpixels];
		__src.getRGB(data, 0, __wsrc, __xsrc, __ysrc, __wsrc, __hsrc);
		
		// {@squirreljme.error EB0l Illegal region draw.}
		int rv = (Integer)this.serialize(GraphicsFunction.DRAW_REGION,
			data, __xsrc, __ysrc, __wsrc, __hsrc, __trans, __xdest, __ydest,
			__anch, __wdest, __hdest);

		if (rv < 0)
			throw new IllegalArgumentException("EB0l");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRoundRect(int __x, int __y, int __w, int __h,
		int __aw, int __ah)
	{



		this.serialize(GraphicsFunction.DRAW_ROUND_RECT,
			__x, __y, __w, __h, __aw, __ah);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawString(String __s, int __x, int __y,
		int __anchor)
		throws NullPointerException
	{



		// Just pass the chars of the string since we cannot represent
		// string at all
		this.serialize(GraphicsFunction.DRAW_SUB_CHARS,
			__s.toCharArray(), 0, __s.length(), __x, __y, __anchor);
	}
	
	/**
................................................................................
	 * @since 2018/11/19
	 */
	@Override
	public void drawSubstring(String __s, int __o, int __l, int __x,
		int __y, int __anchor)
		throws NullPointerException, StringIndexOutOfBoundsException
	{



		// Just pass the chars of the string since we cannot represent
		// string at all
		this.serialize(GraphicsFunction.DRAW_SUB_CHARS,
			__s.toCharArray(), __o, __l, __x, __y, __anchor);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawText(Text __t, int __x, int __y)
	{



		this.serialize(GraphicsFunction.DRAW_TEXT,
			SerializedGraphics.textSerialize(__t), __x, __y);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillArc(int __x, int __y, int __w, int __h, int __sa,
		int __aa)
	{



		this.serialize(GraphicsFunction.FILL_ARC,
			__x, __y, __w, __h, __sa, __aa);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillRect(int __x, int __y, int __w, int __h)
	{



		this.serialize(GraphicsFunction.FILL_RECT,
			__x, __y, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillRoundRect(int __x, int __y, int __w, int __h,
		int __aw, int __ah)
	{



		this.serialize(GraphicsFunction.FILL_ROUND_RECT,
			__x, __y, __w, __h, __aw, __ah);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillTriangle(int __x1, int __y1, int __x2, int __y2,
		int __x3, int __y3)
	{



		this.serialize(GraphicsFunction.FILL_TRIANGLE,
			__x1, __y1, __x2, __y2, __x3, __y3);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getClipX()
	{
		return (Integer)this.serialize(GraphicsFunction.GET_CLIP_X);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getClipY()
	{
		return (Integer)this.serialize(GraphicsFunction.GET_CLIP_Y);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getTranslateX()
	{
		return (Integer)this.serialize(GraphicsFunction.GET_TRANSLATE_X);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getTranslateY()
	{
		return (Integer)this.serialize(GraphicsFunction.GET_TRANSLATE_Y);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void setClip(int __x, int __y, int __w, int __h)
	{



		this.serialize(GraphicsFunction.SET_CLIP,
			__x, __y, __w, __h);

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void translate(int __x, int __y)
	{












		this.serialize(GraphicsFunction.TRANSLATE,
			__x, __y);











	}
	
	/**
	 * Deserializes the input operation arguments and performs the call on
	 * the destination graphics.
	 *
	 * @param __g The destination graphics object.
................................................................................
	{
		if (__g == null || __func == null)
			throw new NullPointerException("NARG");
		
		// Depends on the function
		switch (__func)
		{
			case CLIP_RECT:
				__g.clipRect(
					(Integer)__args[0],
					(Integer)__args[1],
					(Integer)__args[2],
					(Integer)__args[3]);
				return null;
			
			case SET_COLOR:
				__g.setColor(
					(Integer)__args[0]);
				return null;
			
			case DRAW_LINE:
				__g.drawLine(
................................................................................
			
			case GET_CLIP_WIDTH:
				return __g.getClipWidth();
			
			case GET_CLIP_HEIGHT:
				return __g.getClipHeight();
			
			case GET_TRANSLATE_X:
				return __g.getTranslateX();
			
			case GET_TRANSLATE_Y:
				return __g.getTranslateY();
			
			case TRANSLATE:
				__g.translate(
					(Integer)__args[0],
					(Integer)__args[1]);
				return null;
			
			case SET_CLIP:
				__g.setClip(
					(Integer)__args[0],
					(Integer)__args[1],
					(Integer)__args[2],
					(Integer)__args[3]);
				return null;
................................................................................
				}
				return 0;
			
				// Draw region
			case DRAW_REGION:
				try
				{


					int sw = (Integer)__args[3],
						sh = (Integer)__args[4];

					
					// Note that the passed buffer only contains image data
					// from the source region, as such the source coordinates
					// will always be zero
					__g.drawRegion(Image.createRGBImage(
							(int[])__args[0], sw, sh, true),
						0, 0,
						sw, sh,
						(Integer)__args[5],
						(Integer)__args[6],
						(Integer)__args[7],
						(Integer)__args[8],
						(Integer)__args[9],
						(Integer)__args[10]);
				}
				catch (IllegalArgumentException e)
				{
					return -1;
				}
				return 0;
			







>
>
>
>






>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
>











>
>
>

<
>
>










>
>
>

|











>
>
>

|









>
>
>

<
>











>
>
>

|







 







>
>
>

<
>











>
>
>

>
|











>
>
>

|









>
>
>

<
>







 







>
>
>








|
|
>












>
>
>

|











>
>
>







 







>
>
>













>
>
>












>
>
>











>
>
>












>
>
>












>
>
>







 







|









|







 







|









|







 







>
>
>

<
>







 







>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
|
|
>








|
|
|
|
|
<







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
...
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236

237
238
239
240
241
242
243
244
...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
...
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
...
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
...
636
637
638
639
640
641
642
643
644
645
646

647
648
649
650
651
652
653
654
...
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734

735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
...
762
763
764
765
766
767
768








769
770
771
772
773
774
775
...
787
788
789
790
791
792
793












794
795
796
797
798
799
800
....
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039

1040
1041
1042
1043
1044
1045
1046
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Text;

/**
 * This class takes any input graphics operations that were performed for it,
 * serializing anything that was sent to it. The serialized graphics can be
 * forwarded somewhere for example for later deserialization.
 *
 * Translation is performed locally to the graphics and wherever the graphics
 * target is, it will not have translation forwarded and serialized to simplify
 * the target.
 *
 * @since 2018/11/19
 */
public abstract class SerializedGraphics
	extends Graphics
{
	/** X translation. */
	protected int transx;
	
	/** Y translation. */
	protected int transy;

	/**
	 * This method is called for any operation which serializes to graphics.
	 *
	 * @param __func The graphics operation to perform.
	 * @param __args The input arguments to the function.
	 * @return Any result from the operation.
	 * @since 2018/11/19
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void clipRect(int __x, int __y, int __w, int __h)
	{
		int transx = this.transx,
			transy = this.transy;
		
		// Calculate the actual desired clip location
		int nx = __x + transx,
			ny = __y + transy,
			na = nx + __w,
			nb = ny + __h;
		
		// Get the current clip location
		int cx = this.__getClipX(),
			cy = this.__getClipY(),
			ca = cx + this.getClipWidth(),
			cb = cy + this.getClipHeight();
		
		// Use direct set clip but with the correct coordinates
		int bx = (nx > cx ? nx : cx),
			by = (ny > cy ? ny : cy);
		this.serialize(GraphicsFunction.SET_CLIP,

			bx,
			by,
			(na < ca ? na : ca) - bx,
			(nb < cb ? nb : cb) - by);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void copyArea(int __sx, int __sy, int __w, int __h,
		int __dx, int __dy, int __anchor)
		throws IllegalArgumentException, IllegalStateException
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.COPY_AREA,

			__sx + transx, __sy + transy, __w, __h,
			__dx + transx, __dy + transy, __anchor);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawArc(int __x, int __y, int __w, int __h, int __sa,
		int __aa)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_ARC,
			__x + transx, __y + transy, __w, __h, __sa, __aa);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawARGB16(short[] __data, int __off, int __scanlen,
		int __x, int __y, int __w, int __h)
		throws NullPointerException
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_ARGB16,
			__data, __off, __scanlen, __x + transx, __y + transy, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawChar(char __s, int __x, int __y, int __anchor)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_CHAR,

			(int)__s, __x + transx, __y + transy, __anchor);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawChars(char[] __s, int __o, int __l, int __x,
		int __y, int __anchor)
		throws NullPointerException
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_CHARS,
			__s, __o, __l, __x + transx, __y + transy, __anchor);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawLine(int __x1, int __y1, int __x2, int __y2)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_LINE,

			__x1 + transx, __y1 + transy, __x2 + transx, __y2 + transy);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRGB(int[] __data, int __off, int __scanlen,
		int __x, int __y, int __w, int __h, boolean __alpha)
		throws NullPointerException
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_RGB,
			__data, __off, __scanlen, __x + transx, __y + transy,
			__w, __h, (__alpha ? 1 : 0));
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRGB16(short[] __data, int __off, int __scanlen,
		int __x, int __y, int __w, int __h)
		throws NullPointerException
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_RGB16,
			__data, __off, __scanlen, __x + transx, __y + transy, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRect(int __x, int __y, int __w, int __h)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_RECT,

			__x + transx, __y + transy, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	public void drawRegion(Image __src, int __xsrc, int __ysrc,
		int __wsrc, int __hsrc, int __trans, int __xdest, int __ydest,
		int __anch, int __wdest, int __hdest)
		throws IllegalArgumentException, NullPointerException
	{
		if (__src == null)
			throw new NullPointerException("NARG");
			
		int transx = this.transx,
			transy = this.transy;
		
		// Extract image pixel data before sending over
		int numpixels = __wsrc * __hsrc;
		int[] data = new int[numpixels];
		__src.getRGB(data, 0, __wsrc, __xsrc, __ysrc, __wsrc, __hsrc);
		
		// {@squirreljme.error EB0l Illegal region draw.}
		int rv = (Integer)this.serialize(GraphicsFunction.DRAW_REGION,
			data, (__wsrc << 16) | __hsrc, __trans,
			__xdest + transx, __ydest + transy,
			__anch, (__wdest << 16) | __hdest);
		if (rv < 0)
			throw new IllegalArgumentException("EB0l");
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawRoundRect(int __x, int __y, int __w, int __h,
		int __aw, int __ah)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_ROUND_RECT,
			__x + transx, __y + transy, __w, __h, __aw, __ah);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawString(String __s, int __x, int __y,
		int __anchor)
		throws NullPointerException
	{
		int transx = this.transx,
			transy = this.transy;
		
		// Just pass the chars of the string since we cannot represent
		// string at all
		this.serialize(GraphicsFunction.DRAW_SUB_CHARS,
			__s.toCharArray(), 0, __s.length(), __x, __y, __anchor);
	}
	
	/**
................................................................................
	 * @since 2018/11/19
	 */
	@Override
	public void drawSubstring(String __s, int __o, int __l, int __x,
		int __y, int __anchor)
		throws NullPointerException, StringIndexOutOfBoundsException
	{
		int transx = this.transx,
			transy = this.transy;
		
		// Just pass the chars of the string since we cannot represent
		// string at all
		this.serialize(GraphicsFunction.DRAW_SUB_CHARS,
			__s.toCharArray(), __o, __l, __x, __y, __anchor);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void drawText(Text __t, int __x, int __y)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.DRAW_TEXT,
			SerializedGraphics.textSerialize(__t), __x, __y);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillArc(int __x, int __y, int __w, int __h, int __sa,
		int __aa)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.FILL_ARC,
			__x, __y, __w, __h, __sa, __aa);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillRect(int __x, int __y, int __w, int __h)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.FILL_RECT,
			__x, __y, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillRoundRect(int __x, int __y, int __w, int __h,
		int __aw, int __ah)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.FILL_ROUND_RECT,
			__x, __y, __w, __h, __aw, __ah);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void fillTriangle(int __x1, int __y1, int __x2, int __y2,
		int __x3, int __y3)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.FILL_TRIANGLE,
			__x1, __y1, __x2, __y2, __x3, __y3);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getClipX()
	{
		return this.__getClipX() - this.transx;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getClipY()
	{
		return this.__getClipY() - this.transy;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getTranslateX()
	{
		return this.transx;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public int getTranslateY()
	{
		return this.transy;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void setClip(int __x, int __y, int __w, int __h)
	{
		int transx = this.transx,
			transy = this.transy;
		
		this.serialize(GraphicsFunction.SET_CLIP,

			__x + transx, __y + transy, __w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
................................................................................
	/**
	 * {@inheritDoc}
	 * @since 2018/11/19
	 */
	@Override
	public void translate(int __x, int __y)
	{
		this.transx += __x;
		this.transy += __y;
	}
	
	/**
	 * Returns the raw clipping X of the target.
	 *
	 * @return The target clipping.
	 * @since 2020/01/10
	 */
	private final int __getClipX()
	{
		return (Integer)this.serialize(GraphicsFunction.GET_CLIP_X);

	}
	
	/**
	 * Returns the raw clipping Y of the target.
	 *
	 * @return The target clipping.
	 * @since 2020/01/10
	 */
	private final int __getClipY()
	{
		return (Integer)this.serialize(GraphicsFunction.GET_CLIP_Y);
	}
	
	/**
	 * Deserializes the input operation arguments and performs the call on
	 * the destination graphics.
	 *
	 * @param __g The destination graphics object.
................................................................................
	{
		if (__g == null || __func == null)
			throw new NullPointerException("NARG");
		
		// Depends on the function
		switch (__func)
		{








			case SET_COLOR:
				__g.setColor(
					(Integer)__args[0]);
				return null;
			
			case DRAW_LINE:
				__g.drawLine(
................................................................................
			
			case GET_CLIP_WIDTH:
				return __g.getClipWidth();
			
			case GET_CLIP_HEIGHT:
				return __g.getClipHeight();
			












			case SET_CLIP:
				__g.setClip(
					(Integer)__args[0],
					(Integer)__args[1],
					(Integer)__args[2],
					(Integer)__args[3]);
				return null;
................................................................................
				}
				return 0;
			
				// Draw region
			case DRAW_REGION:
				try
				{
					// Extract width/heights since they are combined here
					int sw = ((Integer)__args[1]) >>> 16,
						sh = ((Integer)__args[1]) & 0xFFFF,
						dw = ((Integer)__args[6]) >>> 16,
						dh = ((Integer)__args[6]) & 0xFFFF;
					
					// Note that the passed buffer only contains image data
					// from the source region, as such the source coordinates
					// will always be zero
					__g.drawRegion(Image.createRGBImage(
							(int[])__args[0], sw, sh, true),
						0, 0,
						sw, sh,
						(Integer)__args[2],
						(Integer)__args[3],
						(Integer)__args[4],
						(Integer)__args[5],
						dw, dh);

				}
				catch (IllegalArgumentException e)
				{
					return -1;
				}
				return 0;
			

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/NativeUIBackend.java.

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		
		// If acceleration is enabled, try to get accelerated graphics
		int nid = this.nid;
		if (USE_ACCELERATION)
			try
			{
				// Try to get it
				Graphics rv = AcceleratedGraphics.instance(nid);
				
				// Set acceleration flag
				if (__a != null && __a.length > 1)
					__a[0] = true;
				
				return rv;
			}







|







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		
		// If acceleration is enabled, try to get accelerated graphics
		int nid = this.nid;
		if (USE_ACCELERATION)
			try
			{
				// Try to get it
				Graphics rv = AcceleratedGraphics.instance();
				
				// Set acceleration flag
				if (__a != null && __a.length > 1)
					__a[0] = true;
				
				return rv;
			}

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/vfb/VirtualFramebuffer.java.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238












239
240
241
242
243
244
245
246
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.vfb;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.FramebufferProperty;
import cc.squirreljme.jvm.IPCCallback;

/**
 * This is a virtual framebuffer which may be used by non-SquirrelJME JVMs and
 * by higher level JVMs to allow for IPC based graphics to be used.
 *
 * @since 2019/12/28
................................................................................
		this.height = __h;
		
		// Initialize raw pixel data
		this.pixels = new int[__w * __h];
	}
	
	/**
	 * Executes the framebuffer property system call.
	 *
	 * @param __args The call arguments.
	 * @return The result of the property.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/28
	 */
	public final long framebufferProperty(int... __args)
		throws NullPointerException
	{
		if (__args == null)
			throw new NullPointerException("NARG");
		
		// Depends on the length
		switch (__args.length)
		{
				// Nothing to do?
			case 0:
				return 0;
			
			case 1:
				return this.framebufferProperty(
					__args[0],
					0, 0, 0, 0, 0, 0, 0, 0);
			
			case 2:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					0, 0, 0, 0, 0, 0, 0);
			
			case 3:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					__args[2],
					0, 0, 0, 0, 0, 0);
			
			case 4:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					0, 0, 0, 0);
			
			case 5:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					0, 0, 0);
			
			case 6:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					__args[5],
					0, 0);
			
			case 7:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					__args[5],
					__args[6],
					0);
			
			case 8:
				return this.framebufferProperty(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					__args[5],
					__args[6],
................................................................................
			
			default:
				return 0;
		}
	}
	
	/**
	 * Executes the framebuffer property system call.
	 *
	 * @param __pid The property ID.
	 * @param __args The call arguments.
	 * @return The result of the property.
	 * @since 2019/12/28
	 */
	public final long framebufferProperty(int __pid, int __a, int __b, int __c,
		int __d, int __e, int __g, int __h)
	{
		// Depends on the property
		switch (__pid)
		{
				// Raw address (since it is simulated, this is not set)
			case FramebufferProperty.ADDRESS:
				return 0;
				
				// Width and scanline length
			case FramebufferProperty.WIDTH:
			case FramebufferProperty.SCANLEN:
				return this.width;
				
				// Height
			case FramebufferProperty.HEIGHT:
				return this.height;
			
				// Flushes the display
			case FramebufferProperty.FLUSH:
				throw new todo.TODO();
				
				// Pixel format is always integer
			case FramebufferProperty.FORMAT:
				return FramebufferProperty.FORMAT_INTEGER_RGB888;
				
				// Scan line length in bytes
			case FramebufferProperty.SCANLEN_BYTES:
				return this.width * 4;
				
				// The number of bytes per pixel
			case FramebufferProperty.BYTES_PER_PIXEL:
				return 4;
				
				// Bits per pixel
			case FramebufferProperty.BITS_PER_PIXEL:
				return 32;
				
				// The number of pixels
			case FramebufferProperty.NUM_PIXELS:
				return this.width * this.height;
				
				// Backlight not supported
			case FramebufferProperty.BACKLIGHT_LEVEL_GET:
			case FramebufferProperty.BACKLIGHT_LEVEL_SET:
			case FramebufferProperty.BACKLIGHT_LEVEL_MAX:
				return 0;
				
				// Upload integer array
			case FramebufferProperty.UPLOAD_ARRAY_INT:
				throw new todo.TODO();
				
				// The backing array object
			case FramebufferProperty.BACKING_ARRAY_OBJECT:
				return Assembly.objectToPointer(this.pixels);












				
				// Unknown
			default:
				return 0;
		}
	}
}








|







 







|






|













|




|





|






|







|








|









|










|







 







|






|






|



|
|



|



|



|
|


|



|



|



|



|
|
|



|



|

>
>
>
>
>
>
>
>
>
>
>
>








6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.vfb;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.IPCCallback;

/**
 * This is a virtual framebuffer which may be used by non-SquirrelJME JVMs and
 * by higher level JVMs to allow for IPC based graphics to be used.
 *
 * @since 2019/12/28
................................................................................
		this.height = __h;
		
		// Initialize raw pixel data
		this.pixels = new int[__w * __h];
	}
	
	/**
	 * Executes the framebuffer control system call.
	 *
	 * @param __args The call arguments.
	 * @return The result of the property.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/28
	 */
	public final long framebufferControl(int... __args)
		throws NullPointerException
	{
		if (__args == null)
			throw new NullPointerException("NARG");
		
		// Depends on the length
		switch (__args.length)
		{
				// Nothing to do?
			case 0:
				return 0;
			
			case 1:
				return this.framebufferControl(
					__args[0],
					0, 0, 0, 0, 0, 0, 0, 0);
			
			case 2:
				return this.framebufferControl(
					__args[0],
					__args[1],
					0, 0, 0, 0, 0, 0, 0);
			
			case 3:
				return this.framebufferControl(
					__args[0],
					__args[1],
					__args[2],
					0, 0, 0, 0, 0, 0);
			
			case 4:
				return this.framebufferControl(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					0, 0, 0, 0);
			
			case 5:
				return this.framebufferControl(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					0, 0, 0);
			
			case 6:
				return this.framebufferControl(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					__args[5],
					0, 0);
			
			case 7:
				return this.framebufferControl(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					__args[5],
					__args[6],
					0);
			
			case 8:
				return this.framebufferControl(
					__args[0],
					__args[1],
					__args[2],
					__args[3],
					__args[4],
					__args[5],
					__args[6],
................................................................................
			
			default:
				return 0;
		}
	}
	
	/**
	 * Executes the framebuffer control system call.
	 *
	 * @param __pid The property ID.
	 * @param __args The call arguments.
	 * @return The result of the property.
	 * @since 2019/12/28
	 */
	public final long framebufferControl(int __pid, int __a, int __b, int __c,
		int __d, int __e, int __g, int __h)
	{
		// Depends on the property
		switch (__pid)
		{
				// Raw address (since it is simulated, this is not set)
			case Framebuffer.CONTROL_ADDRESS:
				return 0;
				
				// Width and scanline length
			case Framebuffer.CONTROL_WIDTH:
			case Framebuffer.CONTROL_SCANLEN:
				return this.width;
				
				// Height
			case Framebuffer.CONTROL_HEIGHT:
				return this.height;
			
				// Flushes the display
			case Framebuffer.CONTROL_FLUSH:
				throw new todo.TODO();
				
				// Pixel format is always integer
			case Framebuffer.CONTROL_FORMAT:
				return Framebuffer.FORMAT_INTEGER_RGB888;
				
				// Scan line length in bytes
			case Framebuffer.CONTROL_SCANLEN_BYTES:
				return this.width * 4;
				
				// The number of bytes per pixel
			case Framebuffer.CONTROL_BYTES_PER_PIXEL:
				return 4;
				
				// Bits per pixel
			case Framebuffer.CONTROL_BITS_PER_PIXEL:
				return 32;
				
				// The number of pixels
			case Framebuffer.CONTROL_NUM_PIXELS:
				return this.width * this.height;
				
				// Backlight not supported
			case Framebuffer.CONTROL_BACKLIGHT_LEVEL_GET:
			case Framebuffer.CONTROL_BACKLIGHT_LEVEL_SET:
			case Framebuffer.CONTROL_BACKLIGHT_LEVEL_MAX:
				return 0;
				
				// Upload integer array
			case Framebuffer.CONTROL_UPLOAD_ARRAY_INT:
				throw new todo.TODO();
				
				// The backing array object
			case Framebuffer.CONTROL_BACKING_ARRAY_OBJECT:
				return Assembly.objectToPointer(this.pixels);
				
				// Returns the capabilities of the display.
			case Framebuffer.CONTROL_GET_CAPABILITIES:
				throw new todo.TODO();
			
				// Query acceleration function.
			case Framebuffer.CONTROL_ACCEL_FUNC_QUERY:
				throw new todo.TODO();
			
				// Perform acceleration function.
			case Framebuffer.CONTROL_ACCEL_FUNC_INVOKE:
				throw new todo.TODO();
				
				// Unknown
			default:
				return 0;
		}
	}
}

Changes to runt/apis/midp-lcdui/com/nokia/mid/ui/DeviceControl.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.nokia.mid.ui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.FramebufferProperty;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is used to utilize special hardware that exists on the device for
 * user feedback.
 *
................................................................................
		if (__lvl < 0 || __lvl > 100)
			throw new IllegalArgumentException("EB32 " + __lvl);
		
		// Get maximum backlight level, stop if it is zero which means the
		// property is not supported or there is no backlight that can be
		// controlled
		int max = Assembly.sysCallV(SystemCallIndex.FRAMEBUFFER,
			FramebufferProperty.BACKLIGHT_LEVEL_MAX);
		if (max == 0)
			return;
		
		// Set the desired level as a percentage of the max
		int val = (max * __lvl) / 100;
		Assembly.sysCall(SystemCallIndex.FRAMEBUFFER,
			FramebufferProperty.BACKLIGHT_LEVEL_SET,
			(val < 0 ? 0 : (val > max ? max : val)));
	}
	
	/**
	 * Starts vibrating at the given frequency for the given duration.
	 *
	 * @param __freq The frequency of the vibration, must be in the range of







|







 







|






|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.nokia.mid.ui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is used to utilize special hardware that exists on the device for
 * user feedback.
 *
................................................................................
		if (__lvl < 0 || __lvl > 100)
			throw new IllegalArgumentException("EB32 " + __lvl);
		
		// Get maximum backlight level, stop if it is zero which means the
		// property is not supported or there is no backlight that can be
		// controlled
		int max = Assembly.sysCallV(SystemCallIndex.FRAMEBUFFER,
			Framebuffer.CONTROL_BACKLIGHT_LEVEL_MAX);
		if (max == 0)
			return;
		
		// Set the desired level as a percentage of the max
		int val = (max * __lvl) / 100;
		Assembly.sysCall(SystemCallIndex.FRAMEBUFFER,
			Framebuffer.CONTROL_BACKLIGHT_LEVEL_SET,
			(val < 0 ? 0 : (val > max ? max : val)));
	}
	
	/**
	 * Starts vibrating at the given frequency for the given duration.
	 *
	 * @param __freq The frequency of the vibration, must be in the range of

Changes to runt/apis/midp-lcdui/javax/microedition/lcdui/Display.java.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
....
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.FramebufferProperty;
import cc.squirreljme.jvm.IPCManager;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.CommonMetrics;
import cc.squirreljme.runtime.lcdui.DisplayOrientation;
import cc.squirreljme.runtime.lcdui.DisplayState;
................................................................................
		
		// Map all display IDs to actual displays
		Map<Integer, Display> displays = Display._DISPLAYS;
		synchronized (displays)
		{
			// Try to obtain the address of the framebuffer
			int fbaddr = Assembly.sysCallV(SystemCallIndex.FRAMEBUFFER,
				FramebufferProperty.ADDRESS);
			int fbaobj = Assembly.sysCallV(SystemCallIndex.FRAMEBUFFER,
				FramebufferProperty.BACKING_ARRAY_OBJECT);
			
			// There is only a single display if a framebuffer is supported
			// It could be mapped to an object or otherwise raw memory
			int numdisplays = (fbaddr != 0 || fbaobj != 0 ? 1 : 0);
			for (int i = 0; i < numdisplays; i++)
				rv.add(Display.__mapDisplay(i));
		}
................................................................................
				
				// Cache display zero?
				if (__did == 0)
				{
					_DISPLAY_ZERO = rv;
				
					// Register callback handler for IPC events
					IPCManager.register(FramebufferProperty.IPC_ID,
						__GfxIPCDispatch__.__instance());
				}
			}
			
			return rv;
		}
	}
}








|







 







|

|







 







|









8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
....
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package javax.microedition.lcdui;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.IPCManager;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.common.CommonMetrics;
import cc.squirreljme.runtime.lcdui.DisplayOrientation;
import cc.squirreljme.runtime.lcdui.DisplayState;
................................................................................
		
		// Map all display IDs to actual displays
		Map<Integer, Display> displays = Display._DISPLAYS;
		synchronized (displays)
		{
			// Try to obtain the address of the framebuffer
			int fbaddr = Assembly.sysCallV(SystemCallIndex.FRAMEBUFFER,
				Framebuffer.CONTROL_ADDRESS);
			int fbaobj = Assembly.sysCallV(SystemCallIndex.FRAMEBUFFER,
				Framebuffer.CONTROL_BACKING_ARRAY_OBJECT);
			
			// There is only a single display if a framebuffer is supported
			// It could be mapped to an object or otherwise raw memory
			int numdisplays = (fbaddr != 0 || fbaobj != 0 ? 1 : 0);
			for (int i = 0; i < numdisplays; i++)
				rv.add(Display.__mapDisplay(i));
		}
................................................................................
				
				// Cache display zero?
				if (__did == 0)
				{
					_DISPLAY_ZERO = rv;
				
					// Register callback handler for IPC events
					IPCManager.register(Framebuffer.IPC_ID,
						__GfxIPCDispatch__.__instance());
				}
			}
			
			return rv;
		}
	}
}

Name change from runt/klib/supervisor/cc/squirreljme/jvm/FramebufferProperty.java to runt/klib/supervisor/cc/squirreljme/jvm/Framebuffer.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139





140
141
142


























143
144
145
146
147
148
149
...
159
160
161
162
163
164
165
166












































































































































167
168
169
170
171
package cc.squirreljme.jvm;

/**
 * This is used to get/set the property of the framebuffer.
 *
 * @since 2019/06/20
 */
public interface FramebufferProperty
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @return The framebuffer address.
	 */
	public static final byte ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @return The framebuffer width.
	 */
	public static final byte WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @return The framebuffer height.
	 */
	public static final byte HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @return The framebuffer scanline length.
	 */
	public static final byte SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	public static final byte FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @return The pixel format of the screen.
	 */
	public static final byte FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @return The scanline length in bytes.
	 */
	public static final byte SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @return The bytes per pixel.
	 */
	public static final byte BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @return The number of pixels.
	 */
	public static final byte NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @return The bits per pixel.
	 */
	public static final byte BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @return The current backlight level.
	 */
	public static final byte BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @param 1 The level to set.
	 */
	public static final byte BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @return The maximum backlight level.
	 */
	public static final byte BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @param 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	public static final byte UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @return The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	public static final byte BACKING_ARRAY_OBJECT =
		15;
	
	/** The number of framebuffer properties. */





	public static final byte NUM_PROPERTIES =
		16;
	


























	/** Screen is RGB 32-bit. */
	public static final byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	public static final byte FORMAT_BYTE_INDEXED =
		1;
................................................................................
	/** Screen is packed 2 bit values. */
	public static final byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	public static final byte FORMAT_PACKED_FOUR =
		5;
	












































































































































	/** The IPC ID for the graphics callbacks. */
	public static final int IPC_ID =
		0x47665821;
}








|






|







|







|







|





|







|







|







|







|







|







|







|







|








|








|

|
|
>
>
>
>
>
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
package cc.squirreljme.jvm;

/**
 * This is used to get/set the property of the framebuffer.
 *
 * @since 2019/06/20
 */
public interface Framebuffer
{
	/**
	 * Returns the address of the framebuffer.
	 *
	 * @return The framebuffer address.
	 */
	public static final byte CONTROL_ADDRESS =
		1;
	
	/**
	 * Returns the width of the framebuffer.
	 *
	 * @return The framebuffer width.
	 */
	public static final byte CONTROL_WIDTH =
		2;
	
	/**
	 * Returns the height of the framebuffer.
	 *
	 * @return The framebuffer height.
	 */
	public static final byte CONTROL_HEIGHT =
		3;
	
	/**
	 * Returns the scanline length.
	 *
	 * @return The framebuffer scanline length.
	 */
	public static final byte CONTROL_SCANLEN =
		4;
	
	/**
	 * Flush the display because it has been drawn.
	 */
	public static final byte CONTROL_FLUSH =
		5;
	
	/**
	 * Returns the pixel format of the screen.
	 *
	 * @return The pixel format of the screen.
	 */
	public static final byte CONTROL_FORMAT =
		6;
	
	/**
	 * Returns the scanline length in bytes.
	 *
	 * @return The scanline length in bytes.
	 */
	public static final byte CONTROL_SCANLEN_BYTES =
		7;
	
	/**
	 * Returns the number of bytes per pixel.
	 *
	 * @return The bytes per pixel.
	 */
	public static final byte CONTROL_BYTES_PER_PIXEL =
		8;
	
	/**
	 * Returns the number of available pixels.
	 *
	 * @return The number of pixels.
	 */
	public static final byte CONTROL_NUM_PIXELS =
		9;
	
	/**
	 * Bits per pixel.
	 *
	 * @return The bits per pixel.
	 */
	public static final byte CONTROL_BITS_PER_PIXEL =
		10;
	
	/**
	 * Get backlight level.
	 *
	 * @return The current backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_GET =
		11;
	
	/**
	 * Set backlight level.
	 *
	 * @param 1 The level to set.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_SET =
		12;
	
	/**
	 * Maximum backlight level.
	 *
	 * @return The maximum backlight level.
	 */
	public static final byte CONTROL_BACKLIGHT_LEVEL_MAX =
		13;
	
	/**
	 * Uploads an integer array of pixel data to the framebuffer.
	 *
	 * @param 1 The address of the array to upload.
	 * @since 2019/12/21
	 */
	public static final byte CONTROL_UPLOAD_ARRAY_INT =
		14;
	
	/**
	 * The array which backs the framebuffer, if there is one.
	 *
	 * @return The backing array object, if there is one.
	 * @since 2019/12/28
	 */
	public static final byte CONTROL_BACKING_ARRAY_OBJECT =
		15;
		
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_GET_CAPABILITIES =
		16;
	
	/**
	 * Query acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @return A non-zero value if this is supported.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_QUERY =
		17;
	
	/**
	 * Perform acceleration function.
	 *
	 * @param 1 The graphics function.
	 * @param ... Parameters to the function.
	 * @return A value that is according to the invoked function, if it is
	 * supported or possible.
	 * @since 2020/01/10
	 */
	public static final byte CONTROL_ACCEL_FUNC_INVOKE =
		18;
	
	/** The number of framebuffer controls. */
	public static final byte NUM_CONTROLS =
		19;
	
	/** Screen is RGB 32-bit. */
	public static final byte FORMAT_INTEGER_RGB888 =
		0;
	
	/** Screen is 8-bit indexed. */
	public static final byte FORMAT_BYTE_INDEXED =
		1;
................................................................................
	/** Screen is packed 2 bit values. */
	public static final byte FORMAT_PACKED_TWO =
		4;
	
	/** Screen is packed 4 bit values. */
	public static final byte FORMAT_PACKED_FOUR =
		5;
	
	/** Has touch-screen. */
	public static final byte CAPABILITY_TOUCH =
		0x01;
	
	/** Has keyboard. */
	public static final byte CAPABILITY_KEYBOARD =
		0x02;
	
	/** Set color. */
	public static final byte ACCEL_FUNC_SET_COLOR =
		0;
	
	/** Draw line. */
	public static final byte ACCEL_FUNC_DRAW_LINE =
		1;
	
	/** Get the X clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_X =
		2;
	
	/** Get the Y clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_Y =
		3;
	
	/** Get the width clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_WIDTH =
		4;
	
	/** Get the height clip. */
	public static final byte ACCEL_FUNC_GET_CLIP_HEIGHT =
		5;
	
	/** Set the clip. */
	public static final byte ACCEL_FUNC_SET_CLIP =
		6;
	
	/** Draw rectangle. */
	public static final byte ACCEL_FUNC_DRAW_RECT =
		7;
	
	/** Get the alpha color. */
	public static final byte ACCEL_FUNC_GET_ALPHA_COLOR =
		8;
	
	/** Set the alpha color. */
	public static final byte ACCEL_FUNC_SET_ALPHA_COLOR =
		9;
	
	/** Fill rectangle. */
	public static final byte ACCEL_FUNC_FILL_RECT =
		10;
	
	/** Sets the fonts for the graphics. */
	public static final byte ACCEL_FUNC_SET_FONT =
		11;
	
	/** Gets the font to use for drawing. */
	public static final byte ACCEL_FUNC_GET_FONT =
		12;
	
	/** Draw sub-characters. */
	public static final byte ACCEL_FUNC_DRAW_SUB_CHARS =
		13;
	
	/** Draw text. */
	public static final byte ACCEL_FUNC_DRAW_TEXT =
		14;
	
	/** Get stroke style. */
	public static final byte ACCEL_FUNC_GET_STROKE_STYLE =
		15;
	
	/** Set stroke style. */
	public static final byte ACCEL_FUNC_SET_STROKE_STYLE =
		16;
	
	/** Copy area. */
	public static final byte ACCEL_FUNC_COPY_AREA =
		17;
	
	/** Draw arc. */
	public static final byte ACCEL_FUNC_DRAW_ARC =
		18;
	
	/** Draw ARGB16. */
	public static final byte ACCEL_FUNC_DRAW_ARGB16 =
		19;
	
	/** Draw character. */
	public static final byte ACCEL_FUNC_DRAW_CHAR =
		20;
	
	/** Draw characters. */
	public static final byte ACCEL_FUNC_DRAW_CHARS =
		21;
	
	/** Draw RGB. */
	public static final byte ACCEL_FUNC_DRAW_RGB =
		22;
	
	/** Draw RGB16. */
	public static final byte ACCEL_FUNC_DRAW_RGB16 =
		23;
	
	/** Draw round rectangle. */
	public static final byte ACCEL_FUNC_DRAW_ROUND_RECT =
		24;
	
	/** Fill arc. */
	public static final byte ACCEL_FUNC_FILL_ARC =
		25;
	
	/** Fill round rectangle. */
	public static final byte ACCEL_FUNC_FILL_ROUND_RECT =
		26;
	
	/** Fill triangle. */
	public static final byte ACCEL_FUNC_FILL_TRIANGLE =
		27;
	
	/** Get blending mode. */
	public static final byte ACCEL_FUNC_GET_BLENDING_MODE =
		28;
	
	/** Get display color. */
	public static final byte ACCEL_FUNC_GET_DISPLAY_COLOR =
		29;
	
	/** Set blending mode. */
	public static final byte ACCEL_FUNC_SET_BLENDING_MODE =
		30;
	
	/** Draw region. */
	public static final byte ACCEL_FUNC_DRAW_REGION =
		31;
	
	/** Number of acceleration functions. */
	public static final byte NUM_ACCEL_FUNC =
		32;
	
	/** The IPC ID for the graphics callbacks. */
	public static final int IPC_ID =
		0x47665821;
}

Changes to runt/klib/supervisor/cc/squirreljme/jvm/SystemCallIndex.java.

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * @return Generally zero as no value is intended to be returned.
	 */
	public static final byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link FramebufferProperty}.
	 *
	 * @param 1 The frame buffer property to select.
	 * @param ... Undefined, this depends on the property selected.
	 * @return Whatever value the frame buffer property will return.
	 */
	public static final byte FRAMEBUFFER =
		24;







|







259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	 * @return Generally zero as no value is intended to be returned.
	 */
	public static final byte SUPERVISOR_BOOT_OKAY =
		23;
	
	/**
	 * Get, set, or change a property of the framebuffer, the properties which
	 * are defined are specified in {@link Framebuffer}.
	 *
	 * @param 1 The frame buffer property to select.
	 * @param ... Undefined, this depends on the property selected.
	 * @return Whatever value the frame buffer property will return.
	 */
	public static final byte FRAMEBUFFER =
		24;

Changes to runt/libs/common-vm/cc/squirreljme/vm/VMNativeDisplayAccess.java.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.gfx.AcceleratedGraphics;
import cc.squirreljme.runtime.lcdui.gfx.GraphicsFunction;
import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;
import cc.squirreljme.runtime.lcdui.gfx.SerializedGraphics;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
// ---------------------------------------------------------------------------

package cc.squirreljme.vm;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;

import cc.squirreljme.runtime.lcdui.gfx.GraphicsFunction;
import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;
import cc.squirreljme.runtime.lcdui.gfx.SerializedGraphics;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;