1 /*
   2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.java2d.xr;
  27 
  28 /**
  29  * XRender pipeline backend interface.
  30  * Currently there are two different backends implemented:
  31  * - XRBackendJava: And experimental backend, generating protocol directly using java-code and xcb's socket handoff functionality.
  32  * - XRBackendNative: Native 1:1 binding with libX11.
  33  */
  34 
  35 import java.awt.geom.*;
  36 import java.util.*;
  37 
  38 import sun.font.*;
  39 import sun.java2d.pipe.*;
  40 
  41 public interface XRBackend {
  42 
  43     public void freePicture(int picture);
  44 
  45     public void freePixmap(int pixmap);
  46 
  47     public int createPixmap(int drawable, int depth, int width, int height);
  48 
  49     public int createPicture(int drawable, int formatID);
  50 
  51     public long createGC(int drawable);
  52 
  53     public void freeGC(long gc); /* TODO: Use!! */
  54 
  55     public void copyArea(int src, int dst, long gc, int srcx, int srcy,
  56                          int width, int height, int dstx, int dsty);
  57 
  58     public void putMaskImage(int drawable, long gc, byte[] imageData,
  59                              int sx, int sy, int dx, int dy,
  60                              int width, int height, int maskOff,
  61                              int maskScan, float ea);
  62 
  63     public void setGCClipRectangles(long gc, Region clip);
  64 
  65     public void GCRectangles(int drawable, long gc, GrowableRectArray rects);
  66 
  67     public void setClipRectangles(int picture, Region clip);
  68 
  69     public void setGCExposures(long gc, boolean exposure);
  70 
  71     public void setGCForeground(long gc, int pixel);
  72 
  73     public void setPictureTransform(int picture, AffineTransform transform);
  74 
  75     public void setPictureRepeat(int picture, int repeat);
  76 
  77     public void setFilter(int picture, int filter);
  78 
  79     public void renderRectangle(int dst, byte op, XRColor color,
  80                                 int x, int y, int width, int height);
  81 
  82     public void renderRectangles(int dst, byte op, XRColor color,
  83                                  GrowableRectArray rects);
  84 
  85     public void renderComposite(byte op, int src, int mask, int dst,
  86                                 int srcX, int srcY, int maskX, int maskY,
  87                                 int dstX, int dstY, int width, int height);
  88 
  89     public int XRenderCreateGlyphSet(int formatID);
  90 
  91     public void XRenderAddGlyphs(int glyphSet, GlyphList gl,
  92                                  List<XRGlyphCacheEntry> cacheEntries,
  93                                  byte[] pixelData);
  94 
  95     public void XRenderFreeGlyphs(int glyphSet, int[] gids);
  96 
  97     public void XRenderCompositeText(byte op, int src, int dst,
  98                                      int maskFormatID,
  99                                      int xSrc, int ySrc, int xDst, int yDst,
 100                                      int glyphset, GrowableEltArray elts);
 101 
 102     public int createRadialGradient(float centerX, float centerY,
 103                                     float innerRadius, float outerRadius,
 104                                     float[] fractions, int[] pixels,
 105                                     int repeat);
 106 
 107     public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
 108                                     int[] pixels, int repeat);
 109 
 110     public void setGCMode(long gc, boolean copy);
 111 
 112 }