[pkg-java] r2865 - in tags/stylebook: . 1.0~b3~svn20061109-1
1.0~b3~svn20061109-1/debian
1.0~b3~svn20061109-1/src/org/apache/stylebook/printers
1.0~b3~svn20061109-1/styles/christmas
Marcus Better
marcusb-guest at alioth.debian.org
Fri Dec 15 14:05:44 CET 2006
Author: marcusb-guest
Date: 2006-12-15 14:05:43 +0100 (Fri, 15 Dec 2006)
New Revision: 2865
Added:
tags/stylebook/1.0~b3~svn20061109-1/
tags/stylebook/1.0~b3~svn20061109-1/build.xml
tags/stylebook/1.0~b3~svn20061109-1/debian/
tags/stylebook/1.0~b3~svn20061109-1/debian/changelog
tags/stylebook/1.0~b3~svn20061109-1/debian/control
tags/stylebook/1.0~b3~svn20061109-1/debian/rules
tags/stylebook/1.0~b3~svn20061109-1/src/org/apache/stylebook/printers/ImagePrinter.java
Removed:
tags/stylebook/1.0~b3~svn20061109-1/build.xml
tags/stylebook/1.0~b3~svn20061109-1/debian/changelog
tags/stylebook/1.0~b3~svn20061109-1/debian/control
tags/stylebook/1.0~b3~svn20061109-1/debian/rules
tags/stylebook/1.0~b3~svn20061109-1/src/org/apache/stylebook/printers/ImagePrinter.java
tags/stylebook/1.0~b3~svn20061109-1/styles/christmas/vineritc.ttf
Log:
Tag release.
Copied: tags/stylebook/1.0~b3~svn20061109-1 (from rev 2731, branches/stylebook/feature/debian)
Deleted: tags/stylebook/1.0~b3~svn20061109-1/build.xml
===================================================================
--- branches/stylebook/feature/debian/build.xml 2006-11-09 10:28:07 UTC (rev 2731)
+++ tags/stylebook/1.0~b3~svn20061109-1/build.xml 2006-12-15 13:05:43 UTC (rev 2865)
@@ -1,106 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- ===================================================================
-
- Build file for Stylebook
-
-Notes:
- This is a build file for use with the Jakarta Ant java build tool.
-
-Installation Instructions:
- To install Ant on your system, you need to checkout the
- "jakarta-tools" CVS module. Then you should place the files
- - ant.jar
- - projectx-tr2.jar
- - javac.jar
- in your classpath. (XML parser abstraction is currently in
- the todo list, volunteers welcome!)
-
-Build Instructions:
- To build, run
-
- java org.apache.tools.ant.Main
-
- on the directory where this file is located.
-
- Note: See build.bat in this directory for info on setting up your classpath
- to build Stylebook. If you are using the compile2/package2 option to build
- a version of Stylebook that works with Xalan-J 2, Xalan-J 2 (NOT Xalan-J 1) must be on the
- classpath and an up-to-date version of Xerces-J with javax.xml.parsers must also be on the
- classpath.
- Donald Leslie <donald_leslie at lotus.com>
- 9-11-00
-
-Authors:
- Stefano Mazzocchi <stefano at apache.org>
-
-Copyright:
- Copyright (c) 1999 The Apache Software Foundation.
-
- $Id: build.xml 313292 2004-12-14 15:54:50Z dims $
-
-==================================================================== -->
-
-<project name="Stylebook" default="package2" basedir=".">
-
- <target name="init">
- <property name="name" value="stylebook"/>
- <property name="version" value="1.0-b2"/>
- <property name="version-xalan-2" value="1.0-b3_xalan-2"/> <!-- Version to use with Xalan-J 2 -->
-
- <property name="build.compiler" value="classic"/>
- <property name="debug" value="off"/>
-
- <property name="build.dir" value="./build"/>
- <property name="build.src" value="${build.dir}/src"/>
- <property name="build.dest" value="${build.dir}/classes"/>
- <property name="src.dir" value="./src"/>
- <property name="bin.dir" value="./bin"/>
- <condition property="sun.codec.present" >
- <available classname="com.sun.image.codec.jpeg.JPEGCodec"/>
- </condition>
- </target>
-
- <target name="prepare" depends="init">
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.src}"/>
- <mkdir dir="${build.dest}"/>
- <copy todir="${build.src}">
- <fileset dir="${src.dir}"/>
- </copy>
- </target>
-
- <!-- If compiling version to run with Xalan-J 1, must not include Xalan2Processor in the compile.
- If compiling version to run with Xalan-J 2, must not include XalanProcessor in the compile. -->
-
- <target name="compile" depends="prepare">
- <javac srcdir="${build.src}" excludes="org/apache/stylebook/processors/Xalan2Processor.java" destdir="${build.dest}" classpath="${classpath}" debug="${debug}"/>
- <copy todir="${build.dest}/org/apache/stylebook/data">
- <fileset dir="${build.src}/org/apache/stylebook/data"/>
- </copy>
- </target>
-
- <target name="package" depends="compile">
- <jar jarfile="${bin.dir}/${name}-${version}.jar" basedir="${build.dest}" includes="org/**"/>
- </target>
-
-<!--Compile and Package to work with Xalan-J 2 -->
- <target name="compile2" depends="prepare">
- <javac srcdir="${src.dir}" excludes="org/apache/stylebook/processors/XalanProcessor.java" destdir="${build.dest}" debug="${debug}">
- <exclude name="**/org/apache/stylebook/processors/XalanProcessor.java"/>
- <exclude name="**/org/apache/stylebook/printers/ImagePrinter.java" unless="sun.codec.present"/>
- </javac>
- <copy todir="${build.dest}/org/apache/stylebook/data">
- <fileset dir="${build.src}/org/apache/stylebook/data"/>
- </copy>
- </target>
- <target name="package2" depends="compile2">
- <replace file="${build.dest}/org/apache/stylebook/data/engine.xml" token="XalanProcessor" value="Xalan2Processor"/>
- <jar jarfile="${bin.dir}/${name}-${version-xalan-2}.jar" basedir="${build.dest}" includes="org/**"/>
- </target>
-
- <target name="clean">
- <deltree dir="${build.dir}"/>
- </target>
-
-</project>
Copied: tags/stylebook/1.0~b3~svn20061109-1/build.xml (from rev 2843, branches/stylebook/feature/debian/build.xml)
Copied: tags/stylebook/1.0~b3~svn20061109-1/debian (from rev 2734, branches/stylebook/feature/debian/debian)
Deleted: tags/stylebook/1.0~b3~svn20061109-1/debian/changelog
===================================================================
--- branches/stylebook/feature/debian/debian/changelog 2006-11-09 11:16:08 UTC (rev 2734)
+++ tags/stylebook/1.0~b3~svn20061109-1/debian/changelog 2006-12-15 13:05:43 UTC (rev 2865)
@@ -1,5 +0,0 @@
-stylebook (1.0~b3~svn20061109-1) unstable; urgency=low
-
- * Initial release. (Closes: #397764)
-
- -- Marcus Better <marcus at better.se> Thu, 9 Nov 2006 12:15:23 +0100
Copied: tags/stylebook/1.0~b3~svn20061109-1/debian/changelog (from rev 2850, branches/stylebook/feature/debian/debian/changelog)
Deleted: tags/stylebook/1.0~b3~svn20061109-1/debian/control
===================================================================
--- branches/stylebook/feature/debian/debian/control 2006-11-09 11:16:08 UTC (rev 2734)
+++ tags/stylebook/1.0~b3~svn20061109-1/debian/control 2006-12-15 13:05:43 UTC (rev 2865)
@@ -1,16 +0,0 @@
-Source: stylebook
-Section: libs
-Priority: optional
-Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
-Uploaders: Marcus Better <marcus at better.se>
-Build-Depends: debhelper (>= 5.0.0)
-Build-Depends-Indep: java-gcj-compat-dev, ant, libxerces2-java
-Standards-Version: 3.7.2
-
-Package: libstylebook-java
-Architecture: all
-Section: libs
-Depends: classpath-common | java1-runtime | java2-runtime, libxerces2-java
-Description: XML application for authoring web site content
- Stylebook is a way to convert a set of XML files into a proper web
- site with consistent navigation and layout.
Copied: tags/stylebook/1.0~b3~svn20061109-1/debian/control (from rev 2844, branches/stylebook/feature/debian/debian/control)
Deleted: tags/stylebook/1.0~b3~svn20061109-1/debian/rules
===================================================================
--- branches/stylebook/feature/debian/debian/rules 2006-11-09 11:16:08 UTC (rev 2734)
+++ tags/stylebook/1.0~b3~svn20061109-1/debian/rules 2006-12-15 13:05:43 UTC (rev 2865)
@@ -1,64 +0,0 @@
-#!/usr/bin/make -f
-
-JAVA_HOME := /usr/lib/jvm/java-gcj
-DEB_JARS_BASE := /usr/share/java
-JAVACMD := $(JAVA_HOME)/bin/java
-
-DEB_JARS := ant ant-launcher xercesImpl
-
-DEB_CLASSPATH = $(shell for jar in $(DEB_JARS); do \
- if [ -f "$$jar" ]; then echo -n "$${jar}:"; fi; \
- if [ -f "$$jar".jar ]; then echo -n "$${jar}.jar:"; fi; \
- if [ -f $(DEB_JARS_BASE)/"$$jar" ]; then echo -n "$(DEB_JARS_BASE)/$${jar}:"; fi; \
- if [ -f $(DEB_JARS_BASE)/"$$jar".jar ]; then echo -n "$(DEB_JARS_BASE)/$${jar}.jar:"; fi; \
- done; \
- if [ -f "$(JAVA_HOME)/lib/tools.jar" ]; then echo -n "$(JAVA_HOME)/lib/tools.jar"; fi)
-
-DEB_ANT_ARGS := -Dbin.dir=build
-ANT_INVOKE := $(JAVACMD) -classpath $(DEB_CLASSPATH) \
- org.apache.tools.ant.Main $(DEB_ANT_ARGS)
-
-PKGNAME := stylebook
-INSTALLDIR := $(CURDIR)/debian/lib$(PKGNAME)-java
-JAVALIBDIR := $(INSTALLDIR)/usr/share/java
-
-VERSION := $(shell head -1 debian/changelog | cut -f2 -d\( | cut -f1 -d\) | cut -f1 -d\- | cut -f1 -d\+ | cut -f1-2 -d\~ | tr \~ \-)
-
-build: build-stamp
-build-stamp:
- dh_testdir
- $(ANT_INVOKE)
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
- $(ANT_INVOKE) clean
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- install -m 644 build/$(PKGNAME)-$(VERSION)_xalan-2.jar $(JAVALIBDIR)/$(PKGNAME)-$(VERSION).jar
- ln -s $(PKGNAME)-$(VERSION).jar $(JAVALIBDIR)/$(PKGNAME).jar
- dh_link
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary-arch: build install
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
Copied: tags/stylebook/1.0~b3~svn20061109-1/debian/rules (from rev 2842, branches/stylebook/feature/debian/debian/rules)
Deleted: tags/stylebook/1.0~b3~svn20061109-1/src/org/apache/stylebook/printers/ImagePrinter.java
===================================================================
--- branches/stylebook/feature/debian/src/org/apache/stylebook/printers/ImagePrinter.java 2006-11-09 10:28:07 UTC (rev 2731)
+++ tags/stylebook/1.0~b3~svn20061109-1/src/org/apache/stylebook/printers/ImagePrinter.java 2006-12-15 13:05:43 UTC (rev 2865)
@@ -1,274 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of wich has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
-package org.apache.stylebook.printers;
-
-import org.apache.stylebook.*;
-import com.sun.image.codec.jpeg.*;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.*;
-import java.net.*;
-import java.awt.*;
-import java.awt.geom.AffineTransform;
-import java.awt.image.*;
-import java.util.*;
-import javax.swing.*;
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Entity;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Notation;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-
-/**
- * The ImagePrinter Printer writes images.
- *
- * @author <a href="mailto:pier at apache.org">Pierpaolo Fumagalli</a>
- * @author Copyright 1999 © <a href="http://www.apache.org">The Apache
- * Software Foundation</a>. All rights reserved.
- * @version CVS $Revision: 313202 $ $Date: 1999-11-30 13:28:55 +0100 (tis, 30 nov 1999) $
- */
-public class ImagePrinter extends AbstractComponent implements Printer {
-
- int R=0;
- int G=1;
- int B=2;
- int A=3;
-
- /**
- * Print a DOM Document.
- *
- * @param doc The Document to print.
- * @param out The OutputStream used for printing.
- * @param env The Environment of this printing request.
- * @exception IOException If an I/O error occourred accessing resources.
- * @exception CreationException If the Document cannot be printed.
- */
- public void print(Document doc, CreationContext ctx, OutputStream out)
- throws CreationException, IOException {
- // Check for proper root element
- Element element=doc.getDocumentElement();
- if (!element.getTagName().equals("image")) {
- throw new CreationException("Invalid document supplied",doc);
- }
- // Check wether we have a source image
- String source=element.getAttribute("source");
- BufferedImage img=null;
- Graphics2D gr=null;
- // If we have a source image, this is taken as our source.
- if (source.length()>0) {
- ImageIcon ico=null;
- if (source.indexOf(":/")>=0) {
- ico=new ImageIcon(new URL(source).openConnection().getURL());
- } else ico=new ImageIcon(source);
-
- if ((ico.getIconWidth()<1) | (ico.getIconHeight()<1)) {
- throw new CreationException("Cannot load image \""+source+"\"");
- }
- img=new BufferedImage(ico.getIconWidth(), ico.getIconHeight(),
- BufferedImage.TYPE_INT_RGB);
- gr=img.createGraphics();
- gr.drawImage(ico.getImage(),0,0,ico.getImageObserver());
- } else {
- // We don't have a source image. Build up a new getting height and
- // width from attributes
- int w=0;
- int h=0;
- try {
- String width=element.getAttribute("width");
- String height=element.getAttribute("height");
- w=Integer.parseInt(width);
- h=Integer.parseInt(height);
- } catch (NumberFormatException e) {
- throw new CreationException("Image witdth or height error");
- }
- if ((w<1) | (h<1)) {
- throw new CreationException("Image witdth or height unspecified");
- }
- img=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
- gr=img.createGraphics();
- // Now process the bgcolor attribute for background colorization
- int bg=0;
- try {
- String bgcolor=element.getAttribute("bgcolor");
- bg=Integer.parseInt(bgcolor,16);
- } catch (NumberFormatException e) {
- throw new CreationException("Background color error");
- }
- Color c=new Color(bg);
- gr.setBackground(c);
- gr.clearRect(0,0,w,h);
- // Check if we have a background to tile
- String background=element.getAttribute("background");
- if (background.length()>0) {
- // We have a background image. Load it.
- ImageIcon ico=new ImageIcon(background);
- if ((ico.getIconWidth()<1) | (ico.getIconHeight()<1)) {
- throw new CreationException("Cannot load background \""+source+"\"");
- }
- // Tile the image.
- int x=0;
- int y=0;
- while (true) {
- gr.drawImage(ico.getImage(),x,y,ico.getImageObserver());
- x+=ico.getIconWidth();
- if (x>w) {
- x=0;
- y+=ico.getIconHeight();
- }
- if (y>h) break;
- }
- }
- }
-
- // Process child elements
- NodeList l=element.getChildNodes();
- for (int x=0;x<l.getLength();x++) {
- if (l.item(x).getNodeType()==Node.ELEMENT_NODE) {
- processElement((Element)l.item(x),img);
- }
- }
-
- // Write out image (highest quality for jpeg data)
- JPEGEncodeParam jpar=JPEGCodec.getDefaultJPEGEncodeParam(img);
- jpar.setQuality(1,true);
- JPEGImageEncoder jenc=JPEGCodec.createJPEGEncoder(out,jpar);
- jenc.encode(img);
- out.flush();
- }
-
- void processElement(Element e, BufferedImage i)
- throws CreationException {
- if (e==null) return;
- int R=0; int G=1; int B=2; int A=3;
- // Create new alpha image
- int w=i.getWidth();
- int h=i.getHeight();
- BufferedImage n=new BufferedImage(w,h,BufferedImage.TYPE_INT_ARGB);
- // Clear new alpha image
- int np[]=new int[]{0,0,0,0};
- WritableRaster nr=n.getRaster();
- for (int x=0;x<nr.getWidth();x++) for (int y=10;y<nr.getHeight();y++) {
- nr.setPixel(x,y,np);
- }
- // Check wich element is being processed.
- boolean ret=false;
- if (e.getTagName().equals("text")) ret=placeText(e,n);
- if(!ret) return;
- // Apply new image over existing
- WritableRaster ir=i.getRaster();
- int ip[]=new int[]{0,0,0,0};
- double ia=0;
- double na=1;
- for (int x=0;x<ir.getWidth();x++) for (int y=0;y<ir.getHeight();y++) {
- ir.getPixel(x,y,ip);
- nr.getPixel(x,y,np);
- if (np[A]>0) {
- na=((double)np[A]/255);
- ia=(1-na);
- ip[R]=(int)(((double)ip[R]*ia) + ((double)np[R]*na));
- ip[G]=(int)(((double)ip[G]*ia) + ((double)np[G]*na));;
- ip[B]=(int)(((double)ip[B]*ia) + ((double)np[B]*na));;
- }
- ir.setPixel(x,y,ip);
- }
- }
-
- private boolean placeText(Element e, BufferedImage i)
- throws CreationException {
- String text=e.getAttribute("text");
- String font=e.getAttribute("font");
- String ssize=e.getAttribute("size");
- String sstyle=e.getAttribute("style");
- String scolor=e.getAttribute("color");
- String sx=e.getAttribute("x");
- String sy=e.getAttribute("y");
- String halign=e.getAttribute("halign");
- String valign=e.getAttribute("valign");
- // Check proper text
- if (text.length()<1) return(false);
- // Check size, x and y parameters
- int color,size,insx,insy;
- try {
- size=Integer.parseInt(ssize);
- insx=Integer.parseInt(sx);
- insy=Integer.parseInt(sy);
- color=Integer.parseInt(scolor,16);
- } catch (NumberFormatException ex) {
- throw new CreationException("Attribute size, x, y or color error");
- }
- // Get style
- int style=Font.PLAIN;
- if (sstyle.equals("bold")) style=Font.BOLD;
- else if (sstyle.equals("italic")) style=Font.ITALIC;
- else if (sstyle.equals("bolditalic")) style=Font.BOLD+Font.ITALIC;
- Font f=new Font(font,style,size);
- FontMetrics m=i.createGraphics().getFontMetrics(f);
- // Create temporary image
- int w=m.stringWidth(text)*2;
- int h=m.getHeight()*2;
- BufferedImage n=new BufferedImage(w,h,BufferedImage.TYPE_INT_ARGB);
- // Write out some text
- Graphics2D gr=n.createGraphics();
- gr.setColor(new Color(0x0ff000000,true));
- gr.setFont(f);
- gr.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- gr.drawString(text,5,h-(h/4));
- // Resize image
- int minx=w;
- int miny=h;
- int maxx=0;
- int maxy=0;
- WritableRaster nr=n.getRaster();
- int np[]=new int[]{0,0,0,0};
- for (int x=0;x<nr.getWidth();x++) for (int y=10;y<nr.getHeight();y++) {
- nr.getPixel(x,y,np);
- if (np[A]>0) {
- if(x<minx) minx=x;
- if(x>maxx) maxx=x;
- if(y<miny) miny=y;
- if(y>maxy) maxy=y;
- }
- }
- if (halign.equals("right")) insx=insx-((maxx-minx)+1);
- if (halign.equals("center")) insx=insx-(((maxx-minx)+1)/2);
- if (valign.equals("bottom")) insy=insy-((maxy-miny)+1);
- if (valign.equals("center")) insy=insy-(((maxy-miny)+1)/2);
- WritableRaster ir=i.getRaster();
- int newx,newy;
- newy=insy;
- for (int y=miny;y<=maxy;y++) {
- newx=insx;
- if(newy>=0) {
- for (int x=minx;x<=maxx;x++) {
- nr.getPixel(x,y,np);
- np[R]=(color >> 16) & 0x0ff;
- np[G]=(color >> 8) & 0x0ff;
- np[B]=(color & 0x0ff);
- if(newx>=0) ir.setPixel(newx,newy,np);
- newx++;
- if(newx>=i.getWidth()) break;
- }
- }
- newy++;
- if(newy>=i.getHeight()) break;
- }
- return(true);
- }
-}
Copied: tags/stylebook/1.0~b3~svn20061109-1/src/org/apache/stylebook/printers/ImagePrinter.java (from rev 2843, branches/stylebook/feature/debian/src/org/apache/stylebook/printers/ImagePrinter.java)
Deleted: tags/stylebook/1.0~b3~svn20061109-1/styles/christmas/vineritc.ttf
===================================================================
(Binary files differ)
More information about the pkg-java-commits
mailing list