×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    5

    Drawing on an image

    I'm using NetBeans forms and added an image which is a .PNG file. I am wondering if there is a way that I can draw rectangles on the .PNG file because I read somewhere that images that are files are immutable.

    Is there any way I can work around the problem?

    Essentially what i am trying to do is display a map (.PNG file) and then draw rectangles on the map to show destinations.

    Thx for the help!

  2. #2
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: Drawing on an image

    Hi Scottleaw, Well the image u get from resource will be of type immutable but u can use the following to draw things over it...


    It is possible to create a mutable copy of an immutable image using a technique similar to the following:

    Image source; // the image to be copied
    source = Image.createImage(...);
    Image copy = Image.createImage(source.getWidth(), source.getHeight());
    Graphics g = copy.getGraphics();
    g.drawImage(source, 0, 0, TOP|LEFT);
    Well check out java doc i got above from there only...

    Prakash

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    5

    Re: Drawing on an image

    Thx for ur Help Prakash!
    Last edited by scottleaw; 2007-09-26 at 19:09.

Similar Threads

  1. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  2. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  3. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31
  4. Problem of drawing FLIPPED Image after clipping in Nokia 3510i handset
    By radhesh in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2003-12-10, 03:29
  5. Series 40 - image resizeing and drawing black and white only a part of an image
    By ionutianasi in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2003-07-21, 10:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×