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

Re: MCL color graphics



	>I need better support for (color) graphics in MCL. Window-objects are OK
	>for basic use but such a nice environment like MCL should include
	>high-level support for:
	>
	>1) bitmap-windows (with off-screen bitmaps)
	>2) palette manager (say any 256 colors or gray levels)
	>
	>Is there anything coming from Apple? (Soon?) Does anyone have simple yet
	>robust solutions written for this? (What about Common Windows, CLIM, etc.?)
	>
	>(I am new to info-macl so this might already have been discussed)
	
	Alan Ruttenberg wrote some code that uses GWorlds to do off-screen
	bitmaps. It will take a little work to make it fully general, and it
	won't work on machines without 32 bit quickdraw, but it will probably
	be useful to many people. He wrote the code as a contractor for Apple
	so it should be ours to distribute. Alan, please tell us more.
	

The code I wrote lets you create a sheet-view, which is a view with a
pixmap behind it. view-draw-contents methods draw to the pixmap, and
then the system draws the pixmap (or portion that needs to be
updated). The depth of the pixmap can be specified. You can also
specify the copybits mode used to copy the pixmap, and so create
effects like transparency and so on.

Otherwise these things behave like regular views. They can be nested
and all that other good stuff. There are a couple of caveats:
1) focusing view and drawing, doesn't make stuff appear on the screen. It
appears on the screen only when the view containing it invalidated. On
the other hand drawing doesn't takeplace unless the view itself is
invalidated, i.e. most of the time only the pixmap is copied on
update, which can be faster for complex graphics. 2) I'm not sure if I
got the crolling right - I suspect not, so you may not be able to set
the origin of sheet view (but you can for nont sheet subviews of it).

I don't have support for the palette manager. I wish I did, but I am
hopelessly confused about what to do when the object being managed is
a gworld, instead of a window. The palette manager seems to be
applicable to windows only, so, for instance, I don't know how to keep
the palette of a windows and a gworld, or the palette of two gworlds
in sync. If someone knows how to do this, please contact me, as I need
this capability for other things I am doing.

I'll work on a version which can be distributed in the next few days,
and report back.

-alan