[Pharo-project] drawString: aString from: firstIndex to: lastIndex at: aPoint font: fontOrNil color: c
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
On 9 February 2011 14:44, Stéphane Ducasse <stephane.ducasse@inria.fr> 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.
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: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stéphane Ducasse [stephane.ducasse@inria.fr] 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
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.... 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
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: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Henrik Johansen [henrik.s.johansen@veloxit.no] Sent: Thursday, February 10, 2011 7:52 AM To: Pharo-project@lists.gforge.inria.fr 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.... 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
On 10 February 2011 17:24, Schwab,Wilhelm K <bschwab@anest.ufl.edu> 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.
participants (4)
-
Henrik Johansen -
Igor Stasenko -
Schwab,Wilhelm K -
Stéphane Ducasse