Commit 41d2f57d authored by Robert Sprowson's avatar Robert Sprowson

Add support for type 10 (64k colour) sprites and those with wide masks

Sprite type 10 is now accepted as an input format, by defining the appropriate 5:6:5 colour lookup tables.
Sprites with wide masks (8b alpha channels) are now also accepted, though like binary masks the mask is simply ignored. Previously these fell into a signed < 256 trap and were being mistaken for numbered modes which the OS then choked on.
When showing the mode number in the "About this image" dialogue the number is now given in hex if it's not a numbered mode (0-255), this is fractionally more useful than decimal.
Enlarged the "About this image" display fields per the Style Guide.
Corrected the comments in the colour mapping code (lines 6551-6552, 7043-7044).

Version 1.55. Tagged as 'ChangeFSI-1_55'
parent 7f5bf70b
......@@ -12,8 +12,8 @@ Summary of formats
Input formats
-------------
RISC OS sprites 1, 2, 4, 8bpp -
and 15 and 24 (32 bits) sprites
RISC OS sprites 1, 2, 4, 8 bits per pixel -
and new format 15, 16, 32 bits per pixel
ArVis 15-bit HIP + LOP sprites
Watford digitiser pictures, 512×256, 64 greys -
and triple red, green, blue separations
......@@ -88,7 +88,7 @@ Contains 1, 2, 4 or 8 bits per pixel with a modification palette of up to
16 entries; any number of pixels wide and high uncompressed. Details are in
the RISC OS Programmer's Reference Manual.
Recognised by file type FF9 (a paint brush and house icon).
Recognised by file type FF9.
Details of how many bits per pixel and the pixel size are obtained from
the operating system (rather than being in the file) from the "MODE"
......@@ -101,13 +101,13 @@ the RISC OS Programmer's Reference Manual.
The new RISC OS sprite format
·····························
Contains 1, 2, 4, 8, 16 or 32 bits per pixel.
Contains 1, 2, 4, 8, 15, 16 or 32 bits per pixel.
Recognised by file type FF9.
No problem with mode extensions: information is coded into the format.
Mask information ignored.
Mask and alpha channel information ignored.
ArVis 15-bit HIP + LOP sprites
------------------------------
......@@ -720,8 +720,8 @@ Wireless application protocol bitmaps
Table summarising the formats
=============================
RISC OS 1, 2, 4 and 8 bit per pixel sprites [file type FF9]
and 15 and 24 (32 bits) sprites
RISC OS sprites 1, 2, 4, 8 bits per pixel [file type FF9]
and new format 15, 16, 32 bits per pixel
ArVis 15 bit HIP.+LOP. sprites [file type FF9 named HIP.]
Watford digitiser pictures 512x256y64g [file type DFA]
and triple red, green, blue seperations [directory of r,g,b DFA]
......
No preview for this file type
No preview for this file type
/* (1.54)
/* (1.55)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.54
#define Module_MajorVersion_CMHG 1.55
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 Jul 2015
#define Module_Date_CMHG 06 Oct 2015
#define Module_MajorVersion "1.54"
#define Module_Version 154
#define Module_MajorVersion "1.55"
#define Module_Version 155
#define Module_MinorVersion ""
#define Module_Date "15 Jul 2015"
#define Module_Date "06 Oct 2015"
#define Module_ApplicationDate "15-Jul-15"
#define Module_ApplicationDate "06-Oct-15"
#define Module_ComponentName "ChangeFSI"
#define Module_ComponentPath "mixed/RiscOS/Sources/Apps/ChangeFSI"
#define Module_FullVersion "1.54"
#define Module_HelpVersion "1.54 (15 Jul 2015)"
#define Module_LibraryVersionInfo "1:54"
#define Module_FullVersion "1.55"
#define Module_HelpVersion "1.55 (06 Oct 2015)"
#define Module_LibraryVersionInfo "1:55"
......@@ -535,7 +535,7 @@ DEF PROCcallFSI
SYS &2002E,&10d,sar%,pixtrans%,255,1
n$=FNZS(pixtrans%)
SYS &2002E,&128,sar%,n$ TO ,,,x,y,,m
$adsm%= STR$m
IF (m<256 AND SGN(m)<>-1) THEN $adsm%=STR$m ELSE $adsm%="&"+STR$~m
$adsname%=n$
$adsbytes%= STR$sar%!12
SYS &35,m,4 TO ,,nx
......@@ -1940,7 +1940,8 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
K%=FNW+F%-&20:REM Mask
sm=FNW
s$=""
IF sm<256 THEN
IF sm<256 AND SGN(sm)<>-1 THEN
REM Is a numbered mode
SYS 53,sm,3 TO ,,I%
CASE I% OF
WHEN 1
......@@ -1976,9 +1977,9 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
ELSE
IF K%>st% K%=st%:REM find first of mask or sprite
IF K%-12-F%=2048 OR I%=255 THEN
PROCnewropal(256):s$="256 entry palette, ":REM A full size 256 entry palette
PROCnewropal(256):s$="256 colours, ":REM A full size 256 entry palette
ELSE
PROCipal63:s$="64 entry palette, ":REM VIDC1 compatible 64 entry palette
PROCipal63:s$="64 colours, ":REM VIDC1 compatible 64 entry palette
ENDIF
ENDIF
PTR#c%=F%-16
......@@ -1998,8 +1999,8 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
IF scale% xmul%=xmul%*nx/2:ymul%=ymul%*ny/2
info$="RISC OS sprite, "+s$+"mode "+STR$sm+", "+STR$sx%+" by "+STR$sy%+" pixels, "+FNbits(input)
ELSE
bpp%=sm>>>27
CASE bpp% OF
REM Is a sprite mode word
CASE (sm>>27)AND15 OF
WHEN 1
bpp%=1
r$="FN8"
......@@ -2020,43 +2021,59 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
ELSE
IF K%>st% K%=st%:REM find first of mask or sprite
IF K%-12-F%=2048 THEN
PROCnewropal(256):s$="256 entry palette, ":REM A full size 256 entry palette
PROCnewropal(256):s$="256 colours, ":REM A full size 256 entry palette
ELSE
PROCipal63:s$="64 entry palette, ":REM VIDC1 compatible 64 entry palette
PROCipal63:s$="64 colours, ":REM VIDC1 compatible 64 entry palette
ENDIF
ENDIF
WHEN 5
bpp%=16
r$="FN16"
IF st%=F%+12 ELSE
DIM rpal%(255),gpal%(255)
step24=2
FOR C%=0 TO 255
gpal%(C%)=(C%>>5)<<8 OR (C% AND 31)
rpal%(C%)=((C%>>2) AND 31)<<16 OR (C% AND 3)<<11
NEXT
FOR C%=0 TO 31
r%(C%)=C%/31*F
NEXT
g%()=r%()
b%()=r%()
FOR C%=0 TO 255
gpal%(C%)=(C%>>5)<<8 OR (C% AND 31)
rpal%(C%)=((C%>>2) AND 31)<<16 OR (C% AND 3)<<11
NEXT
s$="32k colours, ":REM 15bpp 5:5:5
step24=2
WHEN 6
bpp%=32
r$="FN24"
IF st%=F%+12 PROCnopal ELSE
rbo%=0
gbo%=1
bbo%=2
PROCnopal
rbo%=0:gbo%=1:bbo%=2
step24=4
WHEN 8
bpp%=24
r$="FN24"
IF st%=F%+12 PROCnopal ELSE
rbo%=0
gbo%=1
bbo%=2
PROCnopal
rbo%=0:gbo%=1:bbo%=2
WHEN 10
bpp%=16
r$="FN16"
DIM rpal%(255),gpal%(255)
FOR C%=0 TO 31
r%(C%)=C%/31*F
NEXT
FOR C%=0 TO 63
g%(C%)=C%/63*F
NEXT
b%()=r%()
FOR C%=0 TO 255
gpal%(C%)=(C%>>5)<<8 OR (C% AND 31)
rpal%(C%)=((C%>>3) AND 31)<<16 OR (C% AND 7)<<11
NEXT
s$="64k colours, ":REM 16bpp 5:6:5
step24=2
WHEN 15
ERROR 42,"Not understood extended RISC OS sprite type"
OTHERWISE
ERROR 42,"Not understood new format RISC OS sprite bpp"
REM Types 0/7/9/11-14 come here
ERROR 42,"Not understood RISC OS sprite type"
ENDCASE
nx=(sm>>1) AND &1fff
ny=(sm>>14) AND &1fff
......@@ -2067,7 +2084,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
I%=FNW
sx%=(rowbytes%*8-(31-FNW))/bpp%
input=bpp%
info$="New RISC OS sprite, "+s$+STR$sx%+" by "+STR$sy%+" pixels, "+FNbits(input)
info$="RISC OS sprite, "+s$+STR$sx%+" by "+STR$sy%+" pixels, "+FNbits(input)
IF bpp%=32 input=24
ENDIF
PTR#c%=st%
......@@ -6545,8 +6562,8 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
LDR R3,[R9,#4*8] REM base of r array
LDR R4,[R9,#3*8] REM base of g array
LDR R5,[R9,#2*8] REM base of b array
LDR R6,[R9,#5*8] REM base of byte g (buff) map array
LDR R7,[R9,#6*8] REM base of byte r (pbuff) map array
LDR R6,[R9,#5*8] REM base of byte gpal map array
LDR R7,[R9,#6*8] REM base of byte rpal map array
LDR R8,[R9,#7*8] REM base of z array
CMP R1,R2
ADDEQ R2,R2,#1
......@@ -7037,8 +7054,8 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
LDR R3,[R9,#4*8] REM base of r array
LDR R4,[R9,#3*8] REM base of g array
LDR R5,[R9,#2*8] REM base of b array
LDR R6,[R9,#5*8] REM base of byte g (buff) map array
LDR R7,[R9,#6*8] REM base of byte r (pbuff) map array
LDR R6,[R9,#5*8] REM base of byte gpal map array
LDR R7,[R9,#6*8] REM base of byte rpal map array
LDR R8,[R9,#7*8] REM base of z array
CMP R1,R2
ADDEQ R2,R2,#1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment