CLIM mail archive

[Prev][Next][Index][Thread]

Re: bitmaps



    Date: Wed, 26 Jun 91 09:57:11 CDT
    From: David Neves <neves@ils.nwu.edu>

    >
    >    Date: Tue, 25 Jun 91 14:37:00 CDT
    >    From: David Neves <neves@ils.nwu.edu>
    >
    >    In CLIM 1.0.
    >
    >    I would like to have bitmapped buttons.
[...]
    >
    >In general, anything you can draw can be a presentation.  Surround the
    >code which does the output with WITH-OUTPUT-AS-PRESENTATION.
    >
    >  (with-output-as-presentation (:stream window :object 'button :type 'my-button)
    >    (render-button window))
    >
    >where RENDER-BUTTON actually does the drawing you want.

    I don't think this can be true because CLIM does not know the primitives
    that I am using to draw the bitmap (I am using some Windows 3.0 calls). 
    With-output-as-presentation should only work with accepted drawing
    primitives shouldn't it?  My guess is that I have to get CLIM to know about
    the bitmap -- its position, extent, and how it can be reproduced (in case
    of movement).

Yes, you're right.  We intend to have extensible output recording
facilities in CLIM 2.0.  The 1.0 code is extensible, but doing so is
somewhat complicated.  

To define a new graphics primitive in 1.0, you should look at the
sources of GRAPHICS-GENERICS and GRAPHICS-INTERNALS to see how to define
a graphics operation.  Since you mention Windows 3.0, I assume you are
using CLOE, look at CLOE-IMPLEMENTATION to see how to implement a
graphics operation for CLOE.  Finally, I believe you will need to
recompile and reload the file STREAM-TRAMPOLINES if you want your new
primitive to work in incremental redisplay, table formatting, and the
other extended output facilities.

As an alternative to all of this, the function RENDER-BUTTON above could
do something like this:

  (defun render-button (window)
    (draw-rectangle* window left top right bottom :ink +background+)
    (render-button-internal window))

where LEFT, TOP, RIGHT and BOTTOM would define the corners of the
(rectangular) bitmap button, and RENDER-BUTTON-INTERNAL would be what
RENDER-BUTTON used to be.  This is a kludge, but is likely to work.  It
would NOT cause replay when you refresh the screen, and is unlikely to
work if you use incremental redisplay or any other advanced output
record manipulation, but it might give you what you need in this case.

[Use DRAW-POLYGON or DRAW-CIRCLE or DRAW-ELLIPSE if those give you the
appropriate boundaries, by the way.]

0,,

References:

Main Index | Thread Index