Check-in [1bef9840e9]

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

Overview
Comment:Implement part of Nokia DirectUtils.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1bef9840e96097c95ae0a73e682cc0f492b700d5
User & Date: stephanie.gawroriski 2019-10-07 21:18:14
Context
2019-10-07
21:23
Correct NUM_SYSCALLS being wrong after SLEEP was added. check-in: 19a52008a5 user: stephanie.gawroriski tags: trunk
21:18
Implement part of Nokia DirectUtils. check-in: 1bef9840e9 user: stephanie.gawroriski tags: trunk
2019-10-06
21:55
Add branched out printing for object to/from pointer. check-in: 4d4b57a42e user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added runt/apis/midp-lcdui/com/nokia/mid/ui/DirectGraphics.java.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.nokia.mid.ui;

/**
 * This interface provides direct framebuffer pixel access.
 *
 * @since 2019/10/07
 */
public interface DirectGraphics
{
}

Added runt/apis/midp-lcdui/com/nokia/mid/ui/DirectUtils.java.

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
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
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package com.nokia.mid.ui;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This class acts as a placeholder for utility methods.
 *
 * @since 2019/10/07
 */
public class DirectUtils
{
	/**
	 * Creates a mutable image with the given ARGB color for all pixels.
	 *
	 * @param __w The width.
	 * @param __h The height.
	 * @param __argb The ARGB color to do.
	 * @return The created mutable image.
	 * @throws IllegalArgumentException If the width and/or height or negative
	 * or exceed the array bounds.
	 * @since 2019/10/07
	 */
	public static Image createImage(int __w, int __h, int __argb)
		throws IllegalArgumentException
	{
		return Image.createImage(__w, __h, true, __argb);
	}
	
	/**
	 * Loads a mutable image from the specified byte array.
	 *
	 * @param __b The byte data.
	 * @param __o The offset.
	 * @param __l The length.
	 * @return The mutable image.
	 * @throws ArrayIndexOutOfBoundsException If the offset and/or length are
	 * negative or exceed the array bounds.
	 * @throws IllegalArgumentException If the image could not be decoded.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/07
	 */
	public static Image createImage(byte[] __b, int __o, int __l)
	{
		// Load the base image
		Image base = Image.createImage(__b, __o, __l);
		
		// Create blank mutable
		int w, h;
		Image mutable = Image.createImage(
			(w = base.getWidth()), (h = base.getHeight()),
			base.hasAlpha(), 0);
			
		// Setup graphics state, use SRC blending mode since it is just a
		// copy of the alpha channel data!
		Graphics g = mutable.getGraphics();
		g.setBlendingMode(Graphics.SRC);
		
		// Draw image on top
		g.drawRegion(base, 0, 0, w, h, 0, 0, 0, 0);
		
		// Use resulting image
		return mutable;
	}
	
	/**
	 * Returns an interface which wraps the given graphics and provides raw
	 * pixel data access to it.
	 *
	 * @param __g The graphics object to wrap.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/07
	 */
	public static DirectGraphics getDirectGraphics(Graphics __g)
		throws NullPointerException
	{
		if (__g == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}