Thread: find x,y from pixel

  1. #1
    Registered User
    Join Date
    Nov 2007

    find x,y from pixel

    ok I have the color of a pixel but I wont to find x,y of that pixl with out moving the mouse over it. so far im thinking i need to use this.
    COLORREF RGB(37, 124, 244);
    but I dont know what els to do.

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Plano, Texas, United States
    I don't quite understand what you are asking, but what I think you are asking is this:

    "How can I find the RGB color value of a specific pixel on the screen at some coordinate (x,y)?"

    Is that correct? Or are you asking this question:

    "How can I find all pixels with coordinates (x,y) that have the specified RGB value which I know?"

    Whatever the case...I don't think COLORREF is what you want. It just stores some RGB value in memory as a "color". It has nothing to do with (x,y) coordinates.
    My Website

    "Circular logic is good because it is."

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    >> but I dont know what els to do.

    a book perhaps?
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  4. #4
    Registered User
    Join Date
    Nov 2007
    no thats not it but I think that i have figured it out thanks

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    If you are trying to get pixel x,y from pixel offset:

    int pixel_x = offset &#37; (width);
    int pixel_y = offset / (width);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Find Dialog
    By Lithorien in forum Windows Programming
    Replies: 6
    Last Post: 04-25-2005, 05:28 PM
  3. Replies: 5
    Last Post: 04-16-2004, 01:29 AM
  4. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM
  5. how do u find 2nd largest number??
    By juancardenas in forum C Programming
    Replies: 8
    Last Post: 02-14-2003, 08:28 AM