PreviousUpNext

15.3.762  src/lib/x-kit/xclient/src/window/draw-types.api

## 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/src/window/draw-types.pkg

stipulate
    package g2d =  geometry2d;                                                          # geometry2d                    is from   src/lib/std/2d/geometry2d.pkg
    package xt  =  xtypes;                                                              # xtypes                        is from   src/lib/x-kit/xclient/src/wire/xtypes.pkg
    package sn  =  xsession_junk;                                                       # xsession_junk                 is from   src/lib/x-kit/xclient/src/window/xsession-junk.pkg
    package di  =  xserver_ximp;                                                        # xserver_ximp                  is from   src/lib/x-kit/xclient/src/window/xserver-ximp.pkg
    package w2x =  windowsystem_to_xserver;                                             # windowsystem_to_xserver       is from   src/lib/x-kit/xclient/src/window/windowsystem-to-xserver.pkg
herein

    api Draw_Types {
        #
#       Window =                                                                        # An on-screen rectangular array of pixels on the X server.
#                         {
#                           window_id:                  xt::Window_Id,
#                           #
#                           screen:                     sn::Screen,
#                           per_depth_imps:             sn::Per_Depth_Imps,
#                           #
#                           windowsystem_to_xserver:    w2x::Windowsystem_To_Xserver
#                         };

#       Rw_Pixmap =       {                                                             # An off-screen rectangular array of pixels on the X server.
#                           pixmap_id:                  xt::Pixmap_Id,
#                           screen:                     sn::Screen,
#                           size:                       g2d::Size,
#                           per_depth_imps:             sn::Per_Depth_Imps
#                         };
#
#       Ro_Pixmap =  RO_PIXMAP  Rw_Pixmap;                                              # An off-screen read-only rectangular array of pixels on the X server.

        same_window:    (sn::Window,    sn::Window   ) -> Bool;
        same_rw_pixmap: (sn::Rw_Pixmap, sn::Rw_Pixmap) -> Bool;
        same_ro_pixmap: (sn::Ro_Pixmap, sn::Ro_Pixmap) -> Bool;

        # Sources for bitblt operations 
        #
        Draw_From
          = FROM_WINDOW     sn::Window
          | FROM_RW_PIXMAP  sn::Rw_Pixmap
          | FROM_RO_PIXMAP  sn::Ro_Pixmap
          ;

        depth_of_window:    sn::Window    -> Int;
        depth_of_rw_pixmap: sn::Rw_Pixmap -> Int;
        depth_of_ro_pixmap: sn::Ro_Pixmap -> Int;
        depth_of_draw_src:      Draw_From -> Int;

        id_of_window:    sn::Window    -> Int;
        id_of_rw_pixmap: sn::Rw_Pixmap -> Int;
        id_of_ro_pixmap: sn::Ro_Pixmap -> Int;

        shape_of_window
            :
            sn::Window
            ->
            { upperleft:        g2d::Point,             # Pixel location of window upper-left corner relative to parent.
              size:             g2d::Size,              # Pixel size of window. 
              #
              depth:            Int,                    # Pixel depth in bits.
              border_thickness: Int                     # Window border in pixels.
            };

        shape_of_rw_pixmap
            :
            sn::Rw_Pixmap
            ->
            { upperleft:     g2d::Point,                        # Present only for uniformity;  these have no actual position.  Always (0,0).
              size:          g2d::Size,
              #
              depth:         Int,
              border_thickness:  Int                    # Present only for uniformity;  these have no actual border.    Always 0.
            };

        shape_of_ro_pixmap
            :
            sn::Ro_Pixmap
            ->
            { upperleft:        g2d::Point,             # Present only for uniformity;  these have no actual position.  Always (0,0).
              size:             g2d::Size,
              #
              depth:            Int,
              border_thickness: Int                     # Present only for uniformity;  these have no actual border.    Always 0.
            };

        shape_of_draw_src
            :
            Draw_From
            ->
            { upperleft:        g2d::Point,
              size:             g2d::Size,
              #
              depth:            Int,
              border_thickness: Int
            };

        size_of_window:      sn::Window    -> g2d::Size;
        size_of_rw_pixmap:   sn::Rw_Pixmap -> g2d::Size;
        size_of_ro_pixmap:   sn::Ro_Pixmap -> g2d::Size;

        package r: api {
            #
            Window_Or_Pixmap
              #
              = WINDOW  sn::Window
              | PIXMAP  sn::Rw_Pixmap
              ;
        };

        Drawable =  DRAWABLE
                      {
                        root:           r::Window_Or_Pixmap,
                        draw_ops:       List( w2x::Draw_Op ) -> Void
                      };

        drawable_of_window:     sn::Window    -> Drawable;
        drawable_of_rw_pixmap:  sn::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/old/fancy/graphviz/get-mouse-selection.pkg
#
#       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/src/window/draw-old.pkg
#           #     src/lib/x-kit/xclient/src/window/cs-pixmap-old.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 SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext