The Inbox: Graphics-ct.441.mcz

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

The Inbox: Graphics-ct.441.mcz

commits-2
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.
- !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Graphics-ct.441.mcz

Stéphane Rollandin
> 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


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Graphics-ct.441.mcz

marcel.taeumel
Nice. Given that #storeOn: is used, we should take care to always wrap the result in parentheses.

-> '(Color red alpha: 0.4)'

Best,
Marcel

Am 01.10.2020 10:51:29 schrieb Stéphane Rollandin <[hidden email]>:

> 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




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Graphics-ct.441.mcz

Christoph Thiede

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

Am 01.10.2020 10:51:29 schrieb Stéphane Rollandin <[hidden email]>:

> 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




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Graphics-ct.441.mcz

marcel.taeumel
Then make it at least consistent. ;-) That ifNil-case will still produce parentheses. So ...

Best,
Marcel

Am 01.10.2020 14:09:59 schrieb Thiede, Christoph <[hidden email]>:

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

Am 01.10.2020 10:51:29 schrieb Stéphane Rollandin <[hidden email]>:

> 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