HP Forums
BLIT_P gives different results (Calc vs. Emu.) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: BLIT_P gives different results (Calc vs. Emu.) (/thread-6188.html)



BLIT_P gives different results (Calc vs. Emu.) - Eddie W. Shore - 05-01-2016 04:40 PM

Version 10077:

This could be something I am missing but I am trying to fill the screen with trees using grobs. On the calculator the program works fine but the emulator shows a blank screen.

Code:
EXPORT IMGforest()
BEGIN
// draw a forest
// EWS 2016-04-25

// clear the screen
RECT_P();
RECT_P(G1);

// colors
LOCAL gr:=#009E60h,br:=#964B00h;

// draw a tree on G1

// use pixels (0,0) to (15,15)
// stump
FILLPOLY_P(G1,{(5,6),(5,15),
(9,15),(9,6)},br);
// tree
FILLPOLY_P(G1,
{(0,4),(7,0),(15,4),(9,3),
(15,6),(9,5),(15,12),(7,9),
(0,12),(5,5),(0,9),(5,3)},gr);

// plant the forest
LOCAL I,J;
FOR J FROM 0 TO 208 STEP 16 DO
FOR I FROM 0 TO 304 STEP 16 DO
BLIT_P(G0,I,J,I+15,J+15,
G1,0,0,15,15);
END; END;


WAIT;
END;

Anyone know what I am missing? Using FREEZE instead of WAIT gives the same results.


RE: BLIT_P gives different results (Calc vs. Emu.) - komame - 05-02-2016 05:59 AM

Just add this line before RECT_P(G1)
Code:
DIMGROB_P(G1,20,20);
By default the GROB G1 may be not defined and you should always set the dimensions.
It is unnecessary for G0 but for G1-G9 it shold be defined before first use.


RE: BLIT_P gives different results (Calc vs. Emu.) - cyrille de brébisson - 05-02-2016 06:22 AM

Hello,

You are not dimentionning your G1... in the emulator, I assume that it is of size 0*0. but for some reasons (you had an earlier program running), it does have a dimension on the calculator.

Cyrille