Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: Image

  1. #1
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    hello

    im trying to clip an immuatable image for that i first converted it to mutable and displayed the mutable image to user also to get clipping area i display a cursor which is used to select coordinates by the user.
    im getting to coordinates but the problem is in

    getRGB method were im not getting expected image

    g.drawRGB(pixels,x1,width,x1,y1,x2,y2,false);

    pixels=original image int array

  2. #2
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Hi,

    as you can read in getRGB() method JavaDocs:

    The returned values are not guaranteed to be identical to values from the original source, such as from createRGBImage or from a PNG image. Color values may be resampled to reflect the display capabilities of the device (for example, red, green or blue pixels may all be represented by the same gray value on a grayscale device).
    So, there's no guarantee that retrieved pixels are the original ones.

    Pit

  3. #3
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi Mahesh,
    Exactly no need for creating the mutable image in order to set the clip..Is this your requirement.If yes then please make it more clear what exactly you are looking for..

    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    can u give me any alternative method for taking new coordinates and drawing the part of the image from the given coordinates

  5. #5
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    hi raj

    can do the appl w/o converting immutable image to mutable one but i had to display cursor over it thats why converted it
    now after getting 2 coordinated how to display the image for that 2 coordinates

  6. #6
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    If I am wrong then make me correct...
    You want to display the part of the image on given points...correct..

    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    hi

    yes you are right i want to display part of image with the given coordinates

  8. #8
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi Mahesh,
    I will give you an indea..ok
    Take the X params array....right.
    Take the Y params array....right.

    Can you calculate the WIDTH and HEIGHT of the portion that will be displayed actually....
    if not then
    WIDTH = X2 - X1
    HEIGHT = Y2 - Y1

    (For the array you have to change this formula..)
    then set Clip like this..

    g.setClip(X[i),Y[i],WIDTH[i],HEIGHT[i]);
    g.drawImage(image_x,image_y,Anchor)
    g.setClip(0,0,SCREEN_WIDTH,SCREEN_HEIGHT)


    Make sure that you do not need to touch the image..just draw the image once..and then you set the clip..

    Hope this can help youu.
    For more Query I will give you the code..tommarrow.
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  9. #9
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    hey raj

    given concept is not working can you elaborate the code in detail
    if possible

    thnks

  10. #10
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi Mahesh,
    Do you have the X and Y co-ordinates..
    And you have the width and height of the piece of the image you want to draw..
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    hi raj

    I am having new coordinates also i am having width and height of original image and for new image width=x2-x1 ,height=y2-y1

    x1,x2,y1,y2 are my new coordinates from which i have to draw new image from original image

  12. #12
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Mahesh,
    Please read the demo and see how the clip() works,
    http://www.java2s.com/Code/Java/J2ME/ClippingRegion.htm
    Just check,
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    its not working as per my requirements

  14. #14
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Well,
    Write step by step..what you need to do with clip..just point by point..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  15. #15
    Regular Contributor mahesh_aquarius's Avatar
    Join Date
    Aug 2008
    Posts
    166
    im displaying an image on canvas
    over the image im displaying a char "+" acts as cursors this can be move over the screen if user press fire key x and y coord are taken ......
    so im taking 2 coord x1,y1 x2,y2 which is the clipping area
    using this coord i want to clip the original image

    this might clear the scenario now.....

Page 1 of 2 12 LastLast

Similar Threads

  1. --- ???save image problem??? ---
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2007-10-01, 14:33
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. 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
  4. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved