2014-12-27 4:10 GMT+01:00 Edward Povazan <[email protected]>:

> Thanks. It does work to add a little alpha to the colour, but is there no
> other way?
> If I want a solid colour, then what? I should be able to say “this is a
> weird shaped morph, not a rectangle”, but not seeing it.
>
> -Ed
>

Hi Edward
There are two possible solutions:

If you look at for example StringMorph, PolygonMorph or EllipseMorph and to
their "drawing" protocoll, you'll see they overwrite
areasRemainingToFill:
if you copy this method to the CrossMorph class, it will work as you want.

The reason for this is, the default morph uses its color to paint the whole
area and don't need
to care about the underlying area.

The second solution, as you may have seen from looking at the code in Morph
areasRemainingToFill:
is to use a transparent color ("Color transparent") for your morph (the
default color is "Color blue")
and use a different color actually for painting the cross.
(for example, you can add another instance variable "crossColor" and use
that one in the
drawOn: method.


nicolai






>
>
> > On Dec 26, 2014, at 11:58 AM, Hilaire <[email protected]> wrote:
> >
> > Hello,
> >
> > Morph color can be set to translucent, in your example it is problably
> > set with ColorTranslucent r:g:b or a similar class. Not sure about the
> name.
> >
> > Hilaire
> >
> > Le 26/12/2014 20:43, Edward Povazan a écrit :
> >> Hello,
> >>
> >> In the PBE example, and CrossMorph is created. As can be seen from its
> name, It is has a cross shape.
> >>
> >> When one adds keyboard handling to move it about, it seems the
> compositor thinks it is opaque, and doesn’t repaint the “not cross” areas
> with whatever is behind the morph.
> >>
> >> The result is the shape smears across the screen.
> >> This only occurs when moving exactly horizontally or vertically.
> >>
> >> I’ve been looking over the Morph API but can’t detect a method like
> #opaque: or #translucent: or similar.
> >>
> >> Is this a bug, or am I missing the correct way to deal with
> transparent/irregular shaped morphs?
> >>
> >> Thanks,
> >> -Ed
> >>
> >>
> >>
> >
> >
> > --
> > Dr. Geo - http://drgeo.eu
> > iStoa - http://istoa.drgeo.eu
> >
> >
>
>
>

Reply via email to