[squeak-dev] The Trunk: Graphics-bf.193.mcz

commits at source.squeak.org commits at source.squeak.org
Wed May 16 16:54:21 UTC 2012


Bert Freudenberg uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-bf.193.mcz

==================== Summary ====================

Name: Graphics-bf.193
Author: bf
Time: 16 May 2012, 6:53:27.508 pm
UUID: bf545fb0-10bc-4960-b255-cdd1fdb2e27b
Ancestors: Graphics-nice.192

Fix Color printing to show at most 3 decimal places

=============== Diff against Graphics-nice.192 ===============

Item was changed:
  ----- Method: Color>>shortPrintString (in category 'printing') -----
  shortPrintString
  	"Return a short (but less precise) print string for use where space is tight."
  
+ 	^String streamContents: [:s | s
+ 		nextPutAll: '(';
+ 		print: self class;
+ 		nextPutAll: ' r: '; print: self red maxDecimalPlaces: 2;
+ 		nextPutAll: ' g: '; print: self green maxDecimalPlaces: 2;
+ 		nextPutAll: ' b: '; print: self blue maxDecimalPlaces: 2;
+ 		nextPutAll: ')']!
- 	| s |
- 	s := WriteStream on: ''.
- 	s
- 		nextPutAll: '(' , self class name;
- 		nextPutAll: ' r: ';
- 		nextPutAll: (self red roundTo: 0.01) printString;
- 		nextPutAll: ' g: ';
- 		nextPutAll: (self green roundTo: 0.01) printString;
- 		nextPutAll: ' b: ';
- 		nextPutAll: (self blue roundTo: 0.01) printString;
- 		nextPutAll: ')'.
- 	^ s contents
- !

Item was changed:
  ----- Method: Color>>storeArrayValuesOn: (in category 'printing') -----
  storeArrayValuesOn: aStream
  
+ 	aStream
+ 		print: self red maxDecimalPlaces: 3;
+ 		space;
+ 		print: self green maxDecimalPlaces: 3;
+ 		space;
+ 		print: self blue maxDecimalPlaces: 3.
- 	(self red roundTo: 0.001) storeOn: aStream.
- 	aStream space.
- 	(self green roundTo: 0.001) storeOn: aStream.
- 	aStream space.
- 	(self blue roundTo: 0.001) storeOn: aStream.
- 
  !

Item was changed:
  ----- Method: Color>>storeOn: (in category 'printing') -----
  storeOn: aStream
  
  	aStream
  		nextPutAll: '(' , self species name;
+ 		nextPutAll: ' r: '; print: self red maxDecimalPlaces: 3;
+ 		nextPutAll: ' g: '; print: self green maxDecimalPlaces: 3;
+ 		nextPutAll: ' b: '; print: self blue maxDecimalPlaces: 3;
- 		nextPutAll: ' r: '; print: (self red roundTo: 0.001);
- 		nextPutAll: ' g: '; print: (self green roundTo: 0.001);
- 		nextPutAll: ' b: '; print: (self blue roundTo: 0.001);
  		nextPutAll: ')'.
  !

Item was changed:
  ----- Method: TranslucentColor>>storeOn: (in category 'printing') -----
  storeOn: aStream
  
  	self isTransparent ifTrue: [^ aStream nextPutAll: '(Color transparent)'].
  	super storeOn: aStream.
  	aStream
  		skip: -1;	  "get rid of trailing )"
  		nextPutAll: ' alpha: ';
+ 		print: self alpha maxDecimalPlaces: 3;
- 		print: (self alpha roundTo: 0.001);
  		nextPutAll: ')'.
  !



More information about the Squeak-dev mailing list