[squeak-dev] Color black vs. Color transparent

marcel.taeumel Marcel.Taeumel at hpi.de
Tue Aug 2 13:56:32 UTC 2016


Hi, there.

In Color class >> colorFromPixelValue:depth: we have:

...
d = 32 ifTrue: [
		"eight bits per component; 8 bits of alpha"
		r := (p bitShift: -16) bitAnd: 16rFF.
		g := (p bitShift: -8) bitAnd: 16rFF.
		b := p bitAnd: 16rFF.
		alpha := p bitShift: -24.
		alpha = 0 ifTrue: [^Color transparent].
		(r = 0 and: [g = 0 and: [b = 0]])  ifTrue: [^Color transparent].
		alpha < 255
			ifTrue: [^ (Color r: r g: g b: b range: 255) alpha: (alpha asFloat /
255.0)]
			ifFalse: [^ (Color r: r g: g b: b range: 255)]].
...

This denotes black to transparent. Is this still right?

I have here a form that renders right but after collecting the colors, all
is transparent:

 '(Form
	extent: 16 at 16
	depth: 32
	fromArray: #( 1526726656 2566914048 2566914048 2566914048 2566914048
2566914048 2566914048 2566914048 2566914048 2566914048 2566914048 2566914048
2566914048 2566914048 2566914048 1526726656 2281701376 0 0 0 0 0 0 0 0 0 0 0
0 0 0 2281701376 2281701376 0 3238002688 2281701376 2264924160 268435456 0 0
0 0 285212672 2264924160 2281701376 3238002688 0 2281701376 2281701376 0
2281701376 0 0 0 0 0 0 0 0 0 0 2281701376 0 2281701376 2281701376 0
2281701376 0 0 0 0 0 0 0 0 0 0 2281701376 0 2281701376 2281701376 0
234881024 0 0 0 0 0 0 0 0 0 0 234881024 0 2281701376 2281701376 0 0 0 0 0 0
0 0 0 0 0 0 0 0 2281701376 2281701376 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2281701376
2281701376 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2281701376 2281701376 0 0 0 0 0 0 0 0
0 0 0 0 0 0 2281701376 2281701376 0 234881024 0 0 0 0 0 0 0 0 0 0 234881024
0 2281701376 2281701376 0 2281701376 0 0 0 0 0 0 0 0 0 0 2281701376 0
2281701376 2281701376 0 2281701376 0 0 0 0 0 0 0 0 0 0 2281701376 0
2281701376 2281701376 0 3271557120 2281701376 2264924160 268435456 0 0 0 0
285212672 2264924160 2281701376 3271557120 0 2281701376 2281701376 0 0 0 0 0
0 0 0 0 0 0 0 0 0 2281701376 1459617792 2566914048 2566914048 2566914048
2566914048 2566914048 2566914048 2566914048 2566914048 2566914048 2566914048
2566914048 2566914048 2566914048 2566914048 1442840576)
	offset: 0 at 0)'

And after "form collectColors: [:ea | ea]" if get this:

 '(Form
	extent: 16 at 16
	depth: 32
	fromArray: #( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
	offset: 0 at 0)'

:-(

Best,
Marcel



--
View this message in context: http://forum.world.st/Color-black-vs-Color-transparent-tp4909167.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list