// Copyright 2000-2005 the Contributors, as shown in the revision logs. // Licensed under the GNU General Public License version 2 ("the License"). // You may not use this file except in compliance with the License. package org.ibex.graphics; import java.util.*; // FIXME: offer a "subpixel" mode where we pass floats to the Platform and don't do any snapping // FIXME: fracture when realizing instead of when parsing? /* v1.0 - textpath - gradients - patterns - clipping/masking - filters (filtering of a group must be performed AFTER the group is assembled; sep. canvas) v1.1 - bump caps [requires Paint that can fill circles...] [remember to distinguish between closed/unclosed] - line joins - mitre (hard) - bevel (easy) - bump (easy, but requires 'round' Paint) - subtree sharing? otherwise the memory consumption might be outrageous... clone="" attribute? - better clipping - intersect clip regions (linearity) - clip on trapezoids, not pixels - faster gradients and patterns: - transform each corner of the trapezoid and then interpolate */ // FIXME: need to support style sheets and the 'style=' attribute // FIXME: need to convert markers into subboxes public class SVG { /* public static void parseNode(String name, String[] keys, Object[] vals, Template t) { Hash h = new Hash(); for(int i=0; iname property * / Hashtable glyphByName = new Hashtable(); / ** linked list of glyphs, stored by the first character of their unicode property * / Hashtable glyphByUnicode = new Hashtable(); // a Glyph in an VectorGraphics font public static class Glyph { // FIXME: lang attribute boolean isVerticallyOriented = false; Template t = null; Box b = null; float horiz_adv_x = 0; float vert_origin_x = 0; float vert_origin_y = 0; float vert_adv_y = 0; String unicode = null; // forms the linked list in glyphByUnicode; glyphs appear in the order specified in the font public Glyph next = null; Glyph(String name, String unicode, Template t, VectorGraphics.Font f) { if (unicode != null) if (f.glyphByUnicode.get(unicode.substring(0, 1)) == null) { f.glyphByUnicode.put(unicode.substring(0, 1), this); } else { Glyph g; for(g = (Glyph)f.glyphByUnicode.get(unicode.substring(0, 1)); g.next != null; g = g.next); g.next = this; } if (name != null) f.glyphByUnicode.put(name, this); this.unicode = unicode; this.t = t; horiz_adv_x = f.horiz_adv_x; vert_origin_x = f.vert_origin_x; vert_origin_y = f.vert_origin_y; vert_adv_y = f.vert_adv_y; } public void render(DoubleBuffer buf, int x, int y, int fillcolor, int strokecolor, float scaleFactor) { // FEATURE: make b double-buffered for increased performance if (b == null) { b = new Box(t, new org.ibex.util.Vec(), new org.ibex.util.Vec(), null, 0, 0); b.put("absolute", Boolean.TRUE); b.prerender(); t = null; } // FIXME b.put("width", new Integer(1000)); b.put("height", new Integer(1000)); b.fillcolor = fillcolor; b.strokecolor = strokecolor; // we toss an extra flip on the ctm so that fonts stick "up" instead of down b.render(0, 0, buf.getWidth(), buf.getHeight(), buf, Affine.flip(false, true).multiply(Affine.scale(scaleFactor, scaleFactor).multiply(Affine.translate(x, y))).multiply(buf.a)); } } } */ }