## rw-pixmap-old.pkg
#
# The three kinds of X server rectangular arrays of pixels
# supported by x-kit are window, rw_pixmap and ro_pixmap.
#
# o 'window': are on-screen and on the X-server.
# o 'rw_pixmap': are off-screen and on the X-server.
# o 'ro_pixmap': offscreeen, immutable and on the X-server.
#
# These all have 'depth' (bits per pixel) and
# 'size' (in pixel rows and cols) information.
# Windows have in addition 'upperleft' position
# (relative to parent window) and border width in pixels.
#
# (A fourth kind of rectangular array of pixels is the
# client-side 'cs_pixmap_old'. These are not 'drawable', but
# pixels can be bitblt-ed between them and server-side
# windows and pixmaps.)
#
# See also:
#
src/lib/x-kit/xclient/src/window/ro-pixmap-old.pkg#
src/lib/x-kit/xclient/src/window/window-old.pkg#
src/lib/x-kit/xclient/src/window/cs-pixmap-old.pkg# Compiled by:
#
src/lib/x-kit/xclient/xclient-internals.sublibstipulate
package di = draw_imp_old; # draw_imp_old is from
src/lib/x-kit/xclient/src/window/draw-imp-old.pkg package dt = draw_types_old; # draw_types_old is from
src/lib/x-kit/xclient/src/window/draw-types-old.pkg package dy = display_old; # display_old is from
src/lib/x-kit/xclient/src/wire/display-old.pkg package g2d = geometry2d; # geometry2d is from
src/lib/std/2d/geometry2d.pkg package sn = xsession_old; # xsession_old is from
src/lib/x-kit/xclient/src/window/xsession-old.pkg package xok = xsocket_old; # xsocket_old is from
src/lib/x-kit/xclient/src/wire/xsocket-old.pkgherein
package rw_pixmap_old {
exception BAD_PIXMAP_PARAMETER;
# Create uninitialized pixel array:
#
fun make_readwrite_pixmap screen (size, depth)
=
{ screen -> { screen_info => { xscreen => { root_window_id, ... }: dy::Xscreen, ... }: sn::Screen_Info,
xsession => { xdisplay => { xsocket, next_xid, ... }: dy::Xdisplay, ... }: sn::Xsession
}: sn::Screen
;
per_depth_imps = sn::per_depth_imps_for_depth (screen, depth)
except
xgripe::XERROR _ = raise exception BAD_PIXMAP_PARAMETER;
pixmap_id = next_xid ();
if (not (g2d::valid_size size))
#
raise exception BAD_PIXMAP_PARAMETER;
fi;
xok::send_xrequest xsocket
( value_to_wire::encode_create_pixmap
{
pixmap_id,
drawable_id => root_window_id,
size,
depth
}
);
{ pixmap_id, screen, size, per_depth_imps }: dt::Rw_Pixmap;
};
# Destroy an offscreen window.
# We do this via draw_imp to avoid a race with
# any pending draw requests on the window.
#
fun destroy_rw_pixmap ({ pixmap_id, per_depth_imps => { to_screen_drawimp, ... }: sn::Per_Depth_Imps, ... }: dt::Rw_Pixmap)
=
to_screen_drawimp (di::d::DESTROY (di::i::PIXMAP pixmap_id));
}; # package pixmap
end;
## COPYRIGHT (c) 1990, 1991 by John H. Reppy. See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.