[BUG][Partial Fix] Paragraph>>asForm
Michael Latta
lattam at mac.com
Sat Jan 29 03:22:00 UTC 2005
Image 3.7 current full version.
This method behaves contrary to the example included in the method, and
contrary to my expectation.
The method forces foreground color to black and background to white.
It goes to great lengths to do this to support a ColorForm with 2
colors, except that in the case of a TTCStyle it uses a Form with depth
32. It looks like a clear bug. I have yet to figure out how to create
the form with all transparent pixels. The constructor creates it as
black fill, and using "over" or other rules do not replace it with
Color transparent.
Michael
asForm
"Answer a Form made up of the bits that represent the receiver's
displayable text."
| theForm oldBackColor oldForeColor |
oldBackColor _ backColor.
oldForeColor _ foreColor.
textStyle isTTCStyle ifTrue: [
theForm _ (Form extent: compositionRectangle extent depth: 32)
offset: offset.
theForm fill: theForm boundingBox rule: Form erase fillColor: Color
transparent.
] ifFalse: [
theForm _ (ColorForm extent: compositionRectangle extent)
offset: offset;
colors: (Array
with: (backColor == nil ifTrue: [Color transparent] ifFalse:
[backColor])
with: (foreColor == nil ifTrue: [Color black] ifFalse:
[foreColor])).
backColor _ Color white.
foreColor _ Color black.
].
self displayOn: theForm
at: 0 at 0
clippingBox: theForm boundingBox
rule: Form over
fillColor: nil.
backColor _ oldBackColor.
foreColor _ oldForeColor.
^ theForm
"Example:
| p |
p _ 'Abc' asParagraph.
p foregroundColor: Color red backgroundColor: Color black.
p asForm displayOn: Display at: 30 at 30 rule: Form over"
More information about the Squeak-dev
mailing list
|