QPC2 - screen overlaying ?

Anything QL Software or Programming Related.
Post Reply
stevepoole
Aurora
Posts: 889
Joined: Mon Nov 24, 2014 2:03 pm

QPC2 - screen overlaying ?

Post 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.
____________


User avatar
XorA
Site Admin
Posts: 1629
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: QPC2 - screen overlaying ?

Post 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?


stevepoole
Aurora
Posts: 889
Joined: Mon Nov 24, 2014 2:03 pm

Re: QPC2 - screen overlaying ?

Post 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.
___________________


stevepoole
Aurora
Posts: 889
Joined: Mon Nov 24, 2014 2:03 pm

Re: QPC2 - screen overlaying ?

Post 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.
___________________


swensont
Forum Moderator
Posts: 325
Joined: Tue Dec 06, 2011 3:30 am
Location: SF Bay Area
Contact:

Re: QPC2 - screen overlaying ?

Post 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


Derek_Stewart
Font of All Knowledge
Posts: 4684
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QPC2 - screen overlaying ?

Post 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.


Regards,

Derek
User avatar
dilwyn
Mr QL
Posts: 3075
Joined: Wed Dec 01, 2010 10:39 pm

Re: QPC2 - screen overlaying ?

Post 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"


stevepoole
Aurora
Posts: 889
Joined: Mon Nov 24, 2014 2:03 pm

Re: QPC2 - screen overlaying ?

Post 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.
________________


User avatar
dilwyn
Mr QL
Posts: 3075
Joined: Wed Dec 01, 2010 10:39 pm

Re: QPC2 - screen overlaying ?

Post 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!


Post Reply