Filling a bitmap image with java 1.3.1  
Author Message
p_baeyens





PostPosted: 2003-12-8 18:21:00 Top

java-programmer, Filling a bitmap image with java 1.3.1 I need to fill parts of a bitmap, representing European country's
electional cantons, with different colors, one per canton. I would
like to know what would be the best way to do it on a pure java awt
environment.

Thanks a lot.
 
VK





PostPosted: 2003-12-9 6:52:00 Top

java-programmer >> Filling a bitmap image with java 1.3.1 Depends on what map do you have in your mind. If a simple schematic map,
I would suggest to spend some initial time to make a polygon for each
canton (a set of x,y coords).
Then use fillPolygon method in Graphics to draw cantons.


 
Marco Schmidt





PostPosted: 2003-12-9 8:04:00 Top

java-programmer >> Filling a bitmap image with java 1.3.1 Patrick Baeyens:

>I need to fill parts of a bitmap, representing European country's
>electional cantons, with different colors, one per canton. I would
>like to know what would be the best way to do it on a pure java awt
>environment.

Call getGraphics on your image and use the draw functions of the
Graphics(2D) object you received this way.

Regards,
Marco
--
Please reply in the newsgroup, not by email!
Java programming tips: http://jiu.sourceforge.net/javatips.html
Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html
 
 
p_baeyens





PostPosted: 2003-12-9 16:38:00 Top

java-programmer >> Filling a bitmap image with java 1.3.1 Marco Schmidt <email***@***.com> wrote in message news:<email***@***.com>...
> Patrick Baeyens:
>
> >I need to fill parts of a bitmap, representing European country's
> >electional cantons, with different colors, one per canton. I would
> >like to know what would be the best way to do it on a pure java awt
> >environment.
>
> Call getGraphics on your image and use the draw functions of the
> Graphics(2D) object you received this way.
>
> Regards,
> Marco

Thanks for the suggestion. This would mean I would first have to
convert my map of the country, which is white with the canton limits
in black, to a polygon map manually and then fill the polygons. Is
there any way I can do a fill operation straight on the bitmap (as in
paintshop-like programs) using java awt or any open source package?

Thanks,
Patrick