Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

applet x/y coordinates

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, newbie to applets. Apologize in advance. I have an applet that does the basic drawing. I'm able to get the x/y coordinates. How do I get this into a BufferedImage and convert into a TIFF file. I noticed ImageIO doesn't support TIFF so my options are JAI.
 
Marshal
Posts: 28123
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You want to get x-y coordinates into a BufferedImage? Sorry, I can't really tell what you mean by that.
 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When drawing, I get a string of x and y coordinates. How can I take these coordinates and draw them out and save as an image. I can write a servlet to take the string. Just need to know how to repaint and save that image.
 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
another thought. is there a way to just get what is current drawn on the canvas and save it as an image?
 
Paul Clapham
Marshal
Posts: 28123
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I still don't understand what it means to "draw out" a set of coordinates. But let's suppose that whatever that means, you can get a JPanel to display whatever it is. Then here's some code I have which converts that JPanel to a graphics file (a GIF as it happens but there are other options):
 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Paul. However, you did provide some some info. However, I'm using applets. When using applets, it's using the Canvas and drawing using the mouseEvent is collected with the double xy coordinates. What's strange is that there's no info to be found on the web on how to save that canvas drawing into a jpeg, gif, or even a tiff. Any other help would be greatly appreciated.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

john s murray wrote:How do I get this into a BufferedImage and convert into a TIFF file. I noticed ImageIO doesn't support TIFF so my options are JAI.


TIFF support for ImageIO is easy to enable: https://coderanch.com/t/445956/open-source/add-tiff-writer-imageio-package
 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for all the input. after some testing, i was able to get it working.
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic