#  DerezPict
#  Copyright Apple Computer, Inc. 1987,1988
#
#  This script reads a PICT file (where the pict
#  info is stored after the 512th byte in the
#  data fork, and derez'es it into a pict resource,
#  writing to standard output.
#
#  Note: this script doesn't handle any errors
#        that might unexpectedly occur
#
#  Tom Taylor
#  Tuesday, December 1, 1987 1:12:02 PM

if {#} != 1
	echo syntax is: {0} pictFileName
	exit 1
end
echo "read 'PICT' (1) ∂"{1}∂";" | rez	# read the pict file's data fork and
										# save it as a PICT resource in rez.out
derez rez.out > DerezPict.tmp			# turn the PICT resource into a hex dump
target DerezPict.tmp					# open the temporary hex dump file
find 2									# move to the first line of the hex dump
clear §:!31								# clear the 512 header bytes
rez DerezPict.tmp						# recompile the PICT resource
close -n DerezPict.tmp					# toss the temporary hex dump file
derez rez.out pict.r					# finally derez the PICT using the
										# template found in pict.r
delete DerezPict.tmp rez.out			# throw away our temporary files
