×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    34

    Current Pixel Color

    I am working on a paint type project for mobile...
    For Drawing lines and other objects i want to get the current pixel color...
    but according to me there is no function to get the current pixel color..
    Is that so??????
    plz provide suggestions to know that color...
    Thanks in advance

    http://java.sun.com/javame/reference.../Graphics.html

  2. #2
    Nokia Developer Champion
    Join Date
    Aug 2009
    Posts
    18

    Re: Current Pixel Color

    When you draw on the Canvas's Graphics, create a mutable Image which is a duplicate of what you have drawn on the canvas. Then call the image's getRGB() to get an array of the RGBA data of the image.

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: Current Pixel Color

    what do you mean by current pixel, and what do you what to know its color for?

  4. #4
    Registered User
    Join Date
    Sep 2010
    Posts
    34

    Re: Current Pixel Color

    @Mmusehani :Good solution....thanks
    But why we dont have any inbuilt function for it?????

    Actually i want to implement "graphics.setXORMode(xorColor)" like function which is available for j2se and not for j2me..

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    34

    Re: Current Pixel Color

    @njzk2: the color of (x,y) pixel of which (x,y) will be specified as arguments..

  6. #6
    Nokia Developer Champion
    Join Date
    Aug 2009
    Posts
    18

    Re: Current Pixel Color

    I not really sure why we don't have that function. My guess is that the pixels are not stored in an lexicographical order (or not stored at all), therefore the pixel colours can't be referenced by there coordinates. Probably for performance purposes. But that's just my guess.

  7. #7
    Registered User
    Join Date
    Sep 2010
    Posts
    34

    Re: Current Pixel Color

    Thanks friends for your reply's
    I am now able to draw lines,square,circle.... everything
    but i am now stuck up with the problem of how to save that image in mobile???
    there are no encoding decoding image function available for j2me.........

    plz do suggest for this also...
    Thanks in advance

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Current Pixel Color


Similar Threads

  1. Capturing the screen pixel color value...
    By nilanchalapanigrahy in forum Mobile Java General
    Replies: 1
    Last Post: 2010-06-21, 12:38
  2. How can I get the current font color of current theme ?
    By nadis in forum Symbian Media (Closed)
    Replies: 5
    Last Post: 2009-05-08, 23:36
  3. Comparing pixel color and get___Component()
    By nurru in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2007-05-07, 12:50
  4. Getting a pixel color value (from a Canvas)
    By dd_plus in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2004-07-12, 08:04
  5. color value of a jpg pixel
    By tronicart in forum Symbian
    Replies: 0
    Last Post: 2003-11-25, 12: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
  •