Squeak Class Documentation category index | class index  
 
Bitmap
  category: Graphics-Primitives
  superclass: ArrayedCollection
  subclasses:

My instances provide contiguous storage of bits, primarily to hold the graphical data of Forms. Forms and their subclasses provide the additional structural information as to how the bits should be interpreted in two dimensions.

instance methods
  accessing
  atAllPut:
bitPatternForDepth:
byteAt:
byteAt:put:
byteSize
copyFromByteArray:
defaultElement
integerAt:
integerAt:put:
pixelValueForDepth:
primFill:
replaceFrom:to:with:startingAt:

  as yet unclassified
  copy

  filing
  compress:toByteArray:
compressGZip
compressToByteArray
decompress:fromByteArray:at:
encodeBytesOf:in:at:
encodeInt:
encodeInt:in:at:
readCompressedFrom:
restoreEndianness
storeBits:to:on:
writeOn:
writeUncompressedOn:

  initialize-release
  fromByteStream:

  printing
  printOn:
printOnStream:

  testing
  isColormap

class methods
  instance creation
  decodeIntFrom:
decompressFromByteArray:
newFromStream:

instance methods
  accessing top  
 

atAllPut:

Fill the receiver, an indexable bytes or words object, with the given positive integer. The range of possible fill values is [0..255] for byte arrays and [0..(2^32 - 1)] for word arrays.


 

bitPatternForDepth:

The raw call on BitBlt needs a Bitmap to represent this color. I already am Bitmap like. I am already adjusted for a specific depth. Interpret me as an array of (32/depth) Color pixelValues. BitBlt aligns the first element of this array with the top scanline of the destinationForm, the second with the second, and so on, cycling through the color array as necessary. 6/18/96 tk


 

byteAt:

Extract a byte from a Bitmap. Note that this is a byte address and it is one-order. For repeated use, create an instance of BitBlt and use pixelAt:. See Form pixelAt: 7/1/96 tk


 

byteAt:put:

Insert a byte into a Bitmap. Note that this is a byte address and it is one-order. For repeated use, create an instance of BitBlt and use pixelAt:put:. See Form pixelAt:put: 7/1/96 tk


 

byteSize


 

copyFromByteArray:

This method should work with either byte orderings


 

defaultElement

Return the default element of the receiver


 

integerAt:

Return the integer at the given index


 

integerAt:put:

Store the integer at the given index


 

pixelValueForDepth:

Self is being used to represent a single color. Answer bits that appear in ONE pixel of this color in a Bitmap of the given depth. The depth must be one of 1, 2, 4, 8, 16, or 32. Returns an integer. First pixel only.


 

primFill:

Fill the receiver, an indexable bytes or words object, with the given positive integer. The range of possible fill values is [0..255] for byte arrays and [0..(2^32 - 1)] for word arrays.


 

replaceFrom:to:with:startingAt:

Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.


  as yet unclassified top  
 

copy

Answer another instance just like the receiver. Subclasses typically
override this method; they typically do not override shallowCopy.


  filing top  
 

compress:toByteArray:

Store a run-coded compression of the receiver into the byteArray ba,
and return the last index stored into. ba is assumed to be large enough.
The encoding is as follows...
S {N D}*.
S is the size of the original bitmap, followed by run-coded pairs.
N is a run-length * 4 + data code.
D, the data, depends on the data code...
0 skip N words, D is absent
1 N words with all 4 bytes = D (1 byte)
2 N words all = D (4 bytes)
3 N words follow in D (4N bytes)
S and N are encoded as follows...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes


 

compressGZip

just hacking around to see if further compression would help Nebraska


 

compressToByteArray

Return a run-coded compression of this bitmap into a byteArray


 

decompress:fromByteArray:at:

Decompress the body of a byteArray encoded by compressToByteArray (qv)...
The format is simply a sequence of run-coded pairs, {N D}*.
N is a run-length * 4 + data code.
D, the data, depends on the data code...
0 skip N words, D is absent
(could be used to skip from one raster line to the next)
1 N words with all 4 bytes = D (1 byte)
2 N words all = D (4 bytes)
3 N words follow in D (4N bytes)
S and N are encoded as follows (see decodeIntFrom:)...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes


 

encodeBytesOf:in:at:

Copy the integer anInt into byteArray ba at index i, and return the next index


 

encodeInt:

Encode the integer int as per encodeInt:in:at:, and return it as a ByteArray


 

encodeInt:in:at:

Encode the integer anInt in byteArray ba at index i, and return the next index.
The encoding is as follows...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes


 

readCompressedFrom:

Decompress an old-style run-coded stream into this bitmap:
[0 means end of runs]
[n = 1..127] [(n+3) copies of next byte]
[n = 128..191] [(n-127) next bytes as is]
[n = 192..255] [(n-190) copies of next 4 bytes]


 

restoreEndianness

This word object was just read in from a stream. Bitmaps are always compressed and serialized in a machine-independent way. Do not correct the Endianness.


 

storeBits:to:on:


 

writeOn:

Store the array of bits onto the argument, aStream. A leading byte of 16r80 identifies this as compressed by compressToByteArray (qv).


 

writeUncompressedOn:

Store the array of bits onto the argument, aStream.
(leading byte ~= 16r80) identifies this as raw bits (uncompressed).


  initialize-release top  
 

fromByteStream:

Initialize the array of bits by reading integers from the argument,
aStream.


  printing top  
 

printOn:

Append a sequence of characters that identify the receiver to aStream.


 

printOnStream:


  testing top  
 

isColormap

Bitmaps were used as color maps for BitBlt.
This method allows to recognize real color maps.


class methods
  instance creation top  
 

decodeIntFrom:

Decode an integer in stream s as follows...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes


 

decompressFromByteArray:


 

newFromStream:

Only meant for my subclasses that are raw bits and word-like. For quick unpack form the disk.