File:  [CSRG BSD Unix] / 43BSDTahoe / new / X / CLUlib / sun / x_pixmap.clu
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

% Copyright    Barbara Liskov    1985, 1986

x_pixmap = cluster is none, create, create_xy, create_z, tile, destroy, shape,
		      get_id, equal, similar, copy

rep = int

none = proc () returns (cvt)
    return(0)
    end none

create = proc (mask: x_bitmap, fore, back: int) returns (cvt)
	   signals (error(string))
    x_buf$setup(x_makepixmap, 0, 0, 0)
    x_buf$set_l0s23(b2i(mask), fore, back)
    x_buf$receive()
       resignal error
    return(x_buf$get_lp0())
    end create

create_xy = proc (width, height: int, bits: _wordvec) returns (cvt)
	      signals (error(string))
    x_buf$setup(x_storepixmap, XYFormat, 0, 0)
    x_buf$set_s01(height, width)
    x_buf$send_data(w2b(bits), 1,
		    ((width + 15) / 16) * height * 2 * x_display$planes())
    x_buf$receive()
       resignal error
    return(x_buf$get_lp0())
    end create_xy

create_z = proc (width, height: int, bits: _wordvec) returns (cvt)
	     signals (error(string))
    x_buf$setup(x_storepixmap, ZFormat, 0, 0)
    x_buf$set_s01(height, width)
    z: int := width * height
    if x_display$planes() > 8
       then z := z + z end
    x_buf$send_data(w2b(bits), 1, z)
    x_buf$receive()
       resignal error
    return(x_buf$get_lp0())
    end create_z

tile = proc (pixel: int) returns (cvt) signals (error(string))
    x_buf$setup(x_makepixmap, 0, 0, 0)
    x_buf$set_l0s23(0, pixel, 0)
    x_buf$receive()
       resignal error
    return(x_buf$get_lp0())
    end tile

destroy = proc (pix: cvt)
    x_buf$setup(x_freepixmap, 0, 0, 0)
    x_buf$set_l0(pix)
    end destroy

shape = proc (width, height: int) returns (int, int) signals (error(string))
    x_buf$setup(x_queryshape, TileShape, 0, 0)
    x_buf$set_s01(height, width)
    x_buf$receive()
       resignal error
    return(x_buf$get_sp1(), x_buf$get_sp0())
    end shape

get_id = proc (pix: cvt) returns (int)
    return(pix)
    end get_id

equal = proc (pix1, pix2: cvt) returns (bool)
    return(pix1 = pix2)
    end equal

similar = proc (pix1, pix2: cvt) returns (bool)
    return(pix1 = pix2)
    end similar

copy = proc (pix: cvt) returns (cvt)
    return(pix)
    end copy

end x_pixmap

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.