Skip to main content

Graphics Configuration Class

7 replies [Last post]
bddeveloper
Offline
Joined: 2008-01-14
Points: 0

Hello,

I have a couple quick questions related to the Graphics Configuration class.

1. What is the best practice for obtaining this object in BD-J development in standard AWT it can be obtain from an Image, a Container, when i try these methods I get a null pointer exception. I have now tried to use the HScene object like this: scene.getGraphicsConfiguration(); Unfortunately I get the following error after using the create CompatibleImage method on the object.

java.lang.NoSuchMethodError: java.awt.GraphicsConfiguration: method createCompatibleImage(III)Ljava/awt/image/BufferedImage; not found

2. This now brings me to my second question. Is there a good reference book for the AWT 1.3 that is used by BD-J, or any other good book that one would recommend, that dives into the details. (AWT details not BD-J details)

3. Will players render an image that implements java.awt.image.RenderedImage?

Thank you,

Scott

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bjoern_minkmar
Offline
Joined: 2007-06-11
Points: 0

Hi Scott,

1) You've got two options to create an image on the BD-J platform:

a) you obtain the Graphics context from a Component via getGraphicsConfiguration() and then call createCompatibleImage() on that Graphics object, for example
Component.getGraphicsConfiguration().createCompatibleImage() or
b) you use the DVBBufferedImage object from the org.dvb.ui package (MHP/GEM)

a) returns an Image and b) returns a DVBBufferedImage, so it is up to you which one you want/need. Currently i don't see why you would need to have a BufferedImage.

2) There are plenty books out there that deal with AWT, but all the information you need can be found on the web also.

3) No, RenderedImage is not part of PBP 1.0.

Cheers,
Björn

bddeveloper
Offline
Joined: 2008-01-14
Points: 0

Hello Björn,

Thanks for the information. We've been reading the entire spec of the PBP 1.0 before moving ahead on some tests. We'll also check out the DVBBufferedImage class.

Scott

francoislionet
Offline
Joined: 2008-01-13
Points: 0

I do not think you need to use createCompatibleImage : on a BD-J program, all the images are 32 bits RGBA, stored in the pixel memory. Just use TYPE_ARGB when you create your image...

bddeveloper
Offline
Joined: 2008-01-14
Points: 0

Sure, but I do want to create a BufferedImage object and I am looking for a way to do this.

Thank you,

Scott

francoislionet
Offline
Joined: 2008-01-13
Points: 0

Cant you just use :

BufferedImage myImage=new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

This is what I use in my JavaSe games!

bddeveloper
Offline
Joined: 2008-01-14
Points: 0

GREAT!!! I will give it a shot. I also realized I wasn't reading the spec for Personal Profile 1.0, that is a problem I should be doing that!

Thank you.

francoislionet
Offline
Joined: 2008-01-13
Points: 0

Sorry, my mistake. I have just realised today that there is no public constructor for BufferedImage in PBS 1.0 ! You'll have to use createCompatibleImage from GraphicsConfiguration.