[squeak-dev] Get raw 24 Bit image data into a Form

Yoshiki Ohshima Yoshiki.Ohshima at acm.org
Tue Sep 1 18:07:29 UTC 2015


> P.S.: This is usually the point when someone comes up with a pure bitblt
> solution providing further significant speedups.

Yeah, kind of the topic I like^^;

The following is not tested but I'm putting this out just to
illustrates the idea:

------------------------------------------------------------
f := Form extent: 1296 at 972 depth: 32.
"f will contain the resulting 32-bit form."

hDest := Form new hackBits: f bits.
"hDest is a view on the bits of f that treats the bits as 4 pixel wide
8 bit form."

alpha := Form extent: 1 at 972 depth: 8.
alpha fillColor: (Bitmap with: 16rFFFFFFFF).
"A one-pixel wide narrow bitmap of white.  You actually don't need
this and do the fill with bounding box in below, but just to show
something."

orig := ByteArray new: 300.
"Let us say this is the original byte array."
hOrig := Form extent: 3@(972*1296) depth: 8.
hOrig bits copyFromByteArray: orig.
"hOrig is 3-pixel wide form."

alpha displayOn: hDest at: 0 at 0.
hOrig displayOn: hDest at: 1 at 0.
--------------------------------------------------------------

-- 
-- Yoshiki


More information about the Squeak-dev mailing list