Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
|
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2004, 03:57 PM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Saving Shape objects as Bitmap or Jpeg

Using Horton's sketcher code I would like to save the sketch as either a bitmap or jpeg file. I have code for saving an Image object and am looking for any pointers I can find befor spending more time on this.

(this topic has been posted in Java forum)

thanks for your time - JoePates

 
Old August 7th, 2004, 05:16 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by JoePates
 Using Horton's sketcher code I would like to save the sketch as either a bitmap or jpeg file. I have code for saving an Image object and am looking for any pointers I can find befor spending more time on this.

(this topic has been posted in Java forum)

thanks for your time - JoePates
It is better to use a drawing program like Paint Shop Pro to create a sketch and save it. The sketcher we create in Ivor Horton's Beginning Java 2 is meant to be an example of a large program. The way to benefit from Sketcher is to write (type over!) the Java source code as we move along studying the book.
For instance: it teaches us to create and use OUR OWN SERIALIZATION to save a sketch.

Regards
Francis

 
Old August 7th, 2004, 05:06 PM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Francis;
Yeah thats pretty obvious. Do you have any ADVICE to give on saving a Shape object as a Bitmap. Besides, if I was going to use existing software what would be the point of even learning how to create and USE OUR OWN SERIALIZATION?




 
Old August 8th, 2004, 08:45 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by JoePates
 Francis;
Yeah thats pretty obvious. Do you have any ADVICE to give on saving a Shape object as a Bitmap. Besides, if I was going to use existing software what would be the point of even learning how to create and USE OUR OWN SERIALIZATION?
OK, if you browse the index of

JavaTM 2 Platform, Standard Edition, v 1.4.2 API Specification
http://java.sun.com/j2se/1.4.2/docs/api/

like I did, you won't find the word Bitmap, strange...

Of course there are the

java.awt.image
javax.imageio

packages and these are extensive (as usual)

No, I don't know the answer to this, because I have not studied chapter 17 yet, which deals with images, nor chapter 16 on printing and the practice of serialization.

Why not submit your question through the appropriate channels:

Developer Forums
Java Technology Forums

http://forum.java.sun.com/index.jsp

Developer Forums
Forum: New To Java Technology

http://forum.java.sun.com/forum.jsp?forum=54

To be honest: this forum is quite dead, it's only me here, and my book, with Ivor Horton smiling on the cover, telling me it is easy, which it isn't..

& Good day to you Sir









 
Old August 8th, 2004, 09:06 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

P.S.

JPEG - Static variable in class javax.print.DocFlavor.BYTE_ARRAY
Doc flavor with MIME type = "image/jpeg", print data representation class name = "[B" (byte array).
JPEG - Static variable in class javax.print.DocFlavor.INPUT_STREAM
Doc flavor with MIME type = "image/jpeg", print data representation class name = "java.io.InputStream" (byte stream).
JPEG - Static variable in class javax.print.DocFlavor.URL
Doc flavor with MIME type = "image/jpeg", print data representation class name = "java.net.URL".
JPEGHuffmanTable - class javax.imageio.plugins.jpeg.JPEGHuffmanTable.
A class encapsulating a single JPEG Huffman table.
JPEGHuffmanTable(short[], short[]) - Constructor for class javax.imageio.plugins.jpeg.JPEGHuffmanTable
Creates a Huffman table and initializes it.
JPEGImageReadParam - class javax.imageio.plugins.jpeg.JPEGImageReadParam.
This class adds the ability to set JPEG quantization and Huffman tables when using the built-in JPEG reader plug-in.
JPEGImageReadParam() - Constructor for class javax.imageio.plugins.jpeg.JPEGImageReadParam
Constructs a JPEGImageReadParam.
JPEGImageWriteParam - class javax.imageio.plugins.jpeg.JPEGImageWriteParam.
This class adds the ability to set JPEG quantization and Huffman tables when using the built-in JPEG writer plug-in, and to request that optimized Huffman tables be computed for an image.
JPEGImageWriteParam(Locale) - Constructor for class javax.imageio.plugins.jpeg.JPEGImageWriteParam
Constructs a JPEGImageWriteParam.
JPEGQTable - class javax.imageio.plugins.jpeg.JPEGQTable.
A class encapsulating a single JPEG quantization table.
JPEGQTable(int[]) - Constructor for class javax.imageio.plugins.jpeg.JPEGQTable
Constructs a quantization table from the argument, which must contain 64 elements in natural order (not zig-zag order).

The API index does give us clue as to the implementation of the JPEG standard, but I must add that I advise strongly against using JPEG to save the drawings made in Sketcher.
GIF would be the natural choice for these!


GIF - Static variable in class javax.print.DocFlavor.BYTE_ARRAY
Doc flavor with MIME type = "image/gif", print data representation class name = "[B" (byte array).
GIF - Static variable in class javax.print.DocFlavor.INPUT_STREAM
Doc flavor with MIME type = "image/gif", print data representation class name = "java.io.InputStream" (byte stream).
GIF - Static variable in class javax.print.DocFlavor.URL
Doc flavor with MIME type = "image/gif", print data representation class name = "java.net.URL".


Did you know that you can make a screen picture? (I've never done this, but your computer should support this facility)
Then it should be possible to save any Sketcher drawing.
Even the ones where XOR mode isn't working appropriately, and you get all these nice effects, where moving a Shape creates the most crazy mouse movement artefacts on the screen, that are not stored in the Model, and thus cannot be serialized.

;0)
Francis


 
Old August 8th, 2004, 09:39 AM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Francis;

Thanks very much for your time and effort on this. I have been looking through the API's and have come across the info that you posted as well as info in JAI on saving images.

 I am working on a school project that requires us to make a simple animation system and saving the image(s) in a format that can be displayed by en editing program is part of the project.

 It is not important as to what format the image is stored as, bmp, jpeg, gif. (may be extra marks if more than one format is offered!)

 Thanks again.

P.S. I have posted this elsewhere with little feedback so far.


 
Old August 8th, 2004, 10:15 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've heard the voices of many developers crying out loud for support in saving images as .gif format. It seems the patent expires this year, and we all hope the new Java 1.5. API will allow us this new feature.

Good luck with your studies!
Francis
the Hague






Similar Threads
Thread Thread Starter Forum Replies Last Post
Rotating shape in VBA (not center of shape) Piblon Excel VBA 3 April 13th, 2006 04:04 AM
EXCEL question saving a file saving the the first macupryk VS.NET 2002/2003 0 January 6th, 2005 05:33 PM
Saving Shape objects as Bitmap or Jpeg JoePates Java GUI 2 November 30th, 2004 06:03 PM
jpeg format nasiim96 C++ Programming 2 October 18th, 2004 08:23 AM
"No Fill" for Shape Objects msvedlow Excel VBA 2 September 5th, 2003 10:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.