% Copyright Barbara Liskov 1985, 1986 x_bitmap = cluster is none, create, screate, destroy, c2b, get_id, equal, similar, copy rep = int none = proc () returns (cvt) return(0) end none create = proc (width, height: int, bits: _wordvec) returns (cvt) signals (error(string)) x_buf$setup(x_storebitmap, 0, 0, 0) x_buf$set_s01(height, width) x_buf$send_data(w2b(bits), 1, ((width + 15) / 16) * height * 2) x_buf$receive() resignal error return(x_buf$get_lp0()) end create screate = proc (width, height: int, bits: string) returns (x_bitmap) signals (error(string)) bts: _bytevec := _bytevec$create(string$size(bits)) for i: int in int$from_to_by(1, string$size(bits), 2) do bts[i] := bits[i + 1] bts[i + 1] := bits[i] end return(create(width, height, b2w(bts))) resignal error end screate destroy = proc (bit: cvt) x_buf$setup(x_freebitmap, 0, 0, 0) x_buf$set_l0(bit) end destroy c2b = proc (font: x_font, c: char) returns (cvt) signals (error(string)) x_buf$setup(x_charbitmap, 0, 0, 0) x_buf$set_l0s23(f2i(font), char$c2i(c), 0) x_buf$receive() resignal error return(x_buf$get_lp0()) end c2b get_id = proc (bit: cvt) returns (int) return(bit) end get_id equal = proc (bit1, bit2: cvt) returns (bool) return(bit1 = bit2) end equal similar = proc (bit1, bit2: cvt) returns (bool) return(bit1 = bit2) end similar copy = proc (bit: cvt) returns (cvt) return(bit) end copy end x_bitmap