-
How to display Jpeg image which store in byte array
Hi.,
I would like to display Jpeg image which store in byte array. since
MemoryImageSource is only capable of managing a RGB memory image
like the example below. I do not want to save byte array into harddisc and
load it back. How to rendering image byte array for display?? I am new to Java, Please Help
int w = 320;
int h = 240;
int pix[] = new int[w * h];
int index = 0;
for (int y = 0; y < h; y++) {
int red = (y * 255) / (h - 1);
for (int x = 0; x < w; x++) {
int blue = (x * 255) / (w - 1);
pix[index++] = (255 << 24) | (red << 16) | blue;
}
}
Graphics g = Panel1.getGraphics();
Graphics2D g2 = (Graphics2D) g;
Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
g2.drawImage (img, 0,0, null);
Similar Threads
-
By asubash in forum ASP.NET
Replies: 0
Last Post: 09-28-2007, 11:14 AM
-
By simplyvenky10 in forum C++
Replies: 1
Last Post: 12-07-2006, 02:15 AM
-
By aks79 in forum VB Classic
Replies: 2
Last Post: 05-23-2006, 11:50 AM
-
By Cody Laird in forum .NET
Replies: 2
Last Post: 06-18-2002, 09:15 AM
-
By LRiotto in forum VB Classic
Replies: 10
Last Post: 11-20-2000, 09:23 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks