


## draw-types.api
#
# Types of chunks that can be drawn on (or are pixel sources).
# Compiled by:
# src/lib/x-kit/xclient/xclient-internals.sublib# This api is implemented in:
#
# src/lib/x-kit/xclient/pkg/window/draw-types.pkgstipulate
package xg = xgeometry; # xgeometry is from src/lib/std/2d/xgeometry.pkg package xt = xtypes; # xtypes is from src/lib/x-kit/xclient/pkg/wire/xtypes.pkg package sn = xsession; # xsession is from src/lib/x-kit/xclient/pkg/window/xsession.pkg package di = draw_imp; # draw_imp is from src/lib/x-kit/xclient/pkg/window/draw-imp.pkgherein
api Draw_Types {
# An on-screen rectangular array of pixels on the X server:
#
Window
=
WINDOW
{
window_id: xt::Window_Id,
#
screen: sn::Screen,
screen_pen_and_draw_imps: sn::Screen_Pen_And_Draw_Imps,
#
to_topwindow_drawimp: di::d::Draw_Op -> Void
};
# An off-screen rectangular array of pixels on the X server:
#
Rw_Pixmap
=
RW_PIXMAP
{ pixmap_id: xt::Pixmap_Id,
screen: sn::Screen,
size: xg::Size,
screen_pen_and_draw_imps: sn::Screen_Pen_And_Draw_Imps
};
# An off-screen read-only rectangular array of pixels on the X server:
#
Ro_Pixmap
=
RO_PIXMAP Rw_Pixmap;
same_window: (Window, Window ) -> Bool;
same_rw_pixmap: (Rw_Pixmap, Rw_Pixmap) -> Bool;
same_ro_pixmap: (Ro_Pixmap, Ro_Pixmap) -> Bool;
# Sources for bitblt operations
#
Draw_From
= FROM_WINDOW Window
| FROM_RW_PIXMAP Rw_Pixmap
| FROM_RO_PIXMAP Ro_Pixmap
;
depth_of_window: Window -> Int;
depth_of_rw_pixmap: Rw_Pixmap -> Int;
depth_of_ro_pixmap: Ro_Pixmap -> Int;
depth_of_draw_src: Draw_From -> Int;
id_of_window: Window -> Int;
id_of_rw_pixmap: Rw_Pixmap -> Int;
id_of_ro_pixmap: Ro_Pixmap -> Int;
shape_of_window
:
Window
->
{ upperleft: xg::Point, # Pixel location of window upper-left corner relative to parent.
size: xg::Size, # Pixel size of window.
#
depth: Int, # Pixel depth in bits.
border_thickness: Int # Window border in pixels.
};
shape_of_rw_pixmap
:
Rw_Pixmap
->
{ upperleft: xg::Point, # Present only for uniformity; these have no actual position. Always (0,0).
size: xg::Size,
#
depth: Int,
border_thickness: Int # Present only for uniformity; these have no actual border. Always 0.
};
shape_of_ro_pixmap
:
Ro_Pixmap
->
{ upperleft: xg::Point, # Present only for uniformity; these have no actual position. Always (0,0).
size: xg::Size,
#
depth: Int,
border_thickness: Int # Present only for uniformity; these have no actual border. Always 0.
};
shape_of_draw_src
:
Draw_From
->
{ upperleft: xg::Point,
size: xg::Size,
#
depth: Int,
border_thickness: Int
};
size_of_window: Window -> xg::Size;
size_of_rw_pixmap: Rw_Pixmap -> xg::Size;
size_of_ro_pixmap: Ro_Pixmap -> xg::Size;
package r: api {
#
Window_Or_Pixmap
#
= WINDOW Window
| PIXMAP Rw_Pixmap
;
};
Drawable
=
DRAWABLE
{
root: r::Window_Or_Pixmap,
to_drawimp: di::d::Draw_Op -> Void # This goes to WINDOW.to_topwindow_drawimp or PIXMAP.to_screen_drawimp.
};
drawable_of_window: Window -> Drawable;
drawable_of_rw_pixmap: Rw_Pixmap -> Drawable;
depth_of_drawable: Drawable -> Int;
make_unbuffered_drawable: Drawable -> Drawable;
#
# An unbuffered drawable is used to provide immediate
# graphical response to user interaction. (Currently
# this is implemented by transparently adding a flush
# command after each draw command.)
#
# This call is used in many of the src/lib/x-kit/tut
# programs, for an example in:
#
# src/lib/x-kit/widget/fancy/graphviz/get-mouse-selection.pkg make_locked_window: Window -> { drawable: Drawable, release: Void -> Void };
#
# Create a locked version of the given window.
# This provides exclusive access to its drawing
# surface (and that of its descendents) during
# OP_XOR rubber-banding. Usually used in conjunction
# with unbuffered drawing (below).
#
# The first result is the locked window on which to draw,
# the second is the unlock operation for the drawable.
# By convention, the overlay drawable is unbuffered.
#
# This call appears to be unused at present, but see
# much related-looking "overlay" code in
# src/lib/x-kit/xclient/pkg/window/draw-imp.pkg # this may be a half-implemented idea.
flush_drawimp: (di::d::Draw_Op -> Void) -> Void;
#
# This is a lower-level version of flush from
# src/lib/x-kit/xclient/xclient.api # which is used in
# src/lib/x-kit/xclient/pkg/window/draw.pkg # src/lib/x-kit/xclient/pkg/window/cs-pixmap.pkg drawimp_thread_id_of: (di::d::Draw_Op -> Void) -> Int;
#
# This is a lower-level version of drawimp_thread_id_of from
# src/lib/x-kit/xclient/xclient.api };
end;
## COPYRIGHT (c) 1990, 1991 by John H. Reppy. See COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


