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
26package 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
35import java.awt.geom.*;
36import java.util.*;
37
38import sun.font.*;
39import sun.java2d.jules.*;
40import sun.java2d.pipe.*;
41
42public interface XRBackend {
43
44    public void freePicture(int picture);
45
46    public void freePixmap(int pixmap);
47
48    public int createPixmap(int drawable, int depth, int width, int height);
49
50    public int createPicture(int drawable, int formatID);
51
52    public long createGC(int drawable);
53
54    public void freeGC(long gc); /* TODO: Use!! */
55
56    public void copyArea(int src, int dst, long gc, int srcx, int srcy,
57                         int width, int height, int dstx, int dsty);
58
59    public void putMaskImage(int drawable, long gc, byte[] imageData,
60                             int sx, int sy, int dx, int dy,
61                             int width, int height, int maskOff,
62                             int maskScan, float ea);
63
64    public void setGCClipRectangles(long gc, Region clip);
65
66    public void GCRectangles(int drawable, long gc, GrowableRectArray rects);
67
68    public void setClipRectangles(int picture, Region clip);
69
70    public void setGCExposures(long gc, boolean exposure);
71
72    public void setGCForeground(long gc, int pixel);
73
74    public void setPictureTransform(int picture, AffineTransform transform);
75
76    public void setPictureRepeat(int picture, int repeat);
77
78    public void setFilter(int picture, int filter);
79
80    public void renderRectangle(int dst, byte op, XRColor color,
81                                int x, int y, int width, int height);
82
83    public void renderRectangles(int dst, byte op, XRColor color,
84                                 GrowableRectArray rects);
85
86    public void renderComposite(byte op, int src, int mask, int dst,
87                                int srcX, int srcY, int maskX, int maskY,
88                                int dstX, int dstY, int width, int height);
89
90    public int XRenderCreateGlyphSet(int formatID);
91
92    public void XRenderAddGlyphs(int glyphSet, GlyphList gl,
93                                 List<XRGlyphCacheEntry> cacheEntries,
94                                 byte[] pixelData);
95
96    public void XRenderFreeGlyphs(int glyphSet, int[] gids);
97
98    public void XRenderCompositeText(byte op, int src, int dst,
99                                     int maskFormatID,
100                                     int xSrc, int ySrc, int xDst, int yDst,
101                                     int glyphset, GrowableEltArray elts);
102
103    public int createRadialGradient(float centerX, float centerY,
104                                    float innerRadius, float outerRadius,
105                                    float[] fractions, int[] pixels,
106                                    int repeat);
107
108    public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
109                                    int[] pixels, int repeat);
110
111    public void setGCMode(long gc, boolean copy);
112
113    public void renderCompositeTrapezoids(byte op, int src, int maskFormat,
114                                          int dst, int srcX, int srcY,
115                                          TrapezoidList trapList);
116}
117