001: /*
002: * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package sun.java2d.loops;
027:
028: import sun.java2d.loops.GraphicsPrimitive;
029: import sun.java2d.pipe.Region;
030: import sun.java2d.SunGraphics2D;
031: import sun.java2d.SurfaceData;
032: import sun.font.GlyphList;
033:
034: /**
035: * DrawGlyphListLCD- loops for LCDTextRenderer pipe
036: * 1) draw LCD anti-aliased text onto destination surface
037: * 2) must accept output area [x, y, dx, dy]
038: * from within the surface description data for clip rect
039: */
040: public class DrawGlyphListLCD extends GraphicsPrimitive {
041:
042: public final static String methodSignature = "DrawGlyphListLCD(...)"
043: .toString();
044:
045: public final static int primTypeID = makePrimTypeID();
046:
047: public static DrawGlyphListLCD locate(SurfaceType srctype,
048: CompositeType comptype, SurfaceType dsttype) {
049: return (DrawGlyphListLCD) GraphicsPrimitiveMgr.locate(
050: primTypeID, srctype, comptype, dsttype);
051: }
052:
053: protected DrawGlyphListLCD(SurfaceType srctype,
054: CompositeType comptype, SurfaceType dsttype) {
055: super (methodSignature, primTypeID, srctype, comptype, dsttype);
056: }
057:
058: public DrawGlyphListLCD(long pNativePrim, SurfaceType srctype,
059: CompositeType comptype, SurfaceType dsttype) {
060: super (pNativePrim, methodSignature, primTypeID, srctype,
061: comptype, dsttype);
062: }
063:
064: public native void DrawGlyphListLCD(SunGraphics2D sg2d,
065: SurfaceData dest, GlyphList srcData);
066:
067: static {
068: GraphicsPrimitiveMgr.registerGeneral(new DrawGlyphListLCD(null,
069: null, null));
070: }
071:
072: public GraphicsPrimitive makePrimitive(SurfaceType srctype,
073: CompositeType comptype, SurfaceType dsttype) {
074: /* Do not return a General loop. SunGraphics2D determines whether
075: * to use LCD or standard AA text based on whether there is an
076: * installed loop.
077: * This can be uncommented once there is a General loop which can
078: * handle one byte per colour component masks properly.
079: */
080: return null;
081: }
082:
083: public GraphicsPrimitive traceWrap() {
084: return new TraceDrawGlyphListLCD(this );
085: }
086:
087: private static class TraceDrawGlyphListLCD extends DrawGlyphListLCD {
088: DrawGlyphListLCD target;
089:
090: public TraceDrawGlyphListLCD(DrawGlyphListLCD target) {
091: super (target.getSourceType(), target.getCompositeType(),
092: target.getDestType());
093: this .target = target;
094: }
095:
096: public GraphicsPrimitive traceWrap() {
097: return this ;
098: }
099:
100: public void DrawGlyphListLCD(SunGraphics2D sg2d,
101: SurfaceData dest, GlyphList glyphs) {
102: tracePrimitive(target);
103: target.DrawGlyphListLCD(sg2d, dest, glyphs);
104: }
105: }
106: }
|