[Pkg] The Trunk: MorphicExtras-nice.153.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 22 21:48:17 UTC 2014


Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-nice.153.mcz

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

Name: MorphicExtras-nice.153
Author: nice
Time: 22 July 2014, 11:47:16.784 pm
UUID: 411a90c9-8122-4287-b19a-3498e2d264cd
Ancestors: MorphicExtras-nice.152

RWStream shoot them up part 2:
How to write an EPS preview using a WriteStream.

=============== Diff against MorphicExtras-nice.152 ===============

Item was changed:
  ----- Method: EPSCanvas>>writeEPSPreviewImageFor: (in category 'private') -----
  writeEPSPreviewImageFor: aMorph
+ 	| form stream string newExtent |
- 	| form stream string lines newExtent |
  	newExtent := (aMorph width roundUpTo: 8) @ aMorph height.
  	form := aMorph imageForm: 1 forRectangle: (aMorph bounds origin extent: newExtent).
+ 	stream := WriteStream on: (String new: (form bits byteSize * 2.04) asInteger).
- 	stream := RWBinaryOrTextStream on: (String new: (form bits byteSize * 2.04) asInteger).
  	form storePostscriptHexOn: stream.
  	string := stream contents.
- 	lines := string occurrencesOf: Character cr.
  
  	"%%BeginPreview: 80 24 1 24"
  	"width height depth "
+ 	target print: '%%BeginPreview: '; write:  newExtent; space; write: form depth; space; write: string lineCount; cr.
- 	target print: '%%BeginPreview: '; write:  newExtent; space; write: form depth; space; write: lines; cr.
  
+ 	string linesDo: [:e | target nextPut: $%; nextPutAll: e; cr.].
- 	stream position: 0.
- 	[ stream atEnd ] whileFalse: [
- 		target nextPut: $%; nextPutAll: (stream upTo: Character cr); cr.
- 		lines := lines - 1.
- 	].
  
  	target print: '%%EndPreview'; cr.
  
  !



More information about the Packages mailing list