Page 1 of 1

QPC2 - screen overlaying ?

Posted: Fri Dec 10, 2021 9:01 pm
by stevepoole
Hi Folks,

Is there any way of pasteing a PC jpg image onto a paused QPC2 (#1) window, and then to resume drawing in basic?

This could be very useful, but I doubt if it is possible....

Steve.
____________

Re: QPC2 - screen overlaying ?

Posted: Sat Dec 11, 2021 10:52 am
by XorA
stevepoole wrote:Hi Folks,

Is there any way of pasteing a PC jpg image onto a paused QPC2 (#1) window, and then to resume drawing in basic?

This could be very useful, but I doubt if it is possible....

Steve.
____________
Do you mean so it gets written into the screen memory?

Or that it appears in high colour behind the ql screen?

Re: QPC2 - screen overlaying ?

Posted: Sat Dec 11, 2021 5:06 pm
by stevepoole
Hi Xora,

I suppose I would have to open a small window half way through a program, import an image to it, then continue drawing to the original window ?

That is, if I could de-magnify a jpeg image to import it.

I seem to have a lot to learn... that is if it is possible to manipulate jpeg images at all on QPC2....

Steve.
___________________

Re: QPC2 - screen overlaying ?

Posted: Sat Dec 11, 2021 5:07 pm
by stevepoole
Hi Xora,

I suppose I would have to open a small window half way through a program, import an image to it, then continue drawing to the original window ?

That is, if I could de-magnify a jpeg image to import it.

I seem to have a lot to learn... that is if it is possible to manipulate jpeg images at all on QPC2....

Steve.
___________________

Re: QPC2 - screen overlaying ?

Posted: Sat Dec 11, 2021 7:58 pm
by swensont
Check out PHGTK (PHoton General ToolKit, including FJPEG, FGIF and FPNG) under the Graphic section of Dilwyn's page. It has a function to write an image (scr I think) to the QL screen. There also a way to convert .jpg to .scr. I used it in one program, but I was not using the PE.

Tim

Re: QPC2 - screen overlaying ?

Posted: Sun Dec 12, 2021 9:01 am
by Derek_Stewart
Hi,

The current Clipboard transfer from Linux or Windows uses the SCRAP thing , which is a text based system, so maybe the file name could be transferred to the SCRAP thing by QPC2: QPC_SYNCSCRAP or SMSQmulator: JVA_SGET and a programme imports the graphics file: JPEG and processes, displaying it to the screen.

Or look at the DOS directory with QPAC2 Files, where the JPEG is located and execute the JPEG, Filefinfo2 can load Photon and convert the JPEG to PIC then save the file.

Re: QPC2 - screen overlaying ?

Posted: Sun Dec 12, 2021 11:50 am
by dilwyn
OK, I just spent about 60 minutes typing a fairly comprehensive guide for Steve to do this,assuming I correctly understood what Steve wanted to do, and the Forum promptly went and lost it as I pressed Preview. A timeout loses the article when it goes to ask you to Login once more, even though it allowed you to continue typing which had no hope of being submitted, grrr.

So, a much briefer posting.

Conversion - use Photon application, or functions such as FJPEG in the PHGTK toolkit, both available from http://www.dilwyn.me.uk/graphics/index.html , to convert the JPEG to a PIC file. PIC files will be in the same screen display mode as the QL display. Photon can convert to QL modes, whereas I *think* (I stand to be corrected, as I haven't checked) that PHGTK only converts to the higher colour modes. You could also do this using sprites, but it's a much more complicated subject to get to grips with.

Display. Once you have the PIC file version of the JPEG, it's easy to display a section of that using the FPIC_LOAD function from PHGTK. It's far easier to do this on a machine with pointer environment (e.g. an SMSQ/E system such as QPC2) than on "vanilla" QL without pointer environment, as the PE does much of the "heavy lifting" for you.

You need to study those extensions in PHGTK (they have so many options to choose from) and make a listing something like this. Be aware that you should convert the JPEG to a PIC file with the same mode number as that which you will be using, e.g. mode 32 for QPC2 high colour, or mode 33 for Q40.

(Note: retyped, unchecked for errors)

REM create a PIC called win1_ql_pic from the JPG file for display in mode 32
error% = FJPEG(win1_photo_jpg,win1_ql_pic,32)
IF error% < 0 THEN PRINT"Oops, conversion failed.":STOP
REM load a section of the PIC into top left of window #1 of size 448x200 pixels
REM see PHGTK manual for meaning of the 8 parameters to FPIC_LOAD
error% = FPIC_LOAD(#1,win1_ql_pic,0,0,0,0,448,200)
DELETE win1_ql_pic : REM tidy up after use
IF error% < 0 THEN PRINT "Oops, problem displaying the PIC"

Re: QPC2 - screen overlaying ?

Posted: Sun Dec 12, 2021 1:03 pm
by stevepoole
Hi Folks,

Many thanks for your suggestions about using Photon, downloaded from Dilwyn's site.

I followed the instructions in the .txt files, and once I saw that the photon 'mode' parameter must be 32 for QPC, everything worked as planned !

So now I draw parts of a screen in basic, load the FPIC_SAVE (jpg) file where I want it, and carry on drawing OK.
Nb: File.jpg size must be < 32768 bytes to load ! ( I used MS_Paint to reduce the 8mo file down to 32ko ).

The result is a neat 'hybrid' image.... Photon is an excellent piece of work, and highly recommendable !

Why did I not see this one before ??? Now I must see what else it can do, as there is a large toolkit which comes with it.....

Steve.
________________

Re: QPC2 - screen overlaying ?

Posted: Sun Dec 12, 2021 2:19 pm
by dilwyn
stevepoole wrote:Hi Folks,

Many thanks for your suggestions about using Photon, downloaded from Dilwyn's site.

I followed the instructions in the .txt files, and once I saw that the photon 'mode' parameter must be 32 for QPC, everything worked as planned !

So now I draw parts of a screen in basic, load the FPIC_SAVE (jpg) file where I want it, and carry on drawing OK.
Nb: File.jpg size must be < 32768 bytes to load ! ( I used MS_Paint to reduce the 8mo file down to 32ko ).

The result is a neat 'hybrid' image.... Photon is an excellent piece of work, and highly recommendable !

Why did I not see this one before ??? Now I must see what else it can do, as there is a large toolkit which comes with it.....

Steve.
________________
I find both Photon and PHGTK to be extremely useful for my graphical work.

Not sure I understand what you mean by "must be less than 32768 bytes to load". I assume this means you are trying to load it with LBYTES file_pic, 131072 as per QL 512x256 mode 4 or mode 8 screen. This will fail on most modern systems (for one thing, it's a PIC file which is 10 bytes bigger than an equivalent QL screen, and on modern systems screens can be in a different start address in memory), and is of no use if trying to display in a window, hence why I suggested the use of FPIC_LOAD to allow a part of a larger graphic to be cut out and copied to a window or part of a screen. I *think" FPIC_LOAD needs pointer environment, though I'm not sure, I forgot to check that.

There is also a command called FPIC_SCALE in the PHGTK which will scale a PIC file to whatever dimensions you reasonably want, to fit a window. It also has extensions which will check the window dimensions for you rather than using "fixed" values - WDW_XLIM and WDW_YLIM.

I think that Giorgio's QTimage also uses the PHGTK, which is a good example of the sheer power of this oh so useful little PHGTK toolkit.

Have fun - once you get into it, you won't stop!