Post Reply 
Transparency Pixel colour for Sprites on HP Prime
05-22-2021, 10:07 PM
Post: #14
RE: Transparency Pixel colour for Sprites on HP Prime
(05-22-2021 07:17 PM)matalog Wrote:  What is it in your program that determines that the pendula will be on a transparent background? Is it the line DIMGROB_P(G2,440,25,RGB(255,255,255,255)); ? Something to do with RGB(255,255,255,255))? Is it only the fourth 255 in that, and the fact that it is greater than 128? And then that you are only drawing pixels of other colours on that layer?

Yes, since I'm passing a transparent color to DIMGROB_P it is initializing the graphic as transparent. I'm not sure when the 128 fence is relevant here, it has been a while since I was working this out. RGB takes four inputs, with the fourth being the alpha value for the color (the amount of transparency).

Here is the first version of the program I wrote that uses partially transparent colors to give a glass effect to the balls. I'm using a color with alpha of 64 and get bit of pass through, but the color dominates. The drawing is done with ARC_P.

Code:

EXPORT PENDULUMS()
BEGIN
DIMGROB_P(G1,320,240);

FOR T FROM 0 TO 1000 STEP .01 DO

RECT_P(G1,RGB(192,192,192));
TEXTOUT_P(T,G1,10,10);

FOR B FROM 0 TO 19 DO
C:=RGB(255-B*12,64,B*12,64);
ARC_P(G1,160+150*SIN(T*(1-B/80)),12+B*11,10,{#0,C});

END;

BLIT(G1);

END;



END;

513016415223221833242338122322514610315
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Transparency Pixel colour for Sprites on HP Prime - john gustaf stebbins - 05-22-2021 10:07 PM



User(s) browsing this thread: 2 Guest(s)