[squeak-dev] PNG export problem
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Fri Apr 29 06:55:29 UTC 2011
Anyway, it's an old and known bug with known workaround,
see senders of #fixAlpha
Nicolas
2011/4/29 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
> In other words, this has nothing to do with PNG
>
> This one seems to work OK:
> ((TextStyle defaultFont characterFormAt: $T) magnifyBy: 16) asMorph openInWorld
>
> This one is transparent:
> ((TextStyle defaultFont characterFormAt: $T) magnifyBy: 16) asMorph
> imageForm asMorph openInWorld
>
> Nicolas
>
> 2011/4/29 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
>> 2011/4/29 Juan Vuletich <juan at jvuletich.org>:
>>> Nicolas Cellier wrote:
>>>>
>>>> This code seems to work:
>>>> PNGReadWriter
>>>> putForm: ((TextStyle defaultFont characterFormAt: $T) magnifyBy:
>>>> 16)
>>>> onFileNamed: 'T1.png'.
>>>>
>>>> This one produces a fully transparent image (at least in mac finder
>>>> and firefox renderers):
>>>> PNGReadWriter
>>>> putForm: ((TextStyle defaultFont characterFormAt: $T)
>>>> magnifyBy: 16) asMorph imageForm
>>>> onFileNamed: 'T2.png'.
>>>>
>>>> Though a FileList is able to display a preview of the image for both
>>>> files,
>>>> importing with:
>>>> Form openImageInWindow: (FileDirectory default / 'T2.png') fullName.
>>>> just leave a transparent image in upper corner...
>>>>
>>>> While
>>>> Form openImageInWindow: (FileDirectory default / 'T1.png') fullName.
>>>> works as expected...
>>>>
>>>> Any clue ?
>>>>
>>>> Nicolas
>>>>
>>>
>>> Hi Nicolas,
>>>
>>> It is a bug in BitBlt. For instance:
>>>
>>> | f f2 blt sourceDepth |
>>> sourceDepth := 16.
>>> f := Form extent: 16 at 16 depth: sourceDepth.
>>> f fillWhite.
>>> f2 := Form extent: 16 at 16 depth: 32.
>>> f2 fillColor: Color blue.
>>> blt := BitBlt new.
>>> blt setDestForm: f2 sourceForm: f fillColor: nil combinationRule: Form
>>> paint destOrigin: 0 at 0 sourceOrigin: 0 at 0 extent: 16 at 16 clipRect: f
>>> boundingBox.
>>> blt copyBits.
>>> f2 colorAt: 0 at 0
>>>
>>> prints 'Color transparent' if sourceDepth = 16, but 'Color white' if
>>> sourceDepth = 32.
>>>
>>> The problem seems to be in BitBltSimulation>>#rgbMapPixel:flags:, if I
>>> replace the last line with
>>>
>>> val :=val bitOr: ((255) bitShift: (24)).
>>> ^val
>>>
>>> and call #copyBitsSimulated (with VMMaker loaded) It seems to work ok. This
>>> is just a hack for testing, as it doesn't take into account actual source
>>> and destination depths...
>>>
>>> Cheers,
>>> Juan Vuletich
>>>
>>>
>>
>> Hi Juan,
>> this was hard to understand because I didn't noticed that imageFrom
>> was doing the 16bits -> 32bits copy...
>> But now I get it, thanks.
>>
>> Nicolas
>>
>
More information about the Squeak-dev
mailing list
|