Program "Magnifying Glass" to use everywhere - 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: Program "Magnifying Glass" to use everywhere (/thread-4838.html) Program "Magnifying Glass" to use everywhere - xset - 09-30-2015 08:09 PM Hey, I just implemented my dream. Funny concept but quite useful in some cases. This program allow you to call magnifying glass everywhere on calculator, it also can be called by opening its application. Look MGlassDemo.png in attached archive. You press Shift-USER M (+/- key on keyboard) and glass appeared, you can drag and view anything better. Exit with On button (i promise graceful exit by ESC in next version). Application's "MagnyGlass" program (don't forget to add images MGlass.png and MskGlass.png from archive to Files section of application): Code: EXPORT MagnyGlass() BEGIN   LOCAL DX:=28; // center of glass offset X   LOCAL DY:=29; // offset Y   LOCAL X:=50; // Current center of glass position X   LOCAL Y:=50; // Y   LOCAL GW:=120; // Width of glass image   LOCAL GH:=76;   // Height   LOCAL SW:=GROBW_P(G0); // Width of screen   LOCAL SH:=GROBH_P(G0); // Height of screen   DIMGROB_P(G1,SW,SH); // FOR SCREEN COPY   BLIT_P(G1,G0);             // Save copy of screen   G2:=MagnyGlass.AFiles("MGlass.png"); // Load image of glass   G3:=MagnyGlass.AFiles("MskGlass.png"); // Load mask of glass   DIMGROB_P(G4,GW,GH); // prepare G4 GROB w size equal to glass image   DIMGROB_P(G5,GW,GH); // prepare G5 GROB w size equal to glass image WHILE 1 DO // Never make such inf loops :-)   BLIT_P(G0,G1); // Restore image   BLIT_P(G4,G1,X-DX,Y-DY,X-DX+GW,Y-DY+GH); // Save normal (non-stretched) version under image   BLIT_P(G5,0,0,GW,GH,G1,X-15,Y-15,X+20,Y+15); // Save magnified version   BLIT_P(G5,G3,#0000FF); // Put red mask of glass on magnified version   BLIT_P(G0,X-DX,Y-DY,G5,#FF0000); // Put magnified version without (area inside glass)   BLIT_P(G0,X-DX,Y-DY,G2,#FF0000); // Put glass without red (draw glass over normal image and magnified part)   LOCAL msg:=WAIT(-1);    IF TYPE(msg)=6 THEN        IF msg(1)=0 OR msg(1)=1 THEN             X:=msg(2)-86+28; // shift to handle 86 (need to drag glass by handle instead of center) and return to center 28             Y:=msg(3)-56+29; // same for Y        END;    END; END;   BLIT_P(G0,G1); // Restore after inf loop (stupid idea). END; START() BEGIN    MagnyGlass(); END; Key callback code in MagnyGlassKey.hpprg: Code: KEY K_Neg() BEGIN    MagnyGlass.MagnyGlass();   END; RE: Program "Magnifying Glass" to use everywhere - primer - 09-30-2015 08:30 PM Brillant use of GROB functions ! (bliting, masking...) that's very nice. you gives ideas... thank you. RE: Program "Magnifying Glass" to use everywhere - xset - 09-30-2015 09:03 PM Oh, I am still learning basics. Someone even found alpha blending in RECT. Next dream is editor application with blackjack and... I've improved a little comments in code. RE: Program "Magnifying Glass" to use everywhere - cyrille de brĂ©bisson - 10-01-2015 05:43 AM Hello, I LOVE it, it is a wonderful idea! Cyrille RE: Program "Magnifying Glass" to use everywhere - Tim Wessman - 10-01-2015 08:12 PM Yup... don't be surprised if something similar shows up in the future! :-D