Christoph Thiede uploaded a new version of Graphics to project The Inbox:
http://source.squeak.org/inbox/Graphics-ct.441.mcz ==================== Summary ==================== Name: Graphics-ct.441 Author: ct Time: 30 September 2020, 9:23:41.380807 pm UUID: 7b1f1c65-2eca-4442-a0da-88e6975377f2 Ancestors: Graphics-pre.439 Proposal: Isolate alpha channel when printing a named color. This allows it to reuse the color name even for translucent color. Example: (Color red alpha: 0.4) printString Output (new): 'Color red alpha: 0.4' Output (old): '(TranslucentColor r: 1 g: 0.0 b: 0.0 alpha: 0.4)' =============== Diff against Graphics-pre.439 =============== Item was changed: ----- Method: Color>>printOn: (in category 'printing') ----- printOn: aStream + | name | + name := self asNontranslucentColor name. + name ifNil: [^ self storeOn: aStream]. + + aStream + nextPutAll: 'Color '; + nextPutAll: name. + self isTranslucent ifTrue: [ + aStream + nextPutAll: ' alpha: '; + print: self alpha maxDecimalPlaces: 3].! - (name := self name) ifNotNil: - [^ aStream - nextPutAll: 'Color '; - nextPutAll: name]. - self storeOn: aStream. - ! |
> Proposal: Isolate alpha channel when printing a named color. This allows it to reuse the color name even for translucent color.
> > Example: > (Color red alpha: 0.4) printString > Output (new): > 'Color red alpha: 0.4' > Output (old): > '(TranslucentColor r: 1 g: 0.0 b: 0.0 alpha: 0.4)' +1 Stef |
Nice. Given that #storeOn: is used, we should take care to always wrap the result in parentheses. -> '(Color red alpha: 0.4)' Best, Marcel
|
Hm, isn't it enough to add the parentheses in the store string? (6@7) printString does not have parentheses either ...
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Donnerstag, 1. Oktober 2020 12:55:16 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: Graphics-ct.441.mcz
Nice. Given that #storeOn: is used, we should take care to always wrap the result in parentheses.
-> '(Color red alpha: 0.4)'
Best,
Marcel
Carpe Squeak!
|
Then make it at least consistent. ;-) That ifNil-case will still produce parentheses. So ... Best, Marcel
|
Free forum by Nabble | Edit this page |