Home » Archimedes archive » Acorn User » AU 1995-04.adf » !StarInfo_StarInfo » Bloch/!Bio/Library/DrawTint

Bloch/!Bio/Library/DrawTint

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1995-04.adf » !StarInfo_StarInfo
Filename: Bloch/!Bio/Library/DrawTint
Read OK:
File size: 0E56 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >DrawTint
   20REM Draw file colour processor
   30REM by Matthew Bloch, Jan '95
   40END
   50:
   60DEF FNdrawtint_name = "Draw tint"
   70DEF FNdrawtint_args = "-in DrawFile -out DrawFile"
   80:
   90DEF FNdrawtint_init
  100DIM drawtint_error% 64
  110=0
  120:
  130DEF FNdrawtint_mouse(mx%,my%,mb%,mh%,mi%)
  140=0
  150:
  160DEF FNdrawtint_key(wh%,ic%,cx%,cy%,ch%,ci%,key%)
  170=0
  180:
  190DEF FNdrawtint_getword(h%)
  200=BGET#h%+((BGET#h%)<<8)+((BGET#h%)<<16)+((BGET#h%)<<24)
  210:
  220DEF PROCdrawtint_fade(addr%):LOCAL r%,g%,b%,l%
  230IF !addr%<>&FFFFFFFF THEN
  240 IF drawtint_psyk%=0 THEN
  250  r%=addr%?1*drawtint_altred
  260  g%=addr%?2*drawtint_altgrn
  270  b%=addr%?3*drawtint_altblu
  280  IF drawtint_invt%=1 THEN r%=255-r%:g%=255-g%:b%=255-b%
  290  IF drawtint_mono%=1 THEN l%=(r%+g%+b%) DIV 3:r%=l%:g%=l%:b%=l%
  300  IF r%>255 THEN addr%?1=255 ELSE addr%?1=r%
  310  IF g%>255 THEN addr%?2=255 ELSE addr%?2=g%
  320  IF b%>255 THEN addr%?3=255 ELSE addr%?3=b%
  330 ELSE
  340  addr%?1=RND(256)-1
  350  addr%?2=RND(256)-1
  360  addr%?3=RND(256)-1
  370  ENDIF
  380ENDIF
  390ENDPROC
  400:
  410DEF FNdrawtint(in$,out$)
  420LOCAL in%,out%,word%,mem%,amount%,len%,c%,o%,olen%
  430drawtint_altred=VAL(FNicon_text(wind_hand%,1))/100
  440drawtint_altgrn=VAL(FNicon_text(wind_hand%,4))/100
  450drawtint_altblu=VAL(FNicon_text(wind_hand%,7))/100
  460drawtint_mono%=FNbutton_state(wind_hand%,9)
  470drawtint_invt%=FNbutton_state(wind_hand%,10)
  480drawtint_psyk%=FNbutton_state(wind_hand%,11)
  490in%=OPENUP(in$)
  500word%=FNdrawtint_getword(in%)
  510REM "DRAW" = &77617244 should be the first word of a draw file
  520IF word%<>&77617244 THEN PROCdrawtint_error("This is a corrupted Draw file.",99):CLOSE#in%:=1
  530word%=FNdrawtint_getword(in%)
  540REM Check version no. is 201 or less
  550IF word%>201 THEN PROCdrawtint_error("This is a more recent draw file format than this program can handle."):CLOSE#in%:=1
  560CLOSE#in%
  570REM Check whether there's any memory about
  580IF FNclaim_memory(ptr%,amount%)=0 THEN PROCdrawtint_error("There isn't any memory available to process file."):=1
  590REM Check whether there's enough memory
  600SYS "OS_File",23,in$ TO ,,,,len%
  610IF len%>amount% THEN PROCrelease_memory:PROCdrawtint_error("There isn't enough memory available to process file. You'll need "+STR$(INT((len%-amount%)/1024)+1)+"K more memory to do this."):=1
  620REM Load the file into memory
  630SYS "OS_File",16,in$,ptr%,0
  640:
  660REM Process file
  670c%=ptr%+40
  680REPEAT
  690SYS "Hourglass_Percentage",(c%-ptr%)/len%*100
  700REM Get object type and fade accordingly
  710o%=c%!0:olen%=c%!4
  720CASE o% OF
  730REM 1 is text, 2 is path, 12 is transformed text
  740REM 6 is group, 7 is tagged
  750 WHEN 1 : PROCdrawtint_fade(c%+24):PROCdrawtint_fade(c%+28)
  760 WHEN 2 : PROCdrawtint_fade(c%+24):PROCdrawtint_fade(c%+28)
  770 WHEN 6 : olen%=36
  780 WHEN 7 : olen%=28
  790 WHEN 12: PROCdrawtint_fade(c%+56):PROCdrawtint_fade(c%+60)
  800ENDCASE
  810c%=c%+olen%
  820UNTIL c%>=ptr%+len%
  840:
  850REM Save the file back
  860SYS "OS_File",10,out$,&AFF,,ptr%,ptr%+len%
  870PROCrelease_memory
  880=0
  890:
  900DEF FNdrawtint_help(window%,icon%)
  910LOCAL help%
  920IF window%=-1 THEN
  930 help$="Drop a draw file here to fade or brighten its colours."
  940ELSE
  950help$="Enter the amount you wish to fade or brighten colours.|M100% is normal, 50% is fade by half, 200% is brighten x2.|MYou can alter the red, green and blue elements individually."
  960IF icon%=9 THEN help$="Tick this box if you want the resulting image to be in black and white."
  970IF icon%=10 THEN help$="Tick this box if you want colours to be inverted before being processed.|MThis effectively fades/brightens from white rather than black."
  980IF icon%=11 THEN help$="Sorry, couldn't resist putting this one in!|MTick this one if you want the colours to be completely screwed up.|MFun, but useless."
  990ENDIF
 1000=help$
 1010:
 1020DEF PROCdrawtint_error(error$,no%)
 1030 !(drawtint_error%)=no%
 1040 $(drawtint_error%+4)=error$
 1050 SYS "Wimp_ReportError",drawtint_error%,1,"Draw fader"
 1060ENDPROC

� >DrawTint
 � Draw file colour processor
� by Matthew Bloch, Jan '95
(�
2:
<"� �drawtint_name = "Draw tint"
F3� �drawtint_args = "-in DrawFile -out DrawFile"
P:
Z� �drawtint_init
d� drawtint_error% 64
n=0
x:
�*� �drawtint_mouse(mx%,my%,mb%,mh%,mi%)
�=0
�:
�1� �drawtint_key(wh%,ic%,cx%,cy%,ch%,ci%,key%)
�=0
�:
�� �drawtint_getword(h%)
�/=�#h%+((�#h%)<<8)+((�#h%)<<16)+((�#h%)<<24)
�:
�)� �drawtint_fade(addr%):� r%,g%,b%,l%
�� !addr%<>&FFFFFFFF �
� � drawtint_psyk%=0 �
�   r%=addr%?1*drawtint_altred
   g%=addr%?2*drawtint_altgrn
   b%=addr%?3*drawtint_altblu
8  � drawtint_invt%=1 � r%=255-r%:g%=255-g%:b%=255-b%
">  � drawtint_mono%=1 � l%=(r%+g%+b%) � 3:r%=l%:g%=l%:b%=l%
,)  � r%>255 � addr%?1=255 � addr%?1=r%
6)  � g%>255 � addr%?2=255 � addr%?2=g%
@)  � b%>255 � addr%?3=255 � addr%?3=b%
J �
T  addr%?1=�(256)-1
^  addr%?2=�(256)-1
h  addr%?3=�(256)-1
r  �
|�
��
�:
�� �drawtint(in$,out$)
�2� in%,out%,word%,mem%,amount%,len%,c%,o%,olen%
�3drawtint_altred=�(�icon_text(wind_hand%,1))/100
�3drawtint_altgrn=�(�icon_text(wind_hand%,4))/100
�3drawtint_altblu=�(�icon_text(wind_hand%,7))/100
�.drawtint_mono%=�button_state(wind_hand%,9)
�/drawtint_invt%=�button_state(wind_hand%,10)
�/drawtint_psyk%=�button_state(wind_hand%,11)
�in%=�(in$)
� word%=�drawtint_getword(in%)
�@� "DRAW" = &77617244 should be the first word of a draw file
V� word%<>&77617244 � �drawtint_error("This is a corrupted Draw file.",99):�#in%:=1
 word%=�drawtint_getword(in%)
&� Check version no. is 201 or less
&r� word%>201 � �drawtint_error("This is a more recent draw file format than this program can handle."):�#in%:=1
0	�#in%
:,� Check whether there's any memory about
Dm� �claim_memory(ptr%,amount%)=0 � �drawtint_error("There isn't any memory available to process file."):=1
N)� Check whether there's enough memory
X"ș "OS_File",23,in$ � ,,,,len%
b�� len%>amount% � �release_memory:�drawtint_error("There isn't enough memory available to process file. You'll need "+�(�((len%-amount%)/1024)+1)+"K more memory to do this."):=1
l� Load the file into memory
vș "OS_File",16,in$,ptr%,0
�:
�� Process file
�c%=ptr%+40
��
�0ș "Hourglass_Percentage",(c%-ptr%)/len%*100
�*� Get object type and fade accordingly
�o%=c%!0:olen%=c%!4
�Ȏ o% �
�2� 1 is text, 2 is path, 12 is transformed text
�� 6 is group, 7 is tagged
�6 � 1 : �drawtint_fade(c%+24):�drawtint_fade(c%+28)
�6 � 2 : �drawtint_fade(c%+24):�drawtint_fade(c%+28)
 � 6 : olen%=36
 � 7 : olen%=28
6 � 12: �drawtint_fade(c%+56):�drawtint_fade(c%+60)
 �
*c%=c%+olen%
4� c%>=ptr%+len%
H:
R� Save the file back
\-ș "OS_File",10,out$,&AFF,,ptr%,ptr%+len%
f�release_memory
p=0
z:
�#� �drawtint_help(window%,icon%)
�� help%
�� window%=-1 �
�C help$="Drop a draw file here to fade or brighten its colours."
��
��help$="Enter the amount you wish to fade or brighten colours.|M100% is normal, 50% is fade by half, 200% is brighten x2.|MYou can alter the red, green and blue elements individually."
�_� icon%=9 � help$="Tick this box if you want the resulting image to be in black and white."
ʡ� icon%=10 � help$="Tick this box if you want colours to be inverted before being processed.|MThis effectively fades/brightens from white rather than black."
ԛ� icon%=11 � help$="Sorry, couldn't resist putting this one in!|MTick this one if you want the colours to be completely screwed up.|MFun, but useless."
��
�
=help$
�:
�!� �drawtint_error(error$,no%)
 !(drawtint_error%)=no%
  $(drawtint_error%+4)=error$
9 ș "Wimp_ReportError",drawtint_error%,1,"Draw fader"
$�
�
00000000  0d 00 0a 0f f4 20 3e 44  72 61 77 54 69 6e 74 0d  |..... >DrawTint.|
00000010  00 14 20 f4 20 44 72 61  77 20 66 69 6c 65 20 63  |.. . Draw file c|
00000020  6f 6c 6f 75 72 20 70 72  6f 63 65 73 73 6f 72 0d  |olour processor.|
00000030  00 1e 1f f4 20 62 79 20  4d 61 74 74 68 65 77 20  |.... by Matthew |
00000040  42 6c 6f 63 68 2c 20 4a  61 6e 20 27 39 35 0d 00  |Bloch, Jan '95..|
00000050  28 05 e0 0d 00 32 05 3a  0d 00 3c 22 dd 20 a4 64  |(....2.:..<". .d|
00000060  72 61 77 74 69 6e 74 5f  6e 61 6d 65 20 3d 20 22  |rawtint_name = "|
00000070  44 72 61 77 20 74 69 6e  74 22 0d 00 46 33 dd 20  |Draw tint"..F3. |
00000080  a4 64 72 61 77 74 69 6e  74 5f 61 72 67 73 20 3d  |.drawtint_args =|
00000090  20 22 2d 69 6e 20 44 72  61 77 46 69 6c 65 20 2d  | "-in DrawFile -|
000000a0  6f 75 74 20 44 72 61 77  46 69 6c 65 22 0d 00 50  |out DrawFile"..P|
000000b0  05 3a 0d 00 5a 14 dd 20  a4 64 72 61 77 74 69 6e  |.:..Z.. .drawtin|
000000c0  74 5f 69 6e 69 74 0d 00  64 18 de 20 64 72 61 77  |t_init..d.. draw|
000000d0  74 69 6e 74 5f 65 72 72  6f 72 25 20 36 34 0d 00  |tint_error% 64..|
000000e0  6e 06 3d 30 0d 00 78 05  3a 0d 00 82 2a dd 20 a4  |n.=0..x.:...*. .|
000000f0  64 72 61 77 74 69 6e 74  5f 6d 6f 75 73 65 28 6d  |drawtint_mouse(m|
00000100  78 25 2c 6d 79 25 2c 6d  62 25 2c 6d 68 25 2c 6d  |x%,my%,mb%,mh%,m|
00000110  69 25 29 0d 00 8c 06 3d  30 0d 00 96 05 3a 0d 00  |i%)....=0....:..|
00000120  a0 31 dd 20 a4 64 72 61  77 74 69 6e 74 5f 6b 65  |.1. .drawtint_ke|
00000130  79 28 77 68 25 2c 69 63  25 2c 63 78 25 2c 63 79  |y(wh%,ic%,cx%,cy|
00000140  25 2c 63 68 25 2c 63 69  25 2c 6b 65 79 25 29 0d  |%,ch%,ci%,key%).|
00000150  00 aa 06 3d 30 0d 00 b4  05 3a 0d 00 be 1b dd 20  |...=0....:..... |
00000160  a4 64 72 61 77 74 69 6e  74 5f 67 65 74 77 6f 72  |.drawtint_getwor|
00000170  64 28 68 25 29 0d 00 c8  2f 3d 9a 23 68 25 2b 28  |d(h%).../=.#h%+(|
00000180  28 9a 23 68 25 29 3c 3c  38 29 2b 28 28 9a 23 68  |(.#h%)<<8)+((.#h|
00000190  25 29 3c 3c 31 36 29 2b  28 28 9a 23 68 25 29 3c  |%)<<16)+((.#h%)<|
000001a0  3c 32 34 29 0d 00 d2 05  3a 0d 00 dc 29 dd 20 f2  |<24)....:...). .|
000001b0  64 72 61 77 74 69 6e 74  5f 66 61 64 65 28 61 64  |drawtint_fade(ad|
000001c0  64 72 25 29 3a ea 20 72  25 2c 67 25 2c 62 25 2c  |dr%):. r%,g%,b%,|
000001d0  6c 25 0d 00 e6 19 e7 20  21 61 64 64 72 25 3c 3e  |l%..... !addr%<>|
000001e0  26 46 46 46 46 46 46 46  46 20 8c 0d 00 f0 19 20  |&FFFFFFFF ..... |
000001f0  e7 20 64 72 61 77 74 69  6e 74 5f 70 73 79 6b 25  |. drawtint_psyk%|
00000200  3d 30 20 8c 0d 00 fa 20  20 20 72 25 3d 61 64 64  |=0 ....   r%=add|
00000210  72 25 3f 31 2a 64 72 61  77 74 69 6e 74 5f 61 6c  |r%?1*drawtint_al|
00000220  74 72 65 64 0d 01 04 20  20 20 67 25 3d 61 64 64  |tred...   g%=add|
00000230  72 25 3f 32 2a 64 72 61  77 74 69 6e 74 5f 61 6c  |r%?2*drawtint_al|
00000240  74 67 72 6e 0d 01 0e 20  20 20 62 25 3d 61 64 64  |tgrn...   b%=add|
00000250  72 25 3f 33 2a 64 72 61  77 74 69 6e 74 5f 61 6c  |r%?3*drawtint_al|
00000260  74 62 6c 75 0d 01 18 38  20 20 e7 20 64 72 61 77  |tblu...8  . draw|
00000270  74 69 6e 74 5f 69 6e 76  74 25 3d 31 20 8c 20 72  |tint_invt%=1 . r|
00000280  25 3d 32 35 35 2d 72 25  3a 67 25 3d 32 35 35 2d  |%=255-r%:g%=255-|
00000290  67 25 3a 62 25 3d 32 35  35 2d 62 25 0d 01 22 3e  |g%:b%=255-b%..">|
000002a0  20 20 e7 20 64 72 61 77  74 69 6e 74 5f 6d 6f 6e  |  . drawtint_mon|
000002b0  6f 25 3d 31 20 8c 20 6c  25 3d 28 72 25 2b 67 25  |o%=1 . l%=(r%+g%|
000002c0  2b 62 25 29 20 81 20 33  3a 72 25 3d 6c 25 3a 67  |+b%) . 3:r%=l%:g|
000002d0  25 3d 6c 25 3a 62 25 3d  6c 25 0d 01 2c 29 20 20  |%=l%:b%=l%..,)  |
000002e0  e7 20 72 25 3e 32 35 35  20 8c 20 61 64 64 72 25  |. r%>255 . addr%|
000002f0  3f 31 3d 32 35 35 20 8b  20 61 64 64 72 25 3f 31  |?1=255 . addr%?1|
00000300  3d 72 25 0d 01 36 29 20  20 e7 20 67 25 3e 32 35  |=r%..6)  . g%>25|
00000310  35 20 8c 20 61 64 64 72  25 3f 32 3d 32 35 35 20  |5 . addr%?2=255 |
00000320  8b 20 61 64 64 72 25 3f  32 3d 67 25 0d 01 40 29  |. addr%?2=g%..@)|
00000330  20 20 e7 20 62 25 3e 32  35 35 20 8c 20 61 64 64  |  . b%>255 . add|
00000340  72 25 3f 33 3d 32 35 35  20 8b 20 61 64 64 72 25  |r%?3=255 . addr%|
00000350  3f 33 3d 62 25 0d 01 4a  06 20 cc 0d 01 54 16 20  |?3=b%..J. ...T. |
00000360  20 61 64 64 72 25 3f 31  3d b3 28 32 35 36 29 2d  | addr%?1=.(256)-|
00000370  31 0d 01 5e 16 20 20 61  64 64 72 25 3f 32 3d b3  |1..^.  addr%?2=.|
00000380  28 32 35 36 29 2d 31 0d  01 68 16 20 20 61 64 64  |(256)-1..h.  add|
00000390  72 25 3f 33 3d b3 28 32  35 36 29 2d 31 0d 01 72  |r%?3=.(256)-1..r|
000003a0  07 20 20 cd 0d 01 7c 05  cd 0d 01 86 05 e1 0d 01  |.  ...|.........|
000003b0  90 05 3a 0d 01 9a 19 dd  20 a4 64 72 61 77 74 69  |..:..... .drawti|
000003c0  6e 74 28 69 6e 24 2c 6f  75 74 24 29 0d 01 a4 32  |nt(in$,out$)...2|
000003d0  ea 20 69 6e 25 2c 6f 75  74 25 2c 77 6f 72 64 25  |. in%,out%,word%|
000003e0  2c 6d 65 6d 25 2c 61 6d  6f 75 6e 74 25 2c 6c 65  |,mem%,amount%,le|
000003f0  6e 25 2c 63 25 2c 6f 25  2c 6f 6c 65 6e 25 0d 01  |n%,c%,o%,olen%..|
00000400  ae 33 64 72 61 77 74 69  6e 74 5f 61 6c 74 72 65  |.3drawtint_altre|
00000410  64 3d bb 28 a4 69 63 6f  6e 5f 74 65 78 74 28 77  |d=.(.icon_text(w|
00000420  69 6e 64 5f 68 61 6e 64  25 2c 31 29 29 2f 31 30  |ind_hand%,1))/10|
00000430  30 0d 01 b8 33 64 72 61  77 74 69 6e 74 5f 61 6c  |0...3drawtint_al|
00000440  74 67 72 6e 3d bb 28 a4  69 63 6f 6e 5f 74 65 78  |tgrn=.(.icon_tex|
00000450  74 28 77 69 6e 64 5f 68  61 6e 64 25 2c 34 29 29  |t(wind_hand%,4))|
00000460  2f 31 30 30 0d 01 c2 33  64 72 61 77 74 69 6e 74  |/100...3drawtint|
00000470  5f 61 6c 74 62 6c 75 3d  bb 28 a4 69 63 6f 6e 5f  |_altblu=.(.icon_|
00000480  74 65 78 74 28 77 69 6e  64 5f 68 61 6e 64 25 2c  |text(wind_hand%,|
00000490  37 29 29 2f 31 30 30 0d  01 cc 2e 64 72 61 77 74  |7))/100....drawt|
000004a0  69 6e 74 5f 6d 6f 6e 6f  25 3d a4 62 75 74 74 6f  |int_mono%=.butto|
000004b0  6e 5f 73 74 61 74 65 28  77 69 6e 64 5f 68 61 6e  |n_state(wind_han|
000004c0  64 25 2c 39 29 0d 01 d6  2f 64 72 61 77 74 69 6e  |d%,9).../drawtin|
000004d0  74 5f 69 6e 76 74 25 3d  a4 62 75 74 74 6f 6e 5f  |t_invt%=.button_|
000004e0  73 74 61 74 65 28 77 69  6e 64 5f 68 61 6e 64 25  |state(wind_hand%|
000004f0  2c 31 30 29 0d 01 e0 2f  64 72 61 77 74 69 6e 74  |,10).../drawtint|
00000500  5f 70 73 79 6b 25 3d a4  62 75 74 74 6f 6e 5f 73  |_psyk%=.button_s|
00000510  74 61 74 65 28 77 69 6e  64 5f 68 61 6e 64 25 2c  |tate(wind_hand%,|
00000520  31 31 29 0d 01 ea 0e 69  6e 25 3d ad 28 69 6e 24  |11)....in%=.(in$|
00000530  29 0d 01 f4 20 77 6f 72  64 25 3d a4 64 72 61 77  |)... word%=.draw|
00000540  74 69 6e 74 5f 67 65 74  77 6f 72 64 28 69 6e 25  |tint_getword(in%|
00000550  29 0d 01 fe 40 f4 20 22  44 52 41 57 22 20 3d 20  |)...@. "DRAW" = |
00000560  26 37 37 36 31 37 32 34  34 20 73 68 6f 75 6c 64  |&77617244 should|
00000570  20 62 65 20 74 68 65 20  66 69 72 73 74 20 77 6f  | be the first wo|
00000580  72 64 20 6f 66 20 61 20  64 72 61 77 20 66 69 6c  |rd of a draw fil|
00000590  65 0d 02 08 56 e7 20 77  6f 72 64 25 3c 3e 26 37  |e...V. word%<>&7|
000005a0  37 36 31 37 32 34 34 20  8c 20 f2 64 72 61 77 74  |7617244 . .drawt|
000005b0  69 6e 74 5f 65 72 72 6f  72 28 22 54 68 69 73 20  |int_error("This |
000005c0  69 73 20 61 20 63 6f 72  72 75 70 74 65 64 20 44  |is a corrupted D|
000005d0  72 61 77 20 66 69 6c 65  2e 22 2c 39 39 29 3a d9  |raw file.",99):.|
000005e0  23 69 6e 25 3a 3d 31 0d  02 12 20 77 6f 72 64 25  |#in%:=1... word%|
000005f0  3d a4 64 72 61 77 74 69  6e 74 5f 67 65 74 77 6f  |=.drawtint_getwo|
00000600  72 64 28 69 6e 25 29 0d  02 1c 26 f4 20 43 68 65  |rd(in%)...&. Che|
00000610  63 6b 20 76 65 72 73 69  6f 6e 20 6e 6f 2e 20 69  |ck version no. i|
00000620  73 20 32 30 31 20 6f 72  20 6c 65 73 73 0d 02 26  |s 201 or less..&|
00000630  72 e7 20 77 6f 72 64 25  3e 32 30 31 20 8c 20 f2  |r. word%>201 . .|
00000640  64 72 61 77 74 69 6e 74  5f 65 72 72 6f 72 28 22  |drawtint_error("|
00000650  54 68 69 73 20 69 73 20  61 20 6d 6f 72 65 20 72  |This is a more r|
00000660  65 63 65 6e 74 20 64 72  61 77 20 66 69 6c 65 20  |ecent draw file |
00000670  66 6f 72 6d 61 74 20 74  68 61 6e 20 74 68 69 73  |format than this|
00000680  20 70 72 6f 67 72 61 6d  20 63 61 6e 20 68 61 6e  | program can han|
00000690  64 6c 65 2e 22 29 3a d9  23 69 6e 25 3a 3d 31 0d  |dle."):.#in%:=1.|
000006a0  02 30 09 d9 23 69 6e 25  0d 02 3a 2c f4 20 43 68  |.0..#in%..:,. Ch|
000006b0  65 63 6b 20 77 68 65 74  68 65 72 20 74 68 65 72  |eck whether ther|
000006c0  65 27 73 20 61 6e 79 20  6d 65 6d 6f 72 79 20 61  |e's any memory a|
000006d0  62 6f 75 74 0d 02 44 6d  e7 20 a4 63 6c 61 69 6d  |bout..Dm. .claim|
000006e0  5f 6d 65 6d 6f 72 79 28  70 74 72 25 2c 61 6d 6f  |_memory(ptr%,amo|
000006f0  75 6e 74 25 29 3d 30 20  8c 20 f2 64 72 61 77 74  |unt%)=0 . .drawt|
00000700  69 6e 74 5f 65 72 72 6f  72 28 22 54 68 65 72 65  |int_error("There|
00000710  20 69 73 6e 27 74 20 61  6e 79 20 6d 65 6d 6f 72  | isn't any memor|
00000720  79 20 61 76 61 69 6c 61  62 6c 65 20 74 6f 20 70  |y available to p|
00000730  72 6f 63 65 73 73 20 66  69 6c 65 2e 22 29 3a 3d  |rocess file."):=|
00000740  31 0d 02 4e 29 f4 20 43  68 65 63 6b 20 77 68 65  |1..N). Check whe|
00000750  74 68 65 72 20 74 68 65  72 65 27 73 20 65 6e 6f  |ther there's eno|
00000760  75 67 68 20 6d 65 6d 6f  72 79 0d 02 58 22 c8 99  |ugh memory..X"..|
00000770  20 22 4f 53 5f 46 69 6c  65 22 2c 32 33 2c 69 6e  | "OS_File",23,in|
00000780  24 20 b8 20 2c 2c 2c 2c  6c 65 6e 25 0d 02 62 b4  |$ . ,,,,len%..b.|
00000790  e7 20 6c 65 6e 25 3e 61  6d 6f 75 6e 74 25 20 8c  |. len%>amount% .|
000007a0  20 f2 72 65 6c 65 61 73  65 5f 6d 65 6d 6f 72 79  | .release_memory|
000007b0  3a f2 64 72 61 77 74 69  6e 74 5f 65 72 72 6f 72  |:.drawtint_error|
000007c0  28 22 54 68 65 72 65 20  69 73 6e 27 74 20 65 6e  |("There isn't en|
000007d0  6f 75 67 68 20 6d 65 6d  6f 72 79 20 61 76 61 69  |ough memory avai|
000007e0  6c 61 62 6c 65 20 74 6f  20 70 72 6f 63 65 73 73  |lable to process|
000007f0  20 66 69 6c 65 2e 20 59  6f 75 27 6c 6c 20 6e 65  | file. You'll ne|
00000800  65 64 20 22 2b c3 28 a8  28 28 6c 65 6e 25 2d 61  |ed "+.(.((len%-a|
00000810  6d 6f 75 6e 74 25 29 2f  31 30 32 34 29 2b 31 29  |mount%)/1024)+1)|
00000820  2b 22 4b 20 6d 6f 72 65  20 6d 65 6d 6f 72 79 20  |+"K more memory |
00000830  74 6f 20 64 6f 20 74 68  69 73 2e 22 29 3a 3d 31  |to do this."):=1|
00000840  0d 02 6c 1f f4 20 4c 6f  61 64 20 74 68 65 20 66  |..l.. Load the f|
00000850  69 6c 65 20 69 6e 74 6f  20 6d 65 6d 6f 72 79 0d  |ile into memory.|
00000860  02 76 1e c8 99 20 22 4f  53 5f 46 69 6c 65 22 2c  |.v... "OS_File",|
00000870  31 36 2c 69 6e 24 2c 70  74 72 25 2c 30 0d 02 80  |16,in$,ptr%,0...|
00000880  05 3a 0d 02 94 12 f4 20  50 72 6f 63 65 73 73 20  |.:..... Process |
00000890  66 69 6c 65 0d 02 9e 0e  63 25 3d 70 74 72 25 2b  |file....c%=ptr%+|
000008a0  34 30 0d 02 a8 05 f5 0d  02 b2 30 c8 99 20 22 48  |40........0.. "H|
000008b0  6f 75 72 67 6c 61 73 73  5f 50 65 72 63 65 6e 74  |ourglass_Percent|
000008c0  61 67 65 22 2c 28 63 25  2d 70 74 72 25 29 2f 6c  |age",(c%-ptr%)/l|
000008d0  65 6e 25 2a 31 30 30 0d  02 bc 2a f4 20 47 65 74  |en%*100...*. Get|
000008e0  20 6f 62 6a 65 63 74 20  74 79 70 65 20 61 6e 64  | object type and|
000008f0  20 66 61 64 65 20 61 63  63 6f 72 64 69 6e 67 6c  | fade accordingl|
00000900  79 0d 02 c6 16 6f 25 3d  63 25 21 30 3a 6f 6c 65  |y....o%=c%!0:ole|
00000910  6e 25 3d 63 25 21 34 0d  02 d0 0b c8 8e 20 6f 25  |n%=c%!4...... o%|
00000920  20 ca 0d 02 da 32 f4 20  31 20 69 73 20 74 65 78  | ....2. 1 is tex|
00000930  74 2c 20 32 20 69 73 20  70 61 74 68 2c 20 31 32  |t, 2 is path, 12|
00000940  20 69 73 20 74 72 61 6e  73 66 6f 72 6d 65 64 20  | is transformed |
00000950  74 65 78 74 0d 02 e4 1d  f4 20 36 20 69 73 20 67  |text..... 6 is g|
00000960  72 6f 75 70 2c 20 37 20  69 73 20 74 61 67 67 65  |roup, 7 is tagge|
00000970  64 0d 02 ee 36 20 c9 20  31 20 3a 20 f2 64 72 61  |d...6 . 1 : .dra|
00000980  77 74 69 6e 74 5f 66 61  64 65 28 63 25 2b 32 34  |wtint_fade(c%+24|
00000990  29 3a f2 64 72 61 77 74  69 6e 74 5f 66 61 64 65  |):.drawtint_fade|
000009a0  28 63 25 2b 32 38 29 0d  02 f8 36 20 c9 20 32 20  |(c%+28)...6 . 2 |
000009b0  3a 20 f2 64 72 61 77 74  69 6e 74 5f 66 61 64 65  |: .drawtint_fade|
000009c0  28 63 25 2b 32 34 29 3a  f2 64 72 61 77 74 69 6e  |(c%+24):.drawtin|
000009d0  74 5f 66 61 64 65 28 63  25 2b 32 38 29 0d 03 02  |t_fade(c%+28)...|
000009e0  13 20 c9 20 36 20 3a 20  6f 6c 65 6e 25 3d 33 36  |. . 6 : olen%=36|
000009f0  0d 03 0c 13 20 c9 20 37  20 3a 20 6f 6c 65 6e 25  |.... . 7 : olen%|
00000a00  3d 32 38 0d 03 16 36 20  c9 20 31 32 3a 20 f2 64  |=28...6 . 12: .d|
00000a10  72 61 77 74 69 6e 74 5f  66 61 64 65 28 63 25 2b  |rawtint_fade(c%+|
00000a20  35 36 29 3a f2 64 72 61  77 74 69 6e 74 5f 66 61  |56):.drawtint_fa|
00000a30  64 65 28 63 25 2b 36 30  29 0d 03 20 05 cb 0d 03  |de(c%+60).. ....|
00000a40  2a 0f 63 25 3d 63 25 2b  6f 6c 65 6e 25 0d 03 34  |*.c%=c%+olen%..4|
00000a50  13 fd 20 63 25 3e 3d 70  74 72 25 2b 6c 65 6e 25  |.. c%>=ptr%+len%|
00000a60  0d 03 48 05 3a 0d 03 52  18 f4 20 53 61 76 65 20  |..H.:..R.. Save |
00000a70  74 68 65 20 66 69 6c 65  20 62 61 63 6b 0d 03 5c  |the file back..\|
00000a80  2d c8 99 20 22 4f 53 5f  46 69 6c 65 22 2c 31 30  |-.. "OS_File",10|
00000a90  2c 6f 75 74 24 2c 26 41  46 46 2c 2c 70 74 72 25  |,out$,&AFF,,ptr%|
00000aa0  2c 70 74 72 25 2b 6c 65  6e 25 0d 03 66 13 f2 72  |,ptr%+len%..f..r|
00000ab0  65 6c 65 61 73 65 5f 6d  65 6d 6f 72 79 0d 03 70  |elease_memory..p|
00000ac0  06 3d 30 0d 03 7a 05 3a  0d 03 84 23 dd 20 a4 64  |.=0..z.:...#. .d|
00000ad0  72 61 77 74 69 6e 74 5f  68 65 6c 70 28 77 69 6e  |rawtint_help(win|
00000ae0  64 6f 77 25 2c 69 63 6f  6e 25 29 0d 03 8e 0b ea  |dow%,icon%).....|
00000af0  20 68 65 6c 70 25 0d 03  98 12 e7 20 77 69 6e 64  | help%..... wind|
00000b00  6f 77 25 3d 2d 31 20 8c  0d 03 a2 43 20 68 65 6c  |ow%=-1 ....C hel|
00000b10  70 24 3d 22 44 72 6f 70  20 61 20 64 72 61 77 20  |p$="Drop a draw |
00000b20  66 69 6c 65 20 68 65 72  65 20 74 6f 20 66 61 64  |file here to fad|
00000b30  65 20 6f 72 20 62 72 69  67 68 74 65 6e 20 69 74  |e or brighten it|
00000b40  73 20 63 6f 6c 6f 75 72  73 2e 22 0d 03 ac 05 cc  |s colours.".....|
00000b50  0d 03 b6 bb 68 65 6c 70  24 3d 22 45 6e 74 65 72  |....help$="Enter|
00000b60  20 74 68 65 20 61 6d 6f  75 6e 74 20 79 6f 75 20  | the amount you |
00000b70  77 69 73 68 20 74 6f 20  66 61 64 65 20 6f 72 20  |wish to fade or |
00000b80  62 72 69 67 68 74 65 6e  20 63 6f 6c 6f 75 72 73  |brighten colours|
00000b90  2e 7c 4d 31 30 30 25 20  69 73 20 6e 6f 72 6d 61  |.|M100% is norma|
00000ba0  6c 2c 20 35 30 25 20 69  73 20 66 61 64 65 20 62  |l, 50% is fade b|
00000bb0  79 20 68 61 6c 66 2c 20  32 30 30 25 20 69 73 20  |y half, 200% is |
00000bc0  62 72 69 67 68 74 65 6e  20 78 32 2e 7c 4d 59 6f  |brighten x2.|MYo|
00000bd0  75 20 63 61 6e 20 61 6c  74 65 72 20 74 68 65 20  |u can alter the |
00000be0  72 65 64 2c 20 67 72 65  65 6e 20 61 6e 64 20 62  |red, green and b|
00000bf0  6c 75 65 20 65 6c 65 6d  65 6e 74 73 20 69 6e 64  |lue elements ind|
00000c00  69 76 69 64 75 61 6c 6c  79 2e 22 0d 03 c0 5f e7  |ividually."..._.|
00000c10  20 69 63 6f 6e 25 3d 39  20 8c 20 68 65 6c 70 24  | icon%=9 . help$|
00000c20  3d 22 54 69 63 6b 20 74  68 69 73 20 62 6f 78 20  |="Tick this box |
00000c30  69 66 20 79 6f 75 20 77  61 6e 74 20 74 68 65 20  |if you want the |
00000c40  72 65 73 75 6c 74 69 6e  67 20 69 6d 61 67 65 20  |resulting image |
00000c50  74 6f 20 62 65 20 69 6e  20 62 6c 61 63 6b 20 61  |to be in black a|
00000c60  6e 64 20 77 68 69 74 65  2e 22 0d 03 ca a1 e7 20  |nd white."..... |
00000c70  69 63 6f 6e 25 3d 31 30  20 8c 20 68 65 6c 70 24  |icon%=10 . help$|
00000c80  3d 22 54 69 63 6b 20 74  68 69 73 20 62 6f 78 20  |="Tick this box |
00000c90  69 66 20 79 6f 75 20 77  61 6e 74 20 63 6f 6c 6f  |if you want colo|
00000ca0  75 72 73 20 74 6f 20 62  65 20 69 6e 76 65 72 74  |urs to be invert|
00000cb0  65 64 20 62 65 66 6f 72  65 20 62 65 69 6e 67 20  |ed before being |
00000cc0  70 72 6f 63 65 73 73 65  64 2e 7c 4d 54 68 69 73  |processed.|MThis|
00000cd0  20 65 66 66 65 63 74 69  76 65 6c 79 20 66 61 64  | effectively fad|
00000ce0  65 73 2f 62 72 69 67 68  74 65 6e 73 20 66 72 6f  |es/brightens fro|
00000cf0  6d 20 77 68 69 74 65 20  72 61 74 68 65 72 20 74  |m white rather t|
00000d00  68 61 6e 20 62 6c 61 63  6b 2e 22 0d 03 d4 9b e7  |han black.".....|
00000d10  20 69 63 6f 6e 25 3d 31  31 20 8c 20 68 65 6c 70  | icon%=11 . help|
00000d20  24 3d 22 53 6f 72 72 79  2c 20 63 6f 75 6c 64 6e  |$="Sorry, couldn|
00000d30  27 74 20 72 65 73 69 73  74 20 70 75 74 74 69 6e  |'t resist puttin|
00000d40  67 20 74 68 69 73 20 6f  6e 65 20 69 6e 21 7c 4d  |g this one in!|M|
00000d50  54 69 63 6b 20 74 68 69  73 20 6f 6e 65 20 69 66  |Tick this one if|
00000d60  20 79 6f 75 20 77 61 6e  74 20 74 68 65 20 63 6f  | you want the co|
00000d70  6c 6f 75 72 73 20 74 6f  20 62 65 20 63 6f 6d 70  |lours to be comp|
00000d80  6c 65 74 65 6c 79 20 73  63 72 65 77 65 64 20 75  |letely screwed u|
00000d90  70 2e 7c 4d 46 75 6e 2c  20 62 75 74 20 75 73 65  |p.|MFun, but use|
00000da0  6c 65 73 73 2e 22 0d 03  de 05 cd 0d 03 e8 0a 3d  |less.".........=|
00000db0  68 65 6c 70 24 0d 03 f2  05 3a 0d 03 fc 21 dd 20  |help$....:...!. |
00000dc0  f2 64 72 61 77 74 69 6e  74 5f 65 72 72 6f 72 28  |.drawtint_error(|
00000dd0  65 72 72 6f 72 24 2c 6e  6f 25 29 0d 04 06 1b 20  |error$,no%).... |
00000de0  21 28 64 72 61 77 74 69  6e 74 5f 65 72 72 6f 72  |!(drawtint_error|
00000df0  25 29 3d 6e 6f 25 0d 04  10 20 20 24 28 64 72 61  |%)=no%...  $(dra|
00000e00  77 74 69 6e 74 5f 65 72  72 6f 72 25 2b 34 29 3d  |wtint_error%+4)=|
00000e10  65 72 72 6f 72 24 0d 04  1a 39 20 c8 99 20 22 57  |error$...9 .. "W|
00000e20  69 6d 70 5f 52 65 70 6f  72 74 45 72 72 6f 72 22  |imp_ReportError"|
00000e30  2c 64 72 61 77 74 69 6e  74 5f 65 72 72 6f 72 25  |,drawtint_error%|
00000e40  2c 31 2c 22 44 72 61 77  20 66 61 64 65 72 22 0d  |,1,"Draw fader".|
00000e50  04 24 05 e1 0d ff                                 |.$....|
00000e56