|
1 /******************************************************************************* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - initial implementation |
|
10 *******************************************************************************/ |
|
11 package org.eclipse.swt.internal.qt.graphics; |
|
12 |
|
13 import org.eclipse.swt.graphics.ImageData; |
|
14 import org.eclipse.swt.graphics.Point; |
|
15 |
|
16 final class OS { |
|
17 // Graphics Context |
|
18 static final native int graphicsContext_get_windowsurface(int handle); |
|
19 static final native int graphicsContext_init(); |
|
20 static final native void graphicsContext_dispose(int handle); |
|
21 static final native void graphicsContext_bindTarget(int handle, int target, int type, int bufferFlushTargetHandle); |
|
22 static final native void graphicsContext_render(int handle, int buffer); |
|
23 static final native void graphicsContext_releaseTarget(int handle); |
|
24 static final native void graphicsContext_copyArea(int handle, int targetHandle, int x, int y); |
|
25 static final native void graphicsContext_copyArea(int handle, int srcX, int srcY, int width, int height, int destX, int destY, boolean paint); |
|
26 static final native void graphicsContext_drawArc(int handle, int x, int y, int width, int height, int startAngle, int arcAngle); |
|
27 static final native void graphicsContext_drawEllipse(int handle, int x, int y, int width, int height); |
|
28 static final native void graphicsContext_drawFocus(int handle, int x, int y, int width, int height); |
|
29 static final native void graphicsContext_drawImage(int handle, int imageHandle, int x, int y); |
|
30 static final native void graphicsContext_drawImage(int handle, int imageHandle, int tx, int ty, int tw, |
|
31 int th, int sx, int sy, int sw, int sh, int manipulation); |
|
32 static final native void graphicsContext_drawLine(int handle, int x1, int y1, int x2,int y2); |
|
33 static final native void graphicsContext_drawPoint(int handle, int x, int y); |
|
34 static final native void graphicsContext_drawPolygon(int handle, int[] pointArray); |
|
35 static final native void graphicsContext_drawPolyline(int handle, int[] pointArray); |
|
36 static final native void graphicsContext_drawRect(int handle, int x, int y, int width, int height); |
|
37 static final native void graphicsContext_drawRGB(int handle, int[] rgbData, int offset, int scanlenght, int x, int y, int width, int height, boolean processAlpha, int manipulation); |
|
38 static final native void graphicsContext_drawRGB(int handle, byte[] rgbData, byte[] transparencyMask,int offset, int scanlenght, int x, int y, int width, int height, int manipulation, int format); |
|
39 static final native void graphicsContext_drawRGB(int handle, short[] rgbData, int offset, int scanlenght, int x, int y, int width, int height, boolean processAlpha, int manipulation, int format); |
|
40 static final native void graphicsContext_drawRoundRect(int handle,int x,int y,int width,int height,int arcWidth,int arcHeight); |
|
41 static final native void graphicsContext_drawString(int handle, String string, int x, int y, int width, int height, |
|
42 int alignments, int flags, boolean isTransparent); |
|
43 static final native void graphicsContext_drawWindowSurface(int handle, int surfaceHandle, int x, int y, int width, int height); |
|
44 static final native void graphicsContext_fillArc(int handle, int x, int y, int width, int height, int startAngle, int arcAngle); |
|
45 static final native void graphicsContext_fillEllipse(int handle, int x, int y, int width, int height); |
|
46 static final native void graphicsContext_fillGradientRect(int handle, int x, int y, int width, int height, boolean vertical, boolean swapColors); |
|
47 static final native void graphicsContext_fillPolygon(int handle, int[]pointArray); |
|
48 static final native void graphicsContext_fillRect(int handle, int x, int y, int width, int height); |
|
49 static final native void graphicsContext_fillRoundRect(int handle,int x,int y,int width,int height,int arcWidth,int arcHeight); |
|
50 static final native int graphicsContext_getBackgroundAlpha(int handle); |
|
51 static final native int graphicsContext_getBackgroundColor(int handle); |
|
52 static final native int graphicsContext_getCharacterWidth(int handle, char ch, boolean isAdvanced); |
|
53 static final native void graphicsContext_getFontMetricsData(int handle, int[] data, int fontHandle); |
|
54 static final native int graphicsContext_getBlendingMode(int handle); |
|
55 static final native boolean graphicsContext_hasClipping(int handle); |
|
56 static final native void graphicsContext_cancelClipping(int handle); |
|
57 static final native void graphicsContext_getClip(int handle, int[] clip); |
|
58 static final native int graphicsContext_getForegroundAlpha(int handle); |
|
59 static final native int graphicsContext_getForegroundColor(int handle); |
|
60 static final native void graphicsContext_getTextBoundingBox(int handle, int[] boundingBox, String string, int alignments, |
|
61 int flags, int rectX, int rectY, int rectWidth, int rectHeight); |
|
62 static final native int graphicsContext_getStrokeWidth(int handle); |
|
63 static final native int graphicsContext_getStrokeStyle(int handle); |
|
64 static final native int graphicsContext_getTranslateX(int handle); |
|
65 static final native int graphicsContext_getTranslateY(int hanle); |
|
66 static final native void graphicsContext_setBackgroundAlpha(int handle, int alpha); |
|
67 static final native void graphicsContext_setBackgroundColor(int handle, int argb, boolean updateAlpha); |
|
68 static final native void graphicsContext_setBlendingMode(int handle, int mode); |
|
69 static final native void graphicsContext_setClip(int handle, int x, int y, int width, int height, boolean intersects); |
|
70 static final native void graphicsContext_setFont(int handle, int fontHandle); |
|
71 static final native void graphicsContext_setForegroundAlpha(int handle, int alpha); |
|
72 static final native void graphicsContext_setForegroundColor(int handle, int argb, boolean updateAplha); |
|
73 static final native void graphicsContext_setStrokeWidth(int handle, int width); |
|
74 static final native void graphicsContext_setStrokeStyle(int handle, int style); |
|
75 static final native void graphicsContext_translate(int handle, int x, int y); |
|
76 static final native void graphicsContext_scale(int handle, int x, int y); |
|
77 static final native void graphicsContext_resetTransform(int handle); |
|
78 static final native void graphicsContext_saveSettings(int handle); |
|
79 static final native void graphicsContext_restoreSettings(int handle); |
|
80 |
|
81 // Image |
|
82 static final native int image_create(int width, int height, int fillColor); |
|
83 static final native int image_create(int imageHandle, int x, int y, int width, int height); |
|
84 static final native int image_create(ImageData imageData); |
|
85 static final native int image_create(int[] argbData, int width, int height, boolean hasAlpha); |
|
86 static final native int image_create(int pixmapHandle); |
|
87 static final native int image_getFormat(int handle); |
|
88 static final native int image_getHeight(int handle); |
|
89 static final native int image_getWidth(int handle); |
|
90 static final native void image_getRGB(int handle, int[] argbData, int offset, int scanlength,int x, int y, int width, int height); |
|
91 static final native void image_getRGB(int handle, byte[] argbData, byte[] transparencyMask, int offset, int scanlength,int x, int y, int width, int height, int format); |
|
92 static final native void image_getRGB(int handle, short[] argbData, int offset, int scanlength,int x, int y, int width, int height, int format); |
|
93 static final native ImageData image_getImageData(int imageHandle); |
|
94 static final native void image_transform(int handle, int transform); |
|
95 static final native void image_dispose(int handle); |
|
96 static final native int image_getPixmapHandle(int handle); |
|
97 static final native boolean image_detectCollision(int image1Handle, int transform1, int p1x, int p1y, int r1x1, int r1y1, int r1x2, int r1y2, |
|
98 int image2Handle, int transform2, int p2x, int p2y, int r2x1, int r2y1, int r2x2, int r2y2); |
|
99 |
|
100 // ImageLoader |
|
101 static final native void imageLoader_append(int handle, int length, int offset, byte[] data); |
|
102 static final native void imageLoader_beginStream(int handle, int bufferSize); |
|
103 static final native int imageLoader_endStream(int handle); |
|
104 static final native int imageLoader_init(); |
|
105 static final native void imageLoader_dispose(int handle); |
|
106 static final native int imageLoader_load(int handle, String fileName); |
|
107 static final native void imageLoader_setLoadSize(int handle, int width, int height); |
|
108 static final native Point imageLoader_getImageSize(byte[] data); |
|
109 |
|
110 // FontUtils |
|
111 static final native int fontUtils_getAscent(int fontHandle); |
|
112 static final native void fontUtils_getBoundingRect(int fontHandle, int[] rect, String str); |
|
113 static final native void fontUtils_getBoundingRect(int fontHanlde, int[] boundingBox, String string, int alignments, int flags, |
|
114 int rectX, int rectY, int rectWidth, int rectHeight); |
|
115 static final native int fontUtils_getDescent(int fontHandle); |
|
116 static final native int fontUtils_getStringWidth(int fontHandle, String text); |
|
117 |
|
118 // Buffer |
|
119 static final native int buffer_init(); |
|
120 static final native void buffer_dispose(int handle); |
|
121 static final native void buffer_getInvalidRect(int handle, int[] rect); |
|
122 |
|
123 // WindowSurface |
|
124 static final native int windowsurface_create(int handle, boolean autoRefresh); |
|
125 static final native void windowsurface_beginPaint(int handle, int x, int y, int height, int width); |
|
126 static final native void windowsurface_endPaint(int handle); |
|
127 static final native void windowsurface_flush(int handle); |
|
128 static final native int windowsurface_getType(int handle); |
|
129 static final native void windowsurface_dispose(int handle); |
|
130 static final native void windowsurface_refresh(int handle); |
|
131 static final native void windowsurface_handleSymbianWindowVisibilityChange(int handle, boolean visible); |
|
132 } |