Re: transparent images etc.

Scott Raney (raney@metacard.com)
Thu, 15 Jun 1995 17:56:18 -0600 (MDT)

>
> is it possible to make images or graphics transparent, but
> still sensible for mouseclicks, so that I can use
> it as a kind of "clickmask" for an underlaying image?
> I want to create an image with several points to click
> at (and diffrent reactions to each point).
> I got it work with buttons via the opaque-property, but
> the rectangle-shape is to inflexible. Opaque doesn't seem to work
> with images.
>
> Any hints??

This is a hard problem because the whole design philosophy has been
that non-filled areas can't be clicked on. But I can see the need for
this to be different in some cases. Perhaps graphics should have a
property that could be set that would decouple the transparency of the
interior regions from the handling of mouse events.

There are a couple of ways to do what you want, but they're much
different from what you were looking for. The easier of the two is to
create a graphic of the shape and position you want, set its filled
property to true and its backPattern to the id of the image you'll be
placing it over (the last step has to be done using the Message Box).
That way, you're still clicking on a solid graphic, but it draws
itself using the image and so looks just like the image. This
technique will only work if your the topLeft of your image is at 0,0
(the origin of all patterns) and if the image is solid (masked areas
will appear black in the graphic).

The second approach is to make clones of your image (control-drag with
the pointer tool) and then crop and erase the borders of the copies
such that each of them contains a single "hot spot" in the original
image. Position these smaller images over the corresponding areas of
the original image. Though this technique takes up more memory than
the other one and requires some (possibly tedious) painting to get the
contours of the hot spot images right, you have pixel-level control
over the boundaries of the hot spots and can even do fancy things like
changing the colors of the hot spot areas as the mouse cursor moves
over them.

> thanxx a lot,
>
> Stefan

-- 
***********************************************************************
* Scott Raney  303-447-3936            Remember: the better you look, *
* raney@metacard.com                   the more you'll see -- Lidia   *
***********************************************************************