Alpha transparence support in PNG
karl
karl.ramberg at chello.se
Sat Nov 26 23:46:45 UTC 2005
karl wrote:
> karl wrote:
>
>> karl wrote:
>>
>>> Hilaire Fernandes wrote:
>>>
>>>> Any hope to see alpha transparence support in PNG ?
>>>
>>>
>>>
>>>
>>> I don't think Squeak has anything but transparency of forms, I think
>>> what you ask for
>>> is translucency. And I think translucency of forms would be great to
>>> have. I suspect it
>>> has to be implemented in some plugins eg. BitBlt.
>>> I think this is related to the issues with anti-aliased fonts as
>>> well, but I'm maybe
>>> misunderstanding the issues...
>>> Karl
>>
>>
>>
>> Duh, just have to do what Bert says. I was wrong.
>> But there is still a issue when you rotate the form.
>> Karl
>>
> I think this attached change fixes form translucency when rotated.
> Not sure what it breakes though...
> Karl
Added a check to see if the source is of depth 32
Karl
-------------- next part --------------
'From Squeak3.9alpha of 4 July 2005 [latest update: #6702] on 27 November 2005 at 12:41:12 am'!
!FormCanvas methodsFor: 'drawing-support' stamp: 'kfr 11/26/2005 13:20'!
transformBy: aDisplayTransform clippingTo: aClipRect during: aBlock smoothing: cellSize
"Note: This method has been originally copied from TransformationMorph."
| innerRect patchRect sourceQuad warp start subCanvas |
(aDisplayTransform isPureTranslation) ifTrue:[
^aBlock value: (self copyOffset: aDisplayTransform offset negated truncated
clipRect: aClipRect)
].
"Prepare an appropriate warp from patch to innerRect"
innerRect _ aClipRect.
patchRect _ (aDisplayTransform globalBoundsToLocal: innerRect) truncated.
sourceQuad _ (aDisplayTransform sourceQuadFor: innerRect)
collect: [:p | p - patchRect topLeft].
warp _ self warpFrom: sourceQuad toRect: innerRect.
warp cellSize: cellSize.
"Render the submorphs visible in the clipping rectangle, as patchForm"
start _ (self depth = 1 and: [self isShadowDrawing not])
"If this is true B&W, then we need a first pass for erasure."
ifTrue: [1] ifFalse: [2].
start to: 2 do:
[:i | "If i=1 we first make a shadow and erase it for opaque whites in B&W"
subCanvas _ self class extent: patchRect extent depth: self depth.
i=1 ifTrue: [subCanvas shadowColor: Color black.
warp combinationRule: Form erase]
ifFalse: [self isShadowDrawing ifTrue:
[subCanvas shadowColor: self shadowColor].
(self depth = 32) ifTrue:[warp combinationRule: Form blend]
ifFalse:[warp combinationRule: Form paint]].
subCanvas translateBy: patchRect topLeft negated
during:[:offsetCanvas| aBlock value: offsetCanvas].
warp sourceForm: subCanvas form; warpBits.
warp sourceForm: nil. subCanvas _ nil "release space for next loop"]
! !
More information about the Squeak-dev
mailing list
|