Path: chuka.playstation.co.uk!news From: rs108@mdx.ac.uk (Robert Swan) Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Fading.. Date: Wed, 13 May 1998 14:25:44 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 45 Message-ID: <35a51a8f.15816166@www.playstation.co.uk> References: <6j25v8$aek17@chuka.playstation.co.uk> NNTP-Posting-Host: stu-dialup6.mdx.ac.uk X-Newsreader: Forte Free Agent 1.11/32.235 On Sat, 9 May 1998 20:06:08 +0200, "Anders Clerwall" wrote: >Hi.. I've seen some fading done in many Yaroze programs.. How's it done? >If I LoadImage(&pic, (u_long *)picaddr); how do I fade it up/down to/from >black??? I really wanna do this.. please help! The answer is not to modify the image that you are LoadImage-ing, but to draw a semitransparent rectangle over the top of it after it is copied to screen. Using the GsBOXF rectangle handler (found in your Library Reference, page 45) you can do the following - GsBOXF FadingRect; u_long tTemp1; FadingRect.x = FadingRect.y = 0; // top left corner at (0,0) FadingRect.w = 320; FadingRect.h = 240; // specify width and height. This will vary depending on screen mode FadingRect.attribute += (1<<30) + (2<<28); // (1<<30) sets it to be drawn semitransparently // (2<<28) specifies the rectangle to subtract from the background for (tTemp1=0; tTemp1<256; tTemp1++) { FadingRect.r = FadingRect.g = FadingRect.b = (u_char) tTemp1; // set the colour of the box to go from transparent to opaque GsSortBoxFill(&FadingRect, &OTableHeader[CurrentBuffer], 0); // (see Lib Ref page 148) Send rectangle to ordering table at // front } Obviously the loop wouldnt work as it is, it needs to be incorporated into the screen drawing routine, so that every time the screen updates the rgb members of the rectangle increase each time. When the rgb values are 255 then the screen will be blank. Robert Swan rs108@mdx.ac.uk http://www.netyaroze-europe.com/~middex2