0 Members and 1 Guest are viewing this topic.
EXPORT fadein()BEGINFOR C FROM 0 TO 3 DOFOR X FROM 0 TO 319 DOFOR Y FROM 0 TO 239 DOINT(GETPIX_P(X,Y)/2)▶P;PIXON_P(X,Y,P);END;END;END;END;
IIRC, the HP Prime's screen uses 16-bits colors (R5G6B5 format), so you can't access colors separately unless you use bitwise operators (and, or, not) and bit shifting. I don't think HP basic permits you to do that.
If you divide by 2^n (and remove the remainder, with something like int() ) it's the same like shifting with n. And then you can use the modulus operator to get the bits you want. (So basically you simulate bitwise operators).
.alpha = int(color / 32768)red = int(color / 1024) % 32green = int(color / 32) % 32blue = color % 32
color = (alpha % 2) * 32768 + (red % 32) * 1024 + (green % 32) * 32 + (blue % 32)
EXPORT Red(c) BEGIN BITAND(BITSR(c,16),#7Fh); END;EXPORT Green(c) BEGIN BITAND(BITSR(c,8),#7Fh); END;EXPORT Blue(c) BEGIN BITAND(c,#7Fh); END;
the HP Prime's screen uses 16-bits colors (R5G6B5 format), so you can't access colors separately unless you use bitwise operators (and, or, not) and bit shifting. I don't think HP basic permits you to do that.
EXPORT fadein()BEGIN FOR C FROM 0 TO 3 DO FOR X FROM 0 TO 319 DO FOR Y FROM 0 TO 239 DO PIXON_P(X,Y,BITSR(GETPIX_P(X,Y))); //avoid division and variable ... END; END; END;END;
I tried your last code by the way and it works . Question, though: What is the BITSC command and what does it do? I couldn't find anything about it in the Wiki nor the calculator help. I did a search for BITSC and nothing could be found.
EXPORT pixelate()BEGIN 2▶A; DIMGROB_P(G1,320,240); DIMGROB_P(G2,320,240); BLIT(G2,G0); FOR C FROM 1 TO 4 DO FOR X FROM 0 TO 319 DO FOR Y FROM 0 TO 239 DO PIXON_P(G1,X,Y,BITSR(GETPIX_P(X,Y))); END; END; BLIT_P(G1,0,0,320/A,240/A,G1,0,0,320,240); BLIT_P(G0,0,0,320,240,G1,0,0,320/A,240/A); A*2▶A END; FOR C FROM 80 DOWNTO .50 STEP .25 DO BLIT_P(G1,0,0,4*C,3*C,G2,0,0,320,240); BLIT_P(G0,0,0,320,240,G1,0,0,4*C,3*C); END; END;