[etoys-dev] How can I access the individual pixels in an image

Bert Freudenberg bert at freudenbergs.de
Fri May 25 15:47:10 EDT 2012

On 25.05.2012, at 21:31, Steve Thomas wrote:

> So that explains why the red, green, blue values go 0 to 100 instead of 0 to 255.

Partly. The interface is chosen to be independent of the internal representation. E.g. there are 5 or 8 bits per component in Forms, and 10 bits per component in a single Color. But externally, Squeak uses floating point values between 0 and 1 for all. For the Etoys interface, these are scaled by 100 to have an easier-to-use range.

- Bert -

> The kids will have fun with this, I am going to try and get them to create some "green screen effects" using Etoys.  I'll let everyone know how it goes and post a how on the squeakland list.
> Stpehen
> On Fri, May 25, 2012 at 2:32 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> Well, for one, all these values are fractions in the range 0 to 1.
> If you use 0 in your example, the image will become fully transparent. If you use 1, it will be fully opaque. 
> Since 16 bit forms store only 1 bit of alpha (and 5 bits each for red, green, and blue), you cannot do more than toggle that bit. 
> If you want real translucency, create newForm with 32 bits of depth instead of 16. Then each component gets full 8 bits, and e.g. using an alpha of 0.5 will make the whole image half-transparent.
> - Bert -

-------------- n?chster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20120525/fa47f5f6/attachment.html>

More information about the etoys-dev mailing list