PreviousUpNext

15.3.759  src/lib/x-kit/xclient/src/window/cs-pixmat.api

## cs-pixmat.api                        "cs" == "client-side"
#
# A replacement for src/lib/x-kit/xclient/src/window/cs-pixmap.api
#
#   A client-side rectangular array of pixels.
#   X jargon calls it an "Ximage" but I prefer
#   a name more obviously related to pixmaps.
#
#   Support for copying back and forth between
#   client-side and server-side pixmaps makes
#   them useful for specifying icons, tiling
#   patterns and other client-originated image
#   data intended for X display.
#
# See also:
#     src/lib/x-kit/xclient/src/window/ro-pixmap-old.api
#     src/lib/x-kit/xclient/src/window/window-old.api
#     src/lib/x-kit/xclient/src/window/rw-pixmap-old.pkg

# Compiled by:
#     src/lib/x-kit/xclient/xclient-internals.sublib




stipulate
    include package   threadkit;                        # threadkit                     is from   src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg
    #
#   package dt  =  draw_types;                          # draw_types                    is from   src/lib/x-kit/xclient/src/window/draw-types.pkg
    package dy  =  display;                             # display                       is from   src/lib/x-kit/xclient/src/wire/display.pkg
    package mtx =  rw_matrix;                           # rw_matrix                     is from   src/lib/std/src/rw-matrix.pkg
    package r8  =  rgb8;                                # rgb8                          is from   src/lib/x-kit/xclient/src/color/rgb8.pkg
    package sn  =  xsession_junk;                       # xsession_junk                 is from   src/lib/x-kit/xclient/src/window/xsession-junk.pkg
    package v1u =  vector_of_one_byte_unts;             # vector_of_one_byte_unts       is from   src/lib/std/src/vector-of-one-byte-unts.pkg
    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 w2x =  windowsystem_to_xserver;             # windowsystem_to_xserver       is from   src/lib/x-kit/xclient/src/window/windowsystem-to-xserver.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/x-kit/xclient/src/window/cs-pixmat.pkg

    api Cs_Pixmat {

        exception BAD_CS_PIXMAT_DATA;

        # XY format for clientside window image data, 
        # Each vector in the inner list corresponds to a scan line in a plane.
        # The outer list corresponds to the list of planes, with plane 0 being
        # the last item in the list.
        # 
        # Multiple planes are not very useful right now, as the pixel type is
        # opaque. It seemed reasonable, however, to allow make_clientside_pixmat_from_readwrite_pixmap
        # to work on all pixmaps, and the necessary changes were minimal.


        Cs_Pixmat = CS_PIXMAT { size:  g2d::Size,
                                data:  v1u::Vector
                              };

        same_cs_pixmat: (Cs_Pixmat, Cs_Pixmat) -> Bool;

        make_clientside_pixmat_to_pixmap_copy_drawop
            :
            xt::Window_Id
            ->  dy::Xdisplay
            ->  { from:      mtx::Rw_Matrix( r8::Rgb8 ),
                  #
                  from_box:  g2d::Box,
                  to_point:  g2d::Point
                }
            ->  List( w2x::Draw_Op )
            ;


        copy_from_clientside_pixmat_to_pixmap
            :
#           sn::Rw_Pixmap
#           xt::Window_Id
#           ->
#           sn::Screen
            sn::Window
            ->
            { from:      mtx::Rw_Matrix( r8::Rgb8 ),
              #
              from_box:  g2d::Box,
              to_point:  g2d::Point
            }
            ->
            Void;



#       make_clientside_pixmat_from_ascii
#           :
#           (Int, List( List(String))) -> Cs_Pixmat;
#           #
#           # Create window with contents given by
#           # supplied ascii strings specifying binary or
#           # hex pixel values, with the integer parameter
#           # giving the width of the pixel array, and height
#           # of which is determined by the length of the
#           # stringlist.
#           #
#           # Example: the "tic-tac-toe" pattern result
#           #
#           #     RW_PIXMAP
#           #       { size => { wide => 8, high => 8 },
#           #         data => [ [ "\x02\x04", "\x02\x04", "\xff\xff", "\x02\x04",
#           #                     "\x02\x04", "\xff\xff", "\x02\x04", "\x02\x04"
#           #                 ] ]
#           #       };
#           #
#           # may be generated by either of
#           # 
#           #     make_clientside_pixmat_from_ascii
#           #         (8, [ [ "0x24", "0x24", "0xff", "0x24", "0x24", "0xff","0x24", "0x24" ] ] );
#           #
#           #     make_clientside_pixmat_from_ascii
#           #       ( 8,
#           #         [ [ "0x00100100",
#           #             "0x00100100",
#           #             "0x11111111",
#           #             "0x00100100",
#           #             "0x00100100",
#           #             "0x11111111",
#           #             "0x00100100",
#           #             "0x00100100"
#           #         ] ]
#           #       );                  # Example adapted from p9 http://mythryl.org/pub/exene/1993-lib.ps
#           # 
#           # We raise exception BAD_CS_PIXMAT_DATA if the
#           # given ascii data cannot be successfully converted.
#
#       make_readwrite_pixmap_from_clientside_pixmat
#           :
#           sn::Screen -> Cs_Pixmat -> sn::Rw_Pixmap;
#
#       make_readwrite_pixmap_from_ascii_data
#           :
#           sn::Screen
#           ->
#           (Int, List(List(String)))
#           ->
#           sn::Rw_Pixmap;

        make_clientside_pixmat_from_readwrite_pixmap:         (g2d::Box, sn::Rw_Pixmap)               ->  mtx::Rw_Matrix( r8::Rgb8 );
        make_clientside_pixmat_from_readonly_pixmap:          (g2d::Box, sn::Ro_Pixmap)               ->  mtx::Rw_Matrix( r8::Rgb8 );
        make_clientside_pixmat_from_window:                   (g2d::Box, sn::Window)                  ->  mtx::Rw_Matrix( r8::Rgb8 );

        pass_clientside_pixmat_from_readwrite_pixmap:         (g2d::Box, sn::Rw_Pixmap) -> Replyqueue -> (mtx::Rw_Matrix( r8::Rgb8 ) -> Void)  -> Void;
        pass_clientside_pixmat_from_readonly_pixmap:          (g2d::Box, sn::Ro_Pixmap) -> Replyqueue -> (mtx::Rw_Matrix( r8::Rgb8 ) -> Void)  -> Void;
        pass_clientside_pixmat_from_window:                   (g2d::Box, sn::Window)    -> Replyqueue -> (mtx::Rw_Matrix( r8::Rgb8 ) -> Void)  -> Void;
    };

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