PreviousUpNext

15.3.620  src/lib/x-kit/draw/bitmap-io.api

## bitmap-io.api

# Compiled by:
#     src/lib/x-kit/draw/xkit-draw.sublib



# This module provides code to read and write depth-1 images
# stored in X11 bitmap file format (see XReadBitmapFile (3X)).




###                   "Twain was so good with crowds that he became,
###                    in competition with singers and dancers and actors and acrobats,
###                    one of the most popular performers of his time.
###
###                   "It is so unusual, and so psychologically unlikely
###                    for a great writer to be a great performer, too,
###                    that I can think of only two similar cases --
###                    Homer's, perhaps, and Moliere's.
###
###                                       -- Kurt Vonnegut, Jr.,
###                                          The Unabridged Mark Twain, 1976



stipulate
    package fil =  file__premicrothread;        # file__premicrothread  is from   src/lib/std/src/posix/file--premicrothread.pkg
    package g2d =  geometry2d;                  # geometry2d            is from   src/lib/std/2d/geometry2d.pkg
    package xc  =  xclient;                     # xclient               is from   src/lib/x-kit/xclient/xclient.pkg
    package cpm =  cs_pixmap;                   # cs_pixmap             is from   src/lib/x-kit/xclient/src/window/cs-pixmap.pkg
herein

    api Bitmap_Io {
        #
        exception BITMAP_FILE_INVALID;

        read_bitmap:
            fil::Input_Stream
            ->
            { hot_spot:  Null_Or( g2d::Point ),
              image:     cpm::Cs_Pixmap
            };
            #
            # Read an X11 format bitmap image from the given Input_Stream.
            # Raise BITMAP_FILE_INVALID if the input file is badly formatted.


        exception NOT_BITMAP;

        write_bitmap
            :
            ( fil::Output_Stream,
              String,
              { hot_spot:  Null_Or( g2d::Point ),
                image:     cpm::Cs_Pixmap
              }
            )
            ->
            Void;
            #
            # Write a bitmap with the given name to the given output stream.
            # Raise the exception NOT_BITMAP, if the image is not a depth-1 bitmap,
            # and raise the exception xclient::BAD_CS_PIXMAP_DATA, if the data does
            # not match the given width and height.
    };
end;

## COPYRIGHT (c) 1993 by AT&T Bell Laboratories.  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