PreviousUpNext

15.3.757  src/lib/x-kit/xclient/src/window/cs-pixmap-old.api

## cs-pixmap-old.api                    "cs" == "client-side"
#
#   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
    package dt =  draw_types_old;       # draw_types_old        is from   src/lib/x-kit/xclient/src/window/draw-types-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
herein

    api Cs_Pixmap_Old {

        exception BAD_CS_PIXMAP_DATA;

        # XY format for clientside window image data, 
        # Each string in the string 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_pixmap_from_readwrite_pixmap
        # to work on all pixmaps, and the necessary changes were minimal.


        Cs_Pixmap_Old
            =
            CS_PIXMAP
              { size:  g2d::Size,
                data:  List(  List(  vector_of_one_byte_unts::Vector ) )
              };

        same_cs_pixmap: (Cs_Pixmap_Old, Cs_Pixmap_Old) -> Bool;

        copy_from_clientside_pixmap_to_pixmap
            :
            dt::Rw_Pixmap
            ->
            { from:      Cs_Pixmap_Old,
              #
              from_box:  g2d::Box,
              to_point:  g2d::Point
            }
            ->
            Void;

        make_clientside_pixmap_from_ascii
            :
            (Int, List( List(String))) -> Cs_Pixmap_Old;
            #
            # 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_pixmap_from_ascii
            #         (8, [ [ "0x24", "0x24", "0xff", "0x24", "0x24", "0xff","0x24", "0x24" ] ] );
            #
            #     make_clientside_pixmap_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_PIXMAP_DATA if the
            # given ascii data cannot be successfully converted.

        make_readwrite_pixmap_from_clientside_pixmap
            :
            sn::Screen -> Cs_Pixmap_Old -> dt::Rw_Pixmap;

        make_readwrite_pixmap_from_ascii_data
            :
            sn::Screen
            ->
            (Int, List(List(String)))
            ->
            dt::Rw_Pixmap;

        make_clientside_pixmap_from_readwrite_pixmap:   dt::Rw_Pixmap -> Cs_Pixmap_Old;
        make_clientside_pixmap_from_readonly_pixmap:    dt::Ro_Pixmap -> Cs_Pixmap_Old;
        make_clientside_pixmap_from_window:   (g2d::Box, dt::Window)   -> Cs_Pixmap_Old;
    };

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