OK, the last version was pretty poor. Here's a considerably faster version:
Code: Select all
100 ip$='win1_photo_jpg'
110 bgnd$='643B0F' : REMark hex RGB background colour for Sepia
120 :
130 CLS : PRINT 'Decoding :'!ip$; : op$=ip$(1 TO LEN(ip$)-3)
140 DELETE op$&'pic' : error%=FJPEG(ip$,op$&'pic',32)
150 IF error% THEN PRINT ' - '; : REPORT#1;error% : STOP
160 b$=CHR$((HEX(bgnd$(3 TO 4))&&$1C)*8||(HEX(bgnd$(5 TO 6))&&$F8)DIV 8)
170 b$=b$&CHR$(HEX(bgnd$(1 TO 2))&&$F8||HEX(bgnd$(3))DIV 2)
180 ip%=FOP_IN(op$&'pic') : WGET#ip%,f%,x%,y%,l%,m% : size=FLEN(#ip%)
190 yb%=SCR_YLIM-y% : yu%=yb%/2 : yl%=yb%-yu% : op%=FOP_OVER(op$&'bgi')
200 xb%=SCR_XLIM-x% : x%=x%*2 : DIM x$(x%) : PRINT\'PIC to BGIMAGE : '
210 IF xb%>0
220 t%=xb%/2 : l$=FILL$(b$,2*t%) : r$=FILL$(b$,2*(xb%-t%)) : xp%=x%
230 ELSE
240 l$='' : r$='' : xp%=2*SCR_XLIM
250 END IF
260 y$=FILL$(b$,SCR_XLIM*2) : IF yb%<0 THEN y%=SCR_YLIM
270 FOR n%=1 TO yu% : PRINT#op%;y$;
280 FOR n%=1 TO y%
290 PRINT#op%;l$; : BGET#ip%;x$(1 TO x%) : PRINT#op%;x$(1 TO xp%);
300 PRINT#op%;r$; : AT 1,17 : PRINT FPOS(#ip%);' / ';size;' '
310 END FOR n%
320 FOR n%=1 TO yl% : PRINT#op%;y$;
330 size=FLEN(#op%) : CLOSE#ip%,#op% : DELETE op$&'pic'
340 IF size<>SCR_XLIM*SCR_YLIM*2 THEN PRINT 'Oops, error' : STOP
350 PRINT 'Done, load wallpaper? (Y/N)' : k$=INKEY$(-1)
360 IF k$=='y' THEN BGIMAGE op$&'bgi'
(edited: improved b$ derivation)
I don't have access to ql-users or Wolfgang's email to inform him of a bug found in SMSQmulator 3v22 filing, perhaps someone could pass it on:
You can rename a file to same name as existing - you then have two files with same name (or many more). You don't get an overwrite prompt. Occurs with QPAC2 Files 'Move' or basic RENAME command. Copying a file to same name as existing does get the overwrite prompt.
Edit: Bug now solved
