[comp.sys.mac.programmer] Palette Manager

spud@metasoft.UUCP (David Hayes) (04/06/89)

environment: Mac II 5 meg Think C 3.01 p4

the palette manager docs say that the first two colors in a palette
should always be black & white, is this only for compatibility with
1 bit per pixel video cards or is there some other reason ? i'm writing
some code that will never run on a system with less than 8 bits per
pixel and i'd rather not be constrained to using black and white
in the first two slots of my palette.

e-mail preferred, posted replies appreciated as well

   	   thanks, ...!bbn!metasoft!spud



 

ewing@tramp.Colorado.EDU (EWING DAVID JAMES) (04/11/89)

White and black should be the first and Last entries in the palette.  I don't
think it is absolutely necessary, but if you don't do this under MultiFinder
(or not) you might get some strange effects when your window is brought to the
front.

-dave-

| Dave Ewing	     | Internet: ewing@tramp.colorado.EDU (128.138.238.33)
| 4437 Clipper Ct.   | AppleLink: D2408		|
| Boulder, CO 80301  | GEnie: D.EWING1		| The usual disclaimer about
|		     | Compu$erve: 73447,1726	|    having my own brain.

kenh@hscfsas1.harvard.edu (Ken Hancock) (12/27/90)

Well, Christmas 1990 gave me my first chance at playing with the
palette manager a bit.  I grabbed the custom palette and code
from DTS's TubeTest (004) sample code and went about some
modifications.  Using standard quickdraw calls, I was able
to animate anything I wanted.  The only problem was what
I wanted to animate was substantially more complicated that
I wanted to create it in Studio/8 or another paint program,
put it in a resource, use DrawPicture to draw it into my
window, and then animate it.

Is this possible?  Anything imported into my window via
DrawPicture refused to animate.  Anyone have any tips?
Any other programs I should use instead?

Thanks in advance --

Ken

-- 
Ken Hancock                   | INTERNET: kenh@hscfsas1.harvard.edu 
Isle Systems                  | Disclaimer: My opinions are mine,  
Macintosh Consulting          | your opinions are yours.  Simple, isn't it?

Ken.Hancock@f20.n226.z1.FIDONET.ORG (Ken Hancock) (12/28/90)

Reply-To: kenh@hscfsas1.harvard.edu

Well, Christmas 1990 gave me my first chance at playing with the
palette manager a bit.  I grabbed the custom palette and code
from DTS's TubeTest (004) sample code and went about some
modifications.  Using standard quickdraw calls, I was able
to animate anything I wanted.  The only problem was what
I wanted to animate was substantially more complicated that
I wanted to create it in Studio/8 or another paint program,
put it in a resource, use DrawPicture to draw it into my
window, and then animate it.

Is this possible?  Anything imported into my window via
DrawPicture refused to animate.  Anyone have any tips?
Any other programs I should use instead?

Thanks in advance --

Ken

-- 
Ken Hancock                   I INTERNET: kenh@hscfsas1.harvard.edu 
Isle Systems                  I Disclaimer: My opinions are mine,  
Macintosh Consulting          I your opinions are yours.  Simple, isn't it?

 + Organization: Isle Systems - Waltham, MA

--  
Ken Hancock - via FidoNet node 1:105/14
    UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!Ken.Hancock
INTERNET: Ken.Hancock@f20.n226.z1.FIDONET.ORG

leonardr@svc.portal.com (Leonard Rosenthol) (12/28/90)

In article <5167@husc6.harvard.edu>, kenh@hscfsas1.harvard.edu (Ken Hancock)
writes:
> Well, Christmas 1990 gave me my first chance at playing with the
> palette manager a bit.  I grabbed the custom palette and code
> from DTS's TubeTest (004) sample code and went about some
> modifications.  Using standard quickdraw calls, I was able
> to animate anything I wanted.  The only problem was what
> I wanted to animate was substantially more complicated that
> I wanted to create it in Studio/8 or another paint program,
> put it in a resource, use DrawPicture to draw it into my
> window, and then animate it.
> 
> Is this possible?  Anything imported into my window via
> DrawPicture refused to animate.  Anyone have any tips?
> Any other programs I should use instead?
> 
	I've never tried it, but it would seem to me that in order for the
Palette Manager to know which colors to draw, they have to be valid entries
in the window's palette. To this end, I would pull the CLUT out of the PICT,
and do a CTab2Palette to get back a PaletteHandle, which you could then use
in a SetPalette call for the window.  Once the palette was in place, then
DrawPicture...If this doesn't work, then you may have to do the animation
yourself w/o the help of the Palette Manager.  It is not that difficult to
do color animation with just CLUTs.  I just finished a set of routines for
doing so (for some screen saver modules I am working on), so it can be done.
--
----------------------------------------------------------------------
+ Leonard Rosenthol              | Internet: leonardr@sv.portal.com  +
+ Software Ventures              | GEnie:    MACgician               +
+ MicroPhone II Development Team | AOL:      MACgician1              +
----------------------------------------------------------------------

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (12/28/90)

The notes I have on 32-bit QuickDraw include one on the enhancements
to the Palette Manager. In particular, it is possible to set up
the colour table in a source pixmap so that CopyBits will map the
source pixels onto animating entries in the palette of the target
window. All you have to do is set bit 14 in the ctFlags field,
and the value field in each element of the ctTable array becomes
a palette index, rather than a device CLUT index.

I assume this works in a PICT as well: all you have to do is find
and fiddle the appropriate bit, once you've created the PICT. You
could use either DeRez/Rez or PICT Detective to make the job a
little easier.

Disclaimer: I've never tried this. It just *looks* simple...

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00

Leonard.Rosenthol@f20.n226.z1.FIDONET.ORG (Leonard Rosenthol) (12/28/90)

Reply-To: leonardr@svc.portal.com

In article <5167@husc6.harvard.edu>, kenh@hscfsas1.harvard.edu (Ken Hancock)
writes:
> Well, Christmas 1990 gave me my first chance at playing with the
> palette manager a bit.  I grabbed the custom palette and code
> from DTS's TubeTest (004) sample code and went about some
> modifications.  Using standard quickdraw calls, I was able
> to animate anything I wanted.  The only problem was what
> I wanted to animate was substantially more complicated that
> I wanted to create it in Studio/8 or another paint program,
> put it in a resource, use DrawPicture to draw it into my
> window, and then animate it.
> 
> Is this possible?  Anything imported into my window via
> DrawPicture refused to animate.  Anyone have any tips?
> Any other programs I should use instead?
> 
        I've never tried it, but it would seem to me that in order for the
Palette Manager to know which colors to draw, they have to be valid entries
in the window's palette. To this end, I would pull the CLUT out of the PICT,
and do a CTab2Palette to get back a PaletteHandle, which you could then use
in a SetPalette call for the window.  Once the palette was in place, then
DrawPicture...If this doesn't work, then you may have to do the animation
yourself w/o the help of the Palette Manager.  It is not that difficult to
do color animation with just CLUTs.  I just finished a set of routines for
doing so (for some screen saver modules I am working on), so it can be done.
--
----------------------------------------------------------------------
+ Leonard Rosenthol              I Internet: leonardr@sv.portal.com  +
+ Software Ventures              I GEnie:    MACgician               +
+ MicroPhone II Development Team I AOL:      MACgician1              +
----------------------------------------------------------------------

 + Organization: Software Ventures Corporation.

--  
Leonard Rosenthol - via FidoNet node 1:105/14
    UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!Leonard.Rosenthol
INTERNET: Leonard.Rosenthol@f20.n226.z1.FIDONET.ORG

Lawrence.DOliveiro@f20.n226.z1.FIDONET.ORG (Lawrence DOliveiro) (12/28/90)

Reply-To: ldo@waikato.ac.nz

The notes I have on 32-bit QuickDraw include one on the enhancements
to the Palette Manager. In particular, it is possible to set up
the colour table in a source pixmap so that CopyBits will map the
source pixels onto animating entries in the palette of the target
window. All you have to do is set bit 14 in the ctFlags field,
and the value field in each element of the ctTable array becomes
a palette index, rather than a device CLUT index.

I assume this works in a PICT as well: all you have to do is find
and fiddle the appropriate bit, once you've created the PICT. You
could use either DeRez/Rez or PICT Detective to make the job a
little easier.

Disclaimer: I've never tried this. It just *looks* simple...

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00

 + Organization: University of Waikato, Hamilton, New Zealand

--  
Lawrence DOliveiro - via FidoNet node 1:105/14
    UUCP: ...!{uunet!glacier, ..reed.bitnet}!busker!226!20!Lawrence.DOliveiro
INTERNET: Lawrence.DOliveiro@f20.n226.z1.FIDONET.ORG

wiechman@athos.rutgers.edu (NightMeower) (01/07/91)

Be careful about skipping QD.  Those programs that do, will not run
properly on a 8*24 GC.  Now that we have one of these in house, you
would be surprised about the number of programs that do not work.  The
entertainment software is especially a problem.


Kevin
-- 
===========================================================================
Kevin S. Wiechmann			arpa:  wiechman@cs.rutgers.edu

             This is only a test... for the next sixty seconds...