Results 1 to 5 of 5

Thread: determine pixel color , not GetPixel !!

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    determine pixel color , not GetPixel !!

    Hi.
    I have a form with several objects moving around by timer.

    when the objects have finished moving I want to know the color of the pixel at the 0,0 point of a certain picture box.

    BUT, the reason I can't use GetPixel is:
    I don't want it to necessarily return the color value in Picture1.
    I only want that value to be returned if nothing is in front of Picture1. If another object is in front of picture1 at point 0,0 , want that color to be returned. So, in graphic terms, that means whatever color the user sees at that point on the screen, is the color info I want to collect.

    Any thoughts?
    Thanks
    Wengang
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  2. #2
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221
    You'd have to check for overlapping controls manually.
    "1 4m 4 1337 #4xz0r!'
    Janus

  3. #3

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    well, that's what I'm trying to avoid for speed's sake


    There is no way to just get a pixel color at a certain screen point regardless of what control occupies it?


    The color picker in several programs can draw from any area of the screen, even other windows, though
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  4. #4
    Helger
    Guest
    You can bitblit a small part of the picturebox to a new picturebox.
    then use getpixel on the new picturebox. Bitblit works fast I think and will only capture the frontmost stuff.

    zai hui,

    Helger

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    getdc your window and getpixel with coordinates client to it
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

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



Click Here to Expand Forum to Full Width