CrossMorph in PBE and compositing bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

CrossMorph in PBE and compositing bug

Edward Povazan
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


Reply | Threaded
Open this post in threaded view
|

Re: CrossMorph in PBE and compositing bug

HilaireFernandes
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 | Threaded
Open this post in threaded view
|

Re: CrossMorph in PBE and compositing bug

Edward Povazan
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


> On Dec 26, 2014, at 11:58 AM, Hilaire <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: CrossMorph in PBE and compositing bug

stepharo
did you try put alpha to zero?


Le 27/12/14 04:10, Edward Povazan a écrit :

> 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
>
>
>> On Dec 26, 2014, at 11:58 AM, Hilaire <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: CrossMorph in PBE and compositing bug

Nicolai Hess
In reply to this post by Edward Povazan
2014-12-27 4:10 GMT+01:00 Edward Povazan <[hidden email]>:
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: CrossMorph in PBE and compositing bug

Edward Povazan
Thank you Nicolai,
areasRemainingToFill: is what I was looking for, did not see it due to looking for “transparent” or “opaque” or similar message.

-Edward

^ Array with: aRectangle

On Dec 27, 2014, at 6:38 AM, Nicolai Hess <[hidden email]> wrote:

2014-12-27 4:10 GMT+01:00 Edward Povazan <[hidden email]>:
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 <[hidden email]> 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
>
>