[squeak-dev] The Trunk: Nebraska-nice.37.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 22 22:03:30 UTC 2014


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

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

Name: Nebraska-nice.37
Author: nice
Time: 23 July 2014, 12:03:09.798 am
UUID: cd1e75c9-63de-4f9c-80b2-d4928cf48bff
Ancestors: Nebraska-nice.36

RWStream shoot them up part 3.
How to decodeImage: without a RWBinaryOrTextStream.
(Let's not summon the devil when we don't need his superpowers).

=============== Diff against Nebraska-nice.36 ===============

Item was changed:
  ----- Method: CanvasDecoder class>>decodeImage: (in category 'decoding') -----
  decodeImage: string
  	| bitsStart depth width height bits rs numColors colorArray |
  
  	bitsStart := string indexOf: $|.
  	bitsStart = 0 ifTrue: [^nil].
  	rs := ReadStream on: string.
  	rs peek == $C ifTrue: [
  		rs next.
  		numColors := Integer readFromString: (rs upTo: $,).
  		colorArray := Array new: numColors.
  		1 to: numColors do: [ :i |
  			colorArray at: i put: (self decodeColor: (rs next: 12))
  		].
  	].
  	depth := Integer readFromString: (rs upTo: $,).
  	width :=  Integer readFromString: (rs upTo: $,).
  	height :=  Integer readFromString: (rs upTo: $|).
  
+ 	bits := Bitmap newFromStream: rs upToEnd asByteArray readStream.
- 	bits := Bitmap newFromStream: (RWBinaryOrTextStream with: rs upToEnd) binary reset.
  
  	colorArray ifNil: [
  		^Form extent: width at height depth: depth bits: bits
  	].
  	^(ColorForm extent: width at height depth: depth bits: bits)
  		colors: colorArray
  !



More information about the Squeak-dev mailing list