Nicolas Cellier uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-nice.540.mcz
==================== Summary ====================
Name: Graphics-nice.540 Author: nice Time: 27 February 2023, 11:08:20.503071 pm UUID: 3ed34a8a-0e5a-9044-a70b-de82186f7a48 Ancestors: Graphics-nice.539
Fix load of interlaced PNG again :
we must use rule 31 (Form paintAlpha) which does the right thing: - use destinationPixel when sourcePixel is zero - else use sourcePixel
This is because the default constant sourceAlpha used for blending is 255, and rule 31 perform this pseudo code for each A,R,G,B channel:
(sourceChannel * sourceAlpha) + (destinationChannel * (255 - sourceAlpha)) / 255
which is = sourceChannel.
=============== Diff against Graphics-nice.539 ===============
Item was changed: ----- Method: PNGReadWriter>>copyPixelsRGB:at:by: (in category 'pixel copies') ----- copyPixelsRGB: y at: startX by: incX "Handle interlaced RGB color mode (colorType = 2)"
| i pixel tempForm tempBits xx loopsToDo |
tempForm := Form extent: width@1 depth: 32. tempBits := tempForm bits. pixel := LargePositiveInteger new: 4. pixel at: 4 put: 16rFF. loopsToDo := width - startX + incX - 1 // incX. bitsPerChannel = 8 ifTrue: [i := (startX // incX * 3) + 1. xx := startX+1. 1 to: loopsToDo do: [ :j | pixel at: 3 put: (thisScanline at: i); at: 2 put: (thisScanline at: i+1); at: 1 put: (thisScanline at: i+2). tempBits at: xx put: pixel normalize. i := i + 3. xx := xx + incX]. transparentPixelValue ifNotNil: [startX to: width-1 by: incX do: [ :x | (tempBits at: x+1) = transparentPixelValue ifTrue: [ tempBits at: x+1 put: 0]]]] ifFalse: [i := (startX // incX * 6) + 1. xx := startX+1. 1 to: loopsToDo do: [ :j | (transparentPixelValue == nil or: [(1 to: 6) anySatisfy: [:k | (transparentPixelValue digitAt: k) ~= (thisScanline at: i + 6 - k)]]) ifTrue: [pixel at: 3 put: (thisScanline at: i); at: 2 put: (thisScanline at: i+2); at: 1 put: (thisScanline at: i+4). tempBits at: xx put: pixel normalize.] ifFalse: [tempBits at: xx put: 0]. i := i + 6. xx := xx + incX]]. + tempForm displayOn: form at: 0@y rule: Form paintAlpha - tempForm displayOn: form at: 0@y rule: Form blendAlphaUnscaled
!
Item was changed: ----- Method: PNGReadWriter>>copyPixelsRGBA:at:by: (in category 'pixel copies') ----- copyPixelsRGBA: y at: startX by: incX "Handle interlaced RGBA color modes (colorType = 6)"
| i pixel tempForm tempBits |
tempForm := Form extent: width@1 depth: 32. tempBits := tempForm bits. pixel := LargePositiveInteger new: 4. bitsPerChannel = 8 ifTrue: [ i := (startX // incX << 2) + 1. startX to: width-1 by: incX do: [ :x | pixel at: 4 put: (thisScanline at: i+3); at: 3 put: (thisScanline at: i); at: 2 put: (thisScanline at: i+1); at: 1 put: (thisScanline at: i+2). tempBits at: x+1 put: pixel normalize. i := i + 4. ] ] ifFalse: [ i := (startX // incX << 3) +1. startX to: width-1 by: incX do: [ :x | pixel at: 4 put: (thisScanline at: i+6); at: 3 put: (thisScanline at: i); at: 2 put: (thisScanline at: i+2); at: 1 put: (thisScanline at: i+4). tempBits at: x+1 put: pixel normalize. i := i + 8. ]. ]. + tempForm displayOn: form at: 0@y rule: Form paintAlpha. - tempForm displayOn: form at: 0@y rule: Form blendAlphaScaled.
!
packages@lists.squeakfoundation.org