-
August 25th, 2003, 08:24 AM
#1
Several links in bitmaps
HI,
I would like to put a bitmap in my view. In the bitmap their are certain elements that I would like to behave as links. Those elements can have states, e.g enable(with colors) / disable (grayed).
Does anyone has idea how can I do it?
-
August 25th, 2003, 09:02 AM
#2
Hi,
Maybe with an example the problem will be clearer.
Lets say that I have a bitmap with a house, dog and a car in addition to other elements.
1. In certain cases I want the house will be colorfull and in others grayed.
This can be solved by creating the whole bitmap as much cases as I have (in our case: 2 states for 3 bitmaps, 2^3 bitmaps).
Hard work but will work.
2. I want to identify when the user clicks the house (or the dog or the house). I don't know how to identify a user click in part of the bitmap.
-
August 25th, 2003, 09:32 AM
#3
You can use PtInRegion() API to determine if the point is inside a region,,
but this way you'll have to save region data with the bitmap (cerate you're own file format)
or create the icture elements in fixed colors(grass in Green , cars in red etc) and use GetPixel() to get the color then the type of element.
-
August 25th, 2003, 09:41 AM
#4
Hello,
Thanks for the quick response.
How can I obtain the region of certain element in bitmap?
-
August 25th, 2003, 09:42 AM
#5
I don't know much about graphics but I think Windows does not have support of that type of thing that is good as the support in HTML. However is it not true that in HTML it is necessary to specify what portion of an image is associated with a specific link?
-
August 25th, 2003, 09:54 AM
#6
I think you'll have to get the coordinates for corners of the bitmap items ,, then use CreatePolygonRgn()
how to get the corners ?
i'm afraid you'll have to get them by eye !! or create a small utility to store that coordinates in text files (you click the point and the prog gets x,y and store them..
Not a (best) solution .. but we are making a brain storming !!
-
August 25th, 2003, 11:00 AM
#7
Originally posted by Haim B
Hi,
Maybe with an example the problem will be clearer.
Lets say that I have a bitmap with a house, dog and a car in addition to other elements.
1. In certain cases I want the house will be colorfull and in others grayed.
This can be solved by creating the whole bitmap as much cases as I have (in our case: 2 states for 3 bitmaps, 2^3 bitmaps).
Hard work but will work.
2. I want to identify when the user clicks the house (or the dog or the house). I don't know how to identify a user click in part of the bitmap.
It would be better to have the complete bitmap(background) and a bit map for each element's state i.e. house_en, house_dis, etc... This saves the complexity of selecting the appropiate bitmap and saves space as you're only storing the necessary delta's. It also helps in determining the clickable region. There is an example in the article section on making a "skinable" progress bar (click here). This should show you how to create a region from a bitmap (basically it uses a background color to determine what's in the desired portion of the image), you then can use that region with PtInRegion() to determine a hit.
bytz
--This signature left intentionally blank--
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
|