🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #123

Re: Device independent cached images?(answered)

#123
From: Daniel Filiberti
Date: Tue, 03 Nov 1992 18:16
50 lines
2302 bytes
In article <5711@rosie.NeXT.COM> aozer@next.com (Ali Ozer) writes:
> Hmm. Do you set the depth limit of this second NXImage to 24
> bits? If you don't, then the NXImage you get is the same
> depth as the default depth of the system. You should do: 
> 
> 
>     NXImage *myImage = [[NXImage alloc] initSize:...];
>     [myImage useCacheWithDepth:NX_TwentyFourBitRGBDepth];
>     if ([myImage lockFocus]) {
>          ... draw the image ...
>          ... now read it back ...
>          [myImage unlockFocus];
>     }

Whoops! I must apologize for not passing on all the great
info I received to solve this problem.  It turns out that
the above will only work if the drawing forces the
promotion of the offscreen cache to 24-bit.  Apparently,
the window server uses a lazy promotion scheme.  Note that
drawing a simple color, like black, won't work!  The color
that you draw must require the promotion, otherwise the
smallest depth that can represent the color is used. 
Also, compositing won't force the promotion! You must
use a DRAW.  I solved the problem by adding the following
lines to my code: 

		PSsetalpha( 0.4 );
		PSsetrgbcolor( 0.75, 0.2, 0.1 );
		PSrectfill( 0, 0, 1, 1 );

Believe it or not, that's all it took to get my code
working...it forces the promotion of the offscreen
cache to 24-bit...strange isn't it. 

Thanks again to everyone who gave me the answer!

Daniel

---
************************************************************
Motto for a monitor, "It's better to burn out, than to fade
 away..."  [8?)}
************************************************************
 
Daniel Filiberti
Oregon Health Sciences University
Biomedical Information Communication Center (BICC)
3181 Sam Jackson Park Road
Portland, Oregon  97201-3098
email:  filibert@ohsu.edu
Technical Details
Message-ID: <1992Nov3.181644.11825@ohsu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!pdxgate!steele!news
References: <5711@rosie.NeXT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!pdxgate!steele!news
From: filibert@vista (Daniel Filiberti)
Newsgroups: comp.sys.next.programmer
Subject: Re: Device independent cached images?(answered)
Message-ID: <1992Nov3.181644.11825@ohsu.edu>
Date: 3 Nov 92 18:16:44 GMT
Article-I.D.: ohsu.1992Nov3.181644.11825
References: <5711@rosie.NeXT.COM>
Sender: news@ohsu.edu
Reply-To: filibert@ohsu.edu
Organization: Oregon Health Sciences University
Lines: 50
Nntp-Posting-Host: vista