# $Id: Makefile,v 1.4 2002/03/03 02:14:36 danbri Exp $
# RDFWeb / FOAFWho experiments with SVG and grep^h^h^h^hXSLT
# danbri@w3.org 
#
# Tests that use Batik's SVG rasterizer to transform SVG photo annotations into
# various kinds of derrived JPEG images.
#
# Batik commandline options type:  java -jar batik-rasterizer.jar
# 
# Notes:
# 1. I can't get the -q option for image quality to work, yet Batik complains I've not supplied it


QUALARGS=  				# used for -q (unsuccessfully, see (1.) above
TEST1=rdfweb-chaals-and-dan
					# base name for image files

VALARG= #-validate 			# we *don't* validate! (Amaya didn't set a DOCTYPE
					# todo, add DOCTYPE

CHANGED=_tmp
					# home for temporary files
SMALLBEERSIZE=-a 370,375,70,90
CLIPSIZE=-w 70 -h 90

#transparent b/g (for PNG)
BG=-bg 0.0.0.0

danbg:
	java -jar batik-rasterizer.jar -bg 0.0.0.0 t1.svg
# dan with transparent b/g


all:	danbri
				# Do 'make danbri' or 'make chaals' to cut the other one out of the picture!
				# sensible defaults ;-)


danbri:	highlightdanbri rasterize display
chaals:	highlightchaals rasterize display
beer:	highlightbeer rasterize display
smallbeer: highlightbeer rasterizesmallbeer displaypng 
beerclipart: rasterizeclipart 
	display _smallbeer_clipart.png

rasterizeclipart:
	java -jar batik-rasterizer.jar $(VALARG) $(SMALLBEERSIZE) $(CLIPSIZE) $(QUALARGS) _smallbeer_clipart.svg



					# Switching this decides which of us to grep out 
					# Note: SVG and XSLT knowhow sorely needed


## Transformation 
##
## Some basic image transformations
## Idea is we take an input SVG, do something to it, and then rasterize the output
## In our example all we know is that the shapes for danbri and chaals have id="danbri" and id="chaals"
## 

highlightdanbri:
	grep -v chaals  $(TEST1).svg | grep -v beer > $(CHANGED).svg

highlightchaals: 
	grep -v danbri  $(TEST1).svg | grep -v beer > $(CHANGED).svg

highlightbeer: 
	grep -v danbri  $(TEST1).svg | grep -v chaals > $(CHANGED).svg

rasterizesmallbeer: 
	java -jar batik-rasterizer.jar $(VALARG) $(SMALLBEERSIZE) $(QUALARGS) $(CHANGED).svg

# Feed it to Batik to make a JPEG
rasterize:
	rm -f $(TEST1).jpg
	java -jar batik-rasterizer.jar $(VALARG) -m image/jpeg $(QUALARGS) $(CHANGED).svg


display:
	display $(CHANGED).jpg &


#this is a mess, should write proper scripts to handle all this...
# the png is generated as has b/g transparency
displaypng:
	display $(CHANGED).png &

# 
# Batik notes:
#
#java -jar batik-rasterizer.jar -d myDir -m image/jpg samples\*.svg will generate JPEG images for all the SVG files found in the samples directory.


