Java Doc for ImageDataFactory.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.lcdui.ImageDataFactory

ImageDataFactory
class ImageDataFactory implements AbstractImageDataFactory(Code)
ImageFactory implementation based on putpixel graphics library and stores data on Java heap.




Method Summary
public  ImageDatacreateImmutableCopy(ImageData mutableSource)
     Creates an immutable ImageData from a mutableSource ImageData. If the source image data is mutable, an immutable copy is created and returned.
public  ImageDatacreateImmutableImageData(byte[] imageBytes, int imageOffset, int imageLength)
     Creates an immutable ImageData which is decoded from the data stored in the specified byte array at the specified offset and length.
public  ImageDatacreateImmutableImageData(ImageData dataSource, int x, int y, int w, int h, int transform)
     Creates an immutable ImageData using pixel data from the specified region of a source ImageData, transformed as specified.

The source image dara may be mutable or immutable. For immutable source image data, transparency information, if any, is copied to the new image data unchanged.

On some devices, pre-transformed images may render more quickly than images that are transformed on the fly using drawRegion. However, creating such images does consume additional heap space, so this technique should be applied only to images whose rendering speed is critical.

The transform function used must be one of the following, as defined in the javax.microedition.lcdui.game.Sprite Sprite class:
Sprite.TRANS_NONE - causes the specified image region to be copied unchanged
Sprite.TRANS_ROT90 - causes the specified image region to be rotated clockwise by 90 degrees.
Sprite.TRANS_ROT180 - causes the specified image region to be rotated clockwise by 180 degrees.
Sprite.TRANS_ROT270 - causes the specified image region to be rotated clockwise by 270 degrees.
Sprite.TRANS_MIRROR - causes the specified image region to be reflected about its vertical center.
Sprite.TRANS_MIRROR_ROT90 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 90 degrees.
Sprite.TRANS_MIRROR_ROT180 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 180 degrees.
Sprite.TRANS_MIRROR_ROT270 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 270 degrees.

The size of the returned image will be the size of the specified region with the transform applied.

public  ImageDatacreateImmutableImageData(int rgb, int width, int height, boolean processAlpha)
     Creates an immutable ImageData from a sequence of ARGB values, specified as 0xAARRGGBB. The ARGB data within the rgb array is arranged horizontally from left to right within each row, row by row from top to bottom. If processAlpha is true, the high-order byte specifies opacity; that is, 0x00RRGGBB specifies a fully transparent pixel and 0xFFRRGGBB specifies a fully opaque pixel.
public  ImageDatacreateImmutableImageData(int imageDataArrayPtr, int imageDataArrayLength)
     Function to decode an ImageData from romized data.
public  ImageDatacreateImmutableImageData(InputStream stream)
     Creates an immutable image from decoded image data obtained from an InputStream.
public  ImageDatacreateOffScreenImageData(int width, int height)
     Creates a new, mutable image for off-screen drawing.
public  ImageDatacreateResourceImageData(String name)
     Creates an immutable ImageData from decoded image data obtained from the named resource.
public static  AbstractImageDataFactorygetImageDataFactory()
     Returns the singleton ImageDataFactory instance.



Method Detail
createImmutableCopy
public ImageData createImmutableCopy(ImageData mutableSource)(Code)
Creates an immutable ImageData from a mutableSource ImageData. If the source image data is mutable, an immutable copy is created and returned. If the source image data is immutable, the implementation may simply return it without creating a new image. If an immutable source image data contains transparency information, this information is copied to the new image data unchanged.

This method is useful for placing the contents of mutable images into Choice objects. The application can create an off-screen image using the ImageDataFactory.createImage(int,int) createImage(w, h) method, draw into it using a Graphics object obtained with the ImageDataFactory.getGraphics() getGraphics() method, and then create an immutable copy of it with this method. The immutable copy may then be placed into Choice objects.


Parameters:
  mutableSource - the source mutable image to be copied the new immutable image data
throws:
  NullPointerException - if source is null



createImmutableImageData
public ImageData createImmutableImageData(byte[] imageBytes, int imageOffset, int imageLength)(Code)
Creates an immutable ImageData which is decoded from the data stored in the specified byte array at the specified offset and length. The data must be in a self-identifying image file format supported by the implementation, such as PNG.

The imageoffset and imagelength parameters specify a range of data within the imageData byte array. The imageOffset parameter specifies the offset into the array of the first data byte to be used. It must therefore lie within the range [0..(imageData.length-1)]. The imageLength parameter specifies the number of data bytes to be used. It must be a positive integer and it must not cause the range to extend beyond the end of the array. That is, it must be true that imageOffset + imageLength < imageData.length.

This method is intended for use when loading an image from a variety of sources, such as from persistent storage or from the network.


Parameters:
  imageBytes - the array of image data in a supported image format
Parameters:
  imageOffset - the offset of the start of the data in the array
Parameters:
  imageLength - the length of the data in the array the created image
throws:
  ArrayIndexOutOfBoundsException - if imageOffsetand imageLengthspecify an invalid range
throws:
  NullPointerException - if imageData isnull
throws:
  IllegalArgumentException - if imageData is incorrectlyformatted or otherwise cannot be decoded



createImmutableImageData
public ImageData createImmutableImageData(ImageData dataSource, int x, int y, int w, int h, int transform)(Code)
Creates an immutable ImageData using pixel data from the specified region of a source ImageData, transformed as specified.

The source image dara may be mutable or immutable. For immutable source image data, transparency information, if any, is copied to the new image data unchanged.

On some devices, pre-transformed images may render more quickly than images that are transformed on the fly using drawRegion. However, creating such images does consume additional heap space, so this technique should be applied only to images whose rendering speed is critical.

The transform function used must be one of the following, as defined in the javax.microedition.lcdui.game.Sprite Sprite class:
Sprite.TRANS_NONE - causes the specified image region to be copied unchanged
Sprite.TRANS_ROT90 - causes the specified image region to be rotated clockwise by 90 degrees.
Sprite.TRANS_ROT180 - causes the specified image region to be rotated clockwise by 180 degrees.
Sprite.TRANS_ROT270 - causes the specified image region to be rotated clockwise by 270 degrees.
Sprite.TRANS_MIRROR - causes the specified image region to be reflected about its vertical center.
Sprite.TRANS_MIRROR_ROT90 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 90 degrees.
Sprite.TRANS_MIRROR_ROT180 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 180 degrees.
Sprite.TRANS_MIRROR_ROT270 - causes the specified image region to be reflected about its vertical center and then rotated clockwise by 270 degrees.

The size of the returned image will be the size of the specified region with the transform applied. For example, if the region is 100 x 50 pixels and the transform is TRANS_ROT90, the returned image will be 50 x 100 pixels.

Note: If all of the following conditions are met, this method may simply return the source Image without creating a new one:

  • the source image is immutable;
  • the region represents the entire source image; and
  • the transform is TRANS_NONE.

Parameters:
  dataSource - the source image data to be copied from
Parameters:
  x - the horizontal location of the region to be copied
Parameters:
  y - the vertical location of the region to be copied
Parameters:
  w - the width of the region to be copied
Parameters:
  h - the height of the region to be copied
Parameters:
  transform - the transform to be applied to the region the new, immutable image
throws:
  NullPointerException - if image is null
throws:
  IllegalArgumentException - if the region to be copied exceedsthe bounds of the source image
throws:
  IllegalArgumentException - if either width orheight is zero or less
throws:
  IllegalArgumentException - if the transformis not valid



createImmutableImageData
public ImageData createImmutableImageData(int rgb, int width, int height, boolean processAlpha)(Code)
Creates an immutable ImageData from a sequence of ARGB values, specified as 0xAARRGGBB. The ARGB data within the rgb array is arranged horizontally from left to right within each row, row by row from top to bottom. If processAlpha is true, the high-order byte specifies opacity; that is, 0x00RRGGBB specifies a fully transparent pixel and 0xFFRRGGBB specifies a fully opaque pixel. Intermediate alpha values specify semitransparency. If the implementation does not support alpha blending for image rendering operations, it must replace any semitransparent pixels with fully transparent pixels. (See Alpha Processing for further discussion.) If processAlpha is false, the alpha values are ignored and all pixels must be treated as fully opaque.

Consider P(a,b) to be the value of the pixel located at column a and row b of the Image, where rows and columns are numbered downward from the top starting at zero, and columns are numbered rightward from the left starting at zero. This operation can then be defined as:


 P(a, b) = rgb[a + b * width];    

for


 0 <= a < width
 0 <= b < height    


Parameters:
  rgb - an array of ARGB values that composes the image
Parameters:
  width - the width of the image
Parameters:
  height - the height of the image
Parameters:
  processAlpha - true if rgbhas an alpha channel,false if all pixels are fully opaque the created ImageData
throws:
  NullPointerException - if rgb is null.
throws:
  IllegalArgumentException - if either width orheight is zero or less
throws:
  ArrayIndexOutOfBoundsException - if the length ofrgb isless than width * height.



createImmutableImageData
public ImageData createImmutableImageData(int imageDataArrayPtr, int imageDataArrayLength)(Code)
Function to decode an ImageData from romized data.
Parameters:
  imageDataArrayPtr - native pointer to image data as Java int
Parameters:
  imageDataArrayLength - length of image data array ImageData created from romized data.
throws:
  IllegalArgumentException - if the id is invalid



createImmutableImageData
public ImageData createImmutableImageData(InputStream stream) throws IOException(Code)
Creates an immutable image from decoded image data obtained from an InputStream. This method blocks until all image data has been read and decoded. After this method completes (whether by returning or by throwing an exception) the stream is left open and its current position is undefined.
Parameters:
  stream - the name of the resource containing the image datain one of the supported image formats the created image
throws:
  NullPointerException - if stream is null
throws:
  java.io.IOException - if an I/O error occurs, if the image datacannot be loaded, or if the image data cannot be decoded



createOffScreenImageData
public ImageData createOffScreenImageData(int width, int height)(Code)
Creates a new, mutable image for off-screen drawing. Every pixel within the newly created image is white. The width and height of the image must both be greater than zero.
Parameters:
  width - the width of the new image, in pixels
Parameters:
  height - the height of the new image, in pixels the created image



createResourceImageData
public ImageData createResourceImageData(String name) throws IOException(Code)
Creates an immutable ImageData from decoded image data obtained from the named resource. The name parameter is a resource name as defined by Class.getResourceAsStream(String)Class.getResourceAsStream(name) . The rules for resolving resource names are defined in the Application Resource Files section of the java.lang package documentation.
Parameters:
  name - the name of the resource containing the image data in one ofthe supported image formats the created image data
throws:
  NullPointerException - if name is null
throws:
  java.io.IOException - if the resource does not exist,the data cannotbe loaded, or the image data cannot be decoded



getImageDataFactory
public static AbstractImageDataFactory getImageDataFactory()(Code)
Returns the singleton ImageDataFactory instance. the singleton ImageDataFactory instance.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.