Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.293.mcz ==================== Summary ==================== Name: Graphics-nice.293 Author: nice Time: 17 May 2014, 10:49:09.105 pm UUID: adb6fa29-fffc-4ec4-ab16-77ff98702aca Ancestors: Graphics-nice.292 Merge Graphics-jdr.177 rotting in inbox since 21 January 2011: added pgm extension. While at it, simplify cleanLine (it can now answer nil, but sole sender is protected). =============== Diff against Graphics-nice.292 =============== Item was changed: ----- Method: PNMReadWriter class>>typicalFileExtensions (in category 'image reading/writing') ----- typicalFileExtensions "Answer a collection of file extensions (lowercase) which files that I can read might commonly have" + ^#('pbm' 'pgm' 'pnm' 'ppm' 'pam')! - ^#('pbm' 'pnm' 'ppm' 'pam')! Item was changed: ----- Method: PNMReadWriter>>cleanLine (in category 'reading') ----- cleanLine "upTo LF or CR, tab as space" + ^stream nextLine ifNotNil: [:line | line replaceAll: Character tab with: Character space]! - | line loop b | - line := WriteStream with: ''. - loop := true. - [loop] whileTrue: [ - b := stream next. - b ifNil:[ - loop := false "EOS" - ] - ifNotNil: [ - (b = (Character cr) or:[b = Character lf]) ifTrue:[ - loop := false. - ] - ifFalse:[ - b = (Character tab) ifTrue:[b := Character space]. - line nextPut: b. - ] - ] - ]. - ^line contents! |
Note that Graphics-jdr.176 also contained a fix for Form>>asGrayScale because current version does not correctly preserve transparency. The proposed fix did not seem to preserve it better, thus I placed th mcz in treated inbox.2014-05-17 22:49 GMT+02:00 <[hidden email]>: Nicolas Cellier uploaded a new version of Graphics to project The Trunk: |
On 17/05/2014, at 16:49, Nicolas Cellier <[hidden email]> wrote:
> Note that Graphics-jdr.176 also contained a fix for Form>>asGrayScale because current version does not correctly preserve transparency. > The proposed fix did not seem to preserve it better, thus I placed th mcz in treated inbox. > Wow, that was 2 years ago I barely remember, but the bug exists. Is about a PNG with 8 bits, like this: if you enter in a workspace: form1 := (ImageReadWriter formFromFileNamed: 'rojo.png'). g := form1 asGrayScale. (SketchMorph withForm: g) openInWorld. you obtain a morph with a white background, with my modification the background is transparent. I only have a problem with this, the original method was from Andreas Rabb and (of course) is faster. rojo.png.zip (17K) Download Attachment |
Free forum by Nabble | Edit this page |