drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

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

drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

Stéphane Ducasse
PharoCanvas>>drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c
        | font |
        port colorMap: nil.
        font := fontOrNil ifNil: [TextStyle defaultFont].
        port combinationRule: Form paint.
        font installOn: port
                foregroundColor: (self shadowColor ifNil:[c])
                backgroundColor: Color transparent.
        font displayString: aString on: port
                from: firstIndex to: lastIndex at: (origin + aPoint) kern: 0.



SMxCanvas>>drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c
        | font |
        port colorMap: nil.
        font := fontOrNil ifNil: [StrikeFont default].
        font installOn: port foregroundColor: (self shadowColor ifNil:[c]) backgroundColor: nil.
        font displayString: aString on: port
                from: firstIndex to: lastIndex at: (origin + aPoint) kern: font baseKern negated.


I was wondering why the combinationRule is not needed.

Stef
Reply | Threaded
Open this post in threaded view
|

Re: drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

Igor Stasenko
On 9 February 2011 14:44, Stéphane Ducasse <[hidden email]> wrote:

> PharoCanvas>>drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c
>        | font |
>        port colorMap: nil.
>        font := fontOrNil ifNil: [TextStyle defaultFont].
>        port combinationRule: Form paint.
>        font installOn: port
>                foregroundColor: (self shadowColor ifNil:[c])
>                backgroundColor: Color transparent.
>        font displayString: aString on: port
>                from: firstIndex to: lastIndex at: (origin + aPoint) kern: 0.
>
>
>
> SMxCanvas>>drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c
>        | font |
>        port colorMap: nil.
>        font := fontOrNil ifNil: [StrikeFont default].
>        font installOn: port foregroundColor: (self shadowColor ifNil:[c]) backgroundColor: nil.
>        font displayString: aString on: port
>                from: firstIndex to: lastIndex at: (origin + aPoint) kern: font baseKern negated.
>
>
> I was wondering why the combinationRule is not needed.
>

probably because font (in #displayString:..) can choose one, which
suits for it best. Not canvas.

> Stef
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

Schwab,Wilhelm K
In reply to this post by Stéphane Ducasse
This reminds me of something: I have long been concerned about possible speed penalties that might result from Morphic's accepting colors and other drawing tools as arguments rather than having a canvas hold them as state that can be set once and used many times.  

It's probably nothing, but it always struck me as very different from the way Dolphin does things.  Of course, Object Arts' focus on Windows could have simply have led them to follow along with the platform's design;  there is nothing to say they would have created a context if none had existed.

Just something to think about.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
Sent: Wednesday, February 09, 2011 8:44 AM
To: Pharo Development
Subject: [Pharo-project] drawString: aString from: firstIndex to: lastIndex     at: aPoint font: fontOrNil color: c

[snip]

I was wondering why the combinationRule is not needed.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

Henrik Sperre Johansen

On Feb 10, 2011, at 1:24 55PM, Schwab,Wilhelm K wrote:

This reminds me of something: I have long been concerned about possible speed penalties that might result from Morphic's accepting colors and other drawing tools as arguments rather than having a canvas hold them as state that can be set once and used many times.  

It's probably nothing, but it always struck me as very different from the way Dolphin does things.  Of course, Object Arts' focus on Windows could have simply have led them to follow along with the platform's design;  there is nothing to say they would have created a context if none had existed.

Just something to think about.

Bill

in the section "Adding appearance" on page 6 - 7.

Personally, this is one of the things I don't dislike about Morphic compared to other canvas-based systems :)

Cheers,
Henry

Reply | Threaded
Open this post in threaded view
|

Re: drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

Schwab,Wilhelm K
I knew I had read that somewhere: thanks for the link.  Still, the question of performance lurks.  Passing all of those parameters and setting all of the colors/pens/etc. for EVERY operation might be inefficient.  Just asking...



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Henrik Johansen [[hidden email]]
Sent: Thursday, February 10, 2011 7:52 AM
To: [hidden email]
Subject: Re: [Pharo-project] drawString: aString from: firstIndex to:   lastIndex       at: aPoint font: fontOrNil color: c

On Feb 10, 2011, at 1:24 55PM, Schwab,Wilhelm K wrote:

This reminds me of something: I have long been concerned about possible speed penalties that might result from Morphic's accepting colors and other drawing tools as arguments rather than having a canvas hold them as state that can be set once and used many times.

It's probably nothing, but it always struck me as very different from the way Dolphin does things.  Of course, Object Arts' focus on Windows could have simply have led them to follow along with the platform's design;  there is nothing to say they would have created a context if none had existed.

Just something to think about.

Bill

The rationale is explained in http://stephane.ducasse.free.fr/FreeBooks/CollectiveNBlueBook/morphic.final.pdf
in the section "Adding appearance" on page 6 - 7.

Personally, this is one of the things I don't dislike about Morphic compared to other canvas-based systems :)

Cheers,
Henry


Reply | Threaded
Open this post in threaded view
|

Re: drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c

Igor Stasenko
On 10 February 2011 17:24, Schwab,Wilhelm K <[hidden email]> wrote:
> I knew I had read that somewhere: thanks for the link.  Still, the question of performance lurks.  Passing all of those parameters and setting all of the colors/pens/etc. for EVERY operation might be inefficient.  Just asking...
>
indeed.
But sometimes you can't avoid doing that, especially if you don't know
who used canvas and for what before you.

>

--
Best regards,
Igor Stasenko AKA sig.