Commit 35786c02 authored by gerd's avatar gerd

Porting to GIMP 2.0


git-svn-id: https://godirepo.camlcity.org/svn/app-presentation/trunk@14 50e5f3cf-a9f2-0310-83d8-d11ec64cb5ab
parent c94ade95
......@@ -31,7 +31,9 @@ OCAMLOPT = ocamlfind ocamlopt -p $(OPTIONS) -package "$(REQUIRES)"
OCAMLDEP = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind
depend: *.ml *.mli
.PRECIOUS: depend
depend: *.ml
$(OCAMLDEP) *.ml *.mli >depend
.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll .mly
......@@ -50,4 +52,4 @@ depend: *.ml *.mli
*.mli:
include depend
-include depend
......@@ -11,12 +11,38 @@
# $8: The shadow color
# $9: The background color
verbose=0
if [ "X$1" = "X-verbose" ]; then
verbose=1
shift
fi
echo "*** Creating $2"
# First check the version of "gimp":
v=`gimp --version | sed -e 's/^GIMP Version //'`
case "$v" in
1.0*) scmscript="make-headline-1.0.scm" ;;
1.1*) echo "Warning: This is a development version of GIMP with unstable interfaces"
scmscript="make-headline-1.1.11.scm" ;;
1.2*) echo "Error: GIMP version not supported!"
exit 1 ;;
2.0*) scmscript="make-headline-2.0.scm" ;;
*) echo "Error: GIMP version not supported!"
esac
rm -f "$2"
test -f "$2" && exit 1 # If I can't write in this directory, exit now
gimp --no-interface --batch "(begin (load \"$PRESENTATION/make-headline.scm\") (make-headline \"$1\" \"$2\" \"$3\" $4 \"$5\" \"$6\" \"$7\" \"$8\" \"$9\" ))" '(gimp-quit 0)'
scm="(begin (load \"$PRESENTATION/$scmscript\") (make-headline \"$1\" \"$2\" \"$3\" $4 \"$5\" \"$6\" \"$7\" \"$8\" \"$9\" ))"
if [ "$verbose" -gt 0 ]; then
echo "Running Scheme Command: $scm"
fi
gimp --no-interface --batch "$scm" '(gimp-quit 0)'
# The exit code of this script is the code of the following test:
test -f "$2"
; Start this script with:
; gimp -b '(begin (load "make-headline.scm") (make-headline "berschrift" "headline.gif"))' '(gimp-quit 0)'
;**********************************************************************
;From: gimp-headers.scm
;**********************************************************************
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; www.gimp.org web headers
; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu
;
; based on a idea by jtl (Jens Lautenbacher)
; and improved by jtl
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
; **NOTE** This fonts use some very common fonts, that are typically
; bitmap fonts on most installations. If you want better quality versions
; you need to grab the urw font package form www.gimp.org/fonts.html
; and install as indicated. This will replace the some current bitmap fonts
; with higher quality vector fonts. This is how the actual www.gimp.org
; logos were created.
;
; ************************************************************************
; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
; For use with GIMP 1.1.
; All calls to gimp-text-* have been converted to use the *-fontname form.
; The corresponding parameters have been replaced by an SF-FONT parameter.
; ************************************************************************
(define (my-script-fu-headers-gimp-org text font font-size text-color high-color side-color shadow-color bg-color crop rm-bg index num-colors)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0
text 30 TRUE font-size PIXELS
font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL))) ; old: RGB_IMAGE
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
)
(gimp-image-undo-disable img) ; old: gimp-image-disable-undo
(gimp-image-resize img width height 0 0)
(gimp-image-add-layer img bg-layer 1)
(gimp-layer-set-preserve-trans text-layer TRUE)
(gimp-palette-set-background text-color)
(gimp-edit-fill text-layer BACKGROUND-FILL)
(gimp-palette-set-background bg-color)
(gimp-edit-fill bg-layer BACKGROUND-FILL)
(let* ((highlight-layer (car (gimp-layer-copy text-layer TRUE)))
(side-layer (car (gimp-layer-copy text-layer TRUE)))
(shadow-layer (car (gimp-layer-copy text-layer TRUE))))
(gimp-image-add-layer img highlight-layer 1)
(gimp-layer-set-preserve-trans highlight-layer TRUE)
(gimp-image-add-layer img side-layer 1)
(gimp-layer-set-preserve-trans side-layer TRUE)
(gimp-image-add-layer img shadow-layer 1)
(gimp-layer-set-preserve-trans shadow-layer TRUE)
(gimp-palette-set-background high-color)
(gimp-edit-fill highlight-layer BACKGROUND-FILL)
(gimp-layer-translate highlight-layer -1 -1)
(gimp-palette-set-background side-color)
(gimp-edit-fill side-layer BACKGROUND-FILL)
(gimp-layer-translate side-layer 1 1)
(gimp-palette-set-background shadow-color)
(gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-layer-translate shadow-layer 5 5)
(gimp-layer-set-preserve-trans shadow-layer FALSE)
(plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
(gimp-layer-set-opacity shadow-layer 60)
(gimp-image-lower-layer img shadow-layer)
(gimp-image-lower-layer img shadow-layer))
(set! text-layer (car (gimp-image-flatten img)))
(gimp-layer-add-alpha text-layer)
(if (= rm-bg TRUE)
(begin
(gimp-by-color-select text-layer bg-color
1 REPLACE TRUE FALSE 0 FALSE)
(gimp-edit-clear text-layer)
(gimp-selection-clear img)))
(if (= crop TRUE)
(plug-in-autocrop 1 img text-layer))
; old: (gimp-convert-indexed img TRUE num-colors)
(if (= index TRUE)
(gimp-convert-indexed img 1 0 num-colors FALSE TRUE ""))
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-image-undo-enable img) ; old: gimp-image-enable-undo
; We do not need the image to be displayed:
; ORIG: (gimp-display-new img)
; But we need the image to save it on disk:
img
))
;**********************************************************************
(define (color-triple hexnumber)
(let*
((red-hex (substring hexnumber 0 2))
(green-hex (substring hexnumber 2 4))
(blue-hex (substring hexnumber 4 6))
(red-val (string->number red-hex 16))
(green-val (string->number green-hex 16))
(blue-val (string->number blue-hex 16)))
(list red-val green-val blue-val)))
(define (make-headline text filename font font-size text-color high-color
side-color shadow-color bg-color)
(let*
((header
(my-script-fu-headers-gimp-org
text
font ;"-*-geometric 706-black-r-normal-*-*-*-*-*-p-*-iso8859-1"
font-size
(color-triple text-color) ; '(82 108 159) = 526c9f
(color-triple high-color) ; '(192 220 251) = c0dcfb
(color-triple side-color) ; '(46 74 92) = 2e4a5c
(color-triple shadow-color) ; '(0 0 0) = 000000
(color-triple bg-color) ; '(255 255 255) = ffffff
TRUE
FALSE
TRUE
15)))
(file-gif-save
1
header
header
filename
filename
FALSE
FALSE
1
0)
(writes nil "Script-fu successfully completed.\n")
(fflush nil)
)
)
#! /bin/sh
PRESENTATION=..
export PRESENTATION
../make-headline \
-verbose \
"Sample" \
sample-headline.gif \
"-*-courier-medium-r-*-*-*-*-*-*-*-*-iso8859-1" \
34 \
526c9f \
c0dcfb \
2e4a5c \
000000 \
ffffcc
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE presentation SYSTEM "../presentation.dtd">
<presentation>
<layout name="indent"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;]]></layout>
<layout name="page"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- WARNING! This is a generated file, do not edit! -->
<html>
<head>
<title>@TITLE@</title>
@PREVLINK@
@NEXTLINK@
</head>
<body bgcolor="#ffffcc"
text="black"
link="#4a708b"
alink="#4a708b"
vlink="#4a708b"
marginwidth="0"
marginheight="0"
style="margin:0px"
>
<table cellpadding="0" bgcolor="#ffffcc">
<tr><td height="20">&nbsp;</td></tr>
<tr>
<td width="10">&nbsp;</td>
<td width="200" valign="top" nowrap>
<font size=2><b>NAVIGATION</b></font><br><br>
<font size=2><a href="@UPURL@">@UPTITLE@</a></font>
<br>
<table border=0 cellpadding=0 cellspacing=0>
@LEVEL@
</table><br><br>
@RELATED@
<br><br><font size=1><a href="/imprint.html">Contact</a>
</td>
<td width="1" valign="top" bgcolor="#2f4f4f">&nbsp;</td>
<td width="10">&nbsp;</td>
<td valign="top">
@CHILDREN@
@FOOTER@
</td>
<td width="10">&nbsp;</td>
</tr>
</table>
</body>
</html>
]]>
</layout>
<layout name="navigator.topurl">..</layout>
<layout name="navigator.toptitle">Top</layout>
<layout name="navigator.level"><![CDATA[<tr><td width="20">&nbsp;</td><td><a
href="@LEVELURL@"><font size=2>@LEVELTITLE@</font></a></td></tr>
]]></layout>
<layout name="navigator.current"><![CDATA[<tr><td width="20"><a href="@UPURL@"><img src="up.png" width="20" height="20" border=0></a></td><td><font color="#8b3626" size=2>@LEVELTITLE@</font></td></tr><tr><td></td><td><table border=0 cellpadding=0 cellspacing=0>@SUBLEVELS@</table></td></tr>
]]></layout>
<layout name="navigator.child"><![CDATA[<tr><td width="20">&nbsp;</td><td><a href="@LEVELURL@"><font size=2>@LEVELTITLE@</font></a></td></tr>
]]></layout>
<layout name="related"><![CDATA[
<br><br>
<font size=2><b>RELATED</b></font><br><spacer type=vertical size=10>
<table border=0 cellpadding=0 cellspacing=0>
@LINK@
</table>
]]></layout>
<layout name="related.link"><![CDATA[<tr><td><a
href="@HREF@"><font size=2>@TEXT@</font></a></td></tr>
]]></layout>
<layout name="footer.empty"></layout>
<layout name="footer"><![CDATA[
<hr align=left noshade=noshade width="30%">
<dl>
@FOOTNOTES@
</dl>
]]></layout>
<layout name="footnote.text"><![CDATA[<a
name="@TEXTANCHOR@" href="#@FOOTANCHOR@">[@SYMBOL@]</a>]]></layout>
<layout name="footnote.foot"><![CDATA[
<dt><a name="@FOOTANCHOR@" href="#@TEXTANCHOR@">[@SYMBOL@]</a></dt>
<dd>@CHILDREN@</dd>]]></layout>
<layout name="sect1"><![CDATA[<h1>@TITLE@</h1>]]></layout>
<layout name="sect2"><![CDATA[<h2>@TITLE@</h2>]]></layout>
<layout name="sect3"><![CDATA[<h3>@TITLE@</h3>]]></layout>
<layout name="p"><![CDATA[<p>@CHILDREN@</p>]]></layout>
<layout name="em"><![CDATA[<b>@CHILDREN@</b>]]></layout>
<layout name="ul"><![CDATA[<ul>@CHILDREN@</ul>]]></layout>
<layout name="li"><![CDATA[<li>@CHILDREN@</li>]]></layout>
<layout name="br"><![CDATA[<br>
]]></layout>
<!-- ************************************************************ -->
<hierarchy>
<plevel idref="book">
<plevel idref="chapter1">
<plevel idref="ch1sect1"/>
<plevel idref="ch1sect2"/>
</plevel>
<plevel idref="chapter2">
<plevel idref="ch2sect1"/>
<plevel idref="ch2sect2"/>
</plevel>
</plevel>
</hierarchy>
<!-- ************************************************************ -->
<page title="Book" id="book" file="index.html">
<sect1><title>Book</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
<!-- ************************************************************ -->
<page title="Chapter 1" id="chapter1">
<sect1><title>Chapter 1</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
<!-- ************************************************************ -->
<page title="Chapter 1 Section 1" id="ch1sect1">
<sect1><title>Chapter 1 Section 1</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
<!-- ************************************************************ -->
<page title="Chapter 1 Section 2" id="ch1sect2">
<sect1><title>Chapter 1 Section 2</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
<!-- ************************************************************ -->
<page title="Chapter 2" id="chapter2">
<sect1><title>Chapter 2</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
<!-- ************************************************************ -->
<page title="Chapter 2 Section 1" id="ch2sect1">
<sect1><title>Chapter 2 Section 1</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
<!-- ************************************************************ -->
<page title="Chapter 2 Section 2" id="ch2sect2">
<sect1><title>Chapter 2 Section 2</title>
<p>Blah Blah Blah</p>
</sect1>
</page>
</presentation>
all:
../../presentation ../simple.xml
clean:
rm -f *.html *.gif
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