HP Forums
DIMGROB back from Graphics Variable? - 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: DIMGROB back from Graphics Variable? (/thread-17000.html)



DIMGROB back from Graphics Variable? - matalog - 05-24-2021 09:24 PM

Is there a way to get a DIMGROB from a G1 Graphic Variable, so that I can include it in a program, instead of having to transport the .png file from which the G1 is created with the program, for another person to try out?

So if G1 is defined on a HP Prime, is there a way to get a DIMGROB from the calc?


RE: DIMGROB back from Graphics Variable? - matalog - 05-26-2021 10:07 PM

I found a way to do it, but it will obviously require a large amount of space in the program, it works though, and can be used to put sprites into a program and not need to send any files along with the program.

Code:
EXPORT NH()
BEGIN
DIMGROB_P(G1,26,26);
LOCAL CXL:="DIMGROB(G1,26,26,{";
 G1:=AFiles("b3l.png");
  FOR Y FROM 0 TO 25 DO
    FOR X FROM 0 TO 25 DO
  CXL:=CXL+GETPIX_P(G1,X,Y)+", ";
    END;
  END;
CXL:=CXL+"});";
Notes("COL"):=CXL;
END;

This saves the colours of the 'sprite' or graphic which can be loaded as a PNG, to a notes file called COL, which can be viewed on computer, and then pasted as a DIMGROB, and therefore entered into a program.