Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: VolatileBufferedToolkitImage Strategies

Ever wondered what kind of image to use in your application? Or what method to use in creating it? This article attempts to address this challenging topic.

Tutorial Details:

First of all, perhaps a short dictionary of image types might help:

Toolkit Image: This is the oldest kind of image object in the Java API. These images are created and returned by the old 1.x APIs such as Applet.getImage() and Toolkit.createImage(). These images are created from a pointer to a data source, such as a GIF or JPG file, and return an object of type Image. They are useful for convenient loading and storage of image data for display, but getting at the actual pixel data or manipulating it is not as easy.
BufferedImage: This is an image type that was created in the JDK 1.2 API. They were created for easier and more powerful manipulation of the actual pixel data in an image. At first, there was no way to load an image from a data source directly into a BufferedImage; these images were used, instead, to create an arbitrary buffer for pixel data, which you could then write to, read from, or display conveniently. The main way to get actual pixel data into a BufferedImage object at first was through use of rendering operations (after getting a Graphics object for the BufferedImage), or by manually setting the pixel data through methods in BufferedImage, WritableRaster, and DataBuffer. With the advent of the ImageIO API (see below) in JDK 1.4, it became possible to create a BufferedImage object directly from a data source, just like Toolkit images (only these BufferedImage objects are writable, unlike their Toolkit image cousins).
VolatileImage: This image type was created in JDK 1.4 as a means of creating and managing accelerated image memory. One of the problems with hardware acceleration for images is that, on some platforms, accelerated memory can be deleted out from under you at any time. This is obviously not what you want for your typical image data. To work around that, the VolatileImage API was created to provide a notification mechanism so that you know when an image must be re-rendered due to data loss. VolatileImage objects are not loaded from image data, but are just created as empty pixel buffers (much as the initial BufferedImage objects were (see above)); to load image data into a VolatileImage, applications must load the image data through some non-Volatile means, get the Graphics object for the VolatileImage, and then copy the data into the Graphics object using drawImage().
Managed Images: These image objects are not specific objects or APIs in Java, but are rather a concept of how we accelerate image operations. A \"managed image\" is one that you create through any of the normal image creation/loading methods and which we try to accelerate for you internally, by creating an accelerated mirror copy of the image data. This type of image can benefit from hardware acceleration without falling prey to the \"surface loss\" issues mentioned above for VolatileImage. I\'ll talk more about managed images and hardware acceleration later in the article.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
VolatileBufferedToolkitImage Strategies

View Tutorial:
VolatileBufferedToolkitImage Strategies

Related Tutorials:

Programming Java threads in the real world, Part 9 - JavaWorld June 1999
Programming Java threads in the real world, Part 9 - JavaWorld June 1999
 
Create forward-compatible beans in EJB, Part 2 - JavaWorld January 2000
Create forward-compatible beans in EJB, Part 2 - JavaWorld January 2000
 
Use the JVM Profiler Interface for accurate timing - JavaWorld
Use the JVM Profiler Interface for accurate timing - JavaWorld
 
Alternative deployment methods, Part 1: Beyond applets - JavaWorld May 2000
Alternative deployment methods, Part 1: Beyond applets - JavaWorld May 2000
 
Performance books put to the test - JavaWorld March 2001
Performance books put to the test - JavaWorld March 2001
 
Optimistic Locking pattern for EJBs - JavaWorld July 2001
Optimistic Locking pattern for EJBs - JavaWorld July 2001
 
Got resources?
Got resources?
 
Smartly load your properties
Smartly load your properties
 
Good article
Good article
 
Good ideas
Good ideas
 
XStream
XStream is a simple library to serialize objects to XML and back again.
 
Template-Based Code Generation with Apache Velocity, Part 2
Template-Based Code Generation with Apache Velocity, Part 2 As described in part one of this series, code generation typically uses a template engine to transform some kind of "model" into compilable code, given the formatting specified by a template.
 
Ruling Out: Rule Engines and Declarative Programming Come to Java
What practical gain can be found in researching rule engines? Is this just another round in the hype cycle, where writers like me talk up the newest "geegaw" technology and try to pawn it to the masses?
 
HA-JDBC: High-Availability JDBC
HA-JDBC: High-Availability JDBC Summary HA-JDBC is a JDBC driver proxy that provides light-weight, transparent clustering capability to any underlying JDBC driver.
 
HA-JavaMail: High-Availability JavaMail
HA-JavaMail: High-Availability JavaMail Introduction HA-JavaMail is a JavaMail transport proxy that adds efficiency and reliability to an underlying JavaMail provider. HA-JavaMail is NOT an SMTP implementation - it's a wrapper around an existing imp
 
Bridging the Gap: J2SE 5.0 Annotations
Bridging the Gap: J2SE 5.0 Annotations It takes a long time for the Java community to fully absorb a major new JDK release; it seems to take about two more releases after a brand new version of the JDK before everything settles down. Application server v
 
Hibernate simplifies inheritance mapping.
Learn three easy-to-implement strategies to map class hierarchies. Hibernate is an object-relational mapping and persistence framework that provides a lot of advanced features, ranging from introspection to polymorphism and inheritance mapping.
 
Interoperability with Patterns and Strategies for Document-Based Web Services
In Part 2 of this article, we demonstrate interoperability for document-driven web services with Microsoft .NET (C#) using strategies discussed in Part 1.
 
New Technical Articles: 64-bit Programming on Solaris 10 OS for x86 Platforms
Four technical articles describe the new Sun Studio 10 software's 64-bit programming features on the Solaris 10 OS for x86 and AMD64 platforms. Important issues regarding the AMD64 ABI (Application Binary Interface), debugging, migration to 64-bits, and p
 
VolatileBufferedToolkitImage Strategies
Ever wondered what kind of image to use in your application? Or what method to use in creating it? This article attempts to address this challenging topic.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.