Bitmap accessing
Karl Ramberg
karl.ramberg at chello.se
Sun Jun 17 15:29:38 UTC 2001
Bob Arning wrote:
>
> Karl,
>
> Bitmaps contain 32-bit integers. If the Form is 8 or 16 bits deep, then one word in the Bitmap contains the data for 4 or 2 pixels. Accessing these pixels requires shifting and masking to get the appropriate portion of the 32-bit word.
Ok, seems to work if I change to:
1 to: largeness do:[:c| i _ bilde at: c.
oldpixel _ Color colorFromPixelValue: i depth: d.
newpixel_ oldpixel pixelValueForDepth:d.
test_ Color new pixelWordFor:d filledWith: newpixel.
pixels at: c put: test]
Karl
> On Sun, 17 Jun 2001 15:54:12 +0200 Karl Ramberg <karl.ramberg at chello.se> wrote:
> >pixels _ newImage form bits.
> >oldBits _ oldForm bits.
> >largeness _ oldBits size.
> >d _ oldForm depth.
> >1 to: largeness do:[:c| i _ oldBits at: c.
> > oldpixel _ Color colorFromPixelValue: i depth: d.
> > pixels at: c put: (oldpixel pixelValueForDepth: d)]
> >
> >It works as expected in 32 bits depth but in 16 or 8
> >bits I get vertical stripes of transparency...
> >
> >Anybody know why ?
More information about the Squeak-dev
mailing list
|