|
-
Nov 19th, 2002, 10:51 AM
#1
Thread Starter
Hyperactive Member
-
Nov 19th, 2002, 03:35 PM
#2
Addicted Member
well, you could just check to see if its in the rectangle of the bitmap, and then once you do that check to see if the color of the pixel you clicked was of the color of the object behind the bitmap. For instance, use:
Private Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
blit the transparant bitmap to the form, then when you click, if the color is equal to the color of the form, you know you clicked the transparant part, or didn't click if its not the color. as far as the border, create a transparant bitmap that would serve as the border, and just blit over the bitmap when you mouseover it (you can check getpixel on mousemove too).
hope that helps, i just thought of it.......
-
Nov 20th, 2002, 04:03 AM
#3
Thread Starter
Hyperactive Member
Thanks for the reply, I must admit that method (pixel colour)occured to me after posting, but I was wondering if there was a 'cleverer' way Also, it breaks down since I have no way of knowing what the pixel colour behind the bitmap is going to be (there could be other user defined shapes or bitmpas 'beneath' the one of interest).
As for the border, I'd need something generic based on the bitmap itself, since the user can load any bitmap. I was thinking you might somehow be able to use the masked-source or the mask bitmap, since they essentially contain the outline of the shape of the bitmap.
What I need to do then is programmatically trace around the outline, adding pixels of my highlight colour. Sounds difficult, but is it impossible?
      
Dan
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
-
Nov 20th, 2002, 10:25 PM
#4
Addicted Member
you want to create the outline dynamically? that would some algorithm.
you could take the bitmap, shrink its mask, blit the mask over the source, but don't blit it at (0,0) on the source. figure out a factor, xoffset-yoffset so that what youre left with is the bitmap with a black center that is the same shape but smaller that the source bitmap. you then would have an outline that would be made of the color pixels from the source. you then could read that bitmap. if the background is white and the mask was black, you could find all the pixels that are color(the outline from the source), and put those pixels in a new bitmap as whatever color you want. This would be the outline. I know this must sound totally ridculous, but its an idea. it would require a large knowledge of GetBitmapBits and SetBitmapBits and creating dynamic(and empty) bitmaps and how the individual bits of a bitmap are setup, but i think its possible.
-
Nov 21st, 2002, 03:58 AM
#5
Thread Starter
Hyperactive Member
-
Nov 25th, 2002, 05:37 PM
#6
Addicted Member
yeah ummmm
thats c++
i could give you a translation of that into vb (a working example), but the problem is i don't have the syntax for declaring the CreateRgnFromFile api call in VB. If i had that i could give an example.
-
Nov 26th, 2002, 05:07 AM
#7
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|