5 @SuppressWarnings public class QPainter {
8 bool bneed_delloc =
false;
12 public static class Paint {
13 public static const int
20 public int textSize = -1;
31 color = ((a & 0xff) << 24) | (color & 0x00ffffff);
51 hpaint = QtXnl.long_get(img.himage, Constant.PAINTERFROMIMG);
58 hpaint = QtXnl.long_get(0l, Constant.PAINTERFROMDEVICE);
65 hpaint = QtXnl.long_get(device.nativehandle, Constant.PAINTERFROMDEVICE);
72 if ((p.style & Paint.FILL) != 0) {
73 setBrush(p.color, QBrush.Style.SolidPattern);
76 if ((p.style & Paint.STROKE) != 0) {
77 setPen(p.color, PenStyle.SolidLine, p.width);
81 setFontPixelSize(p.textSize);
86 QtXnl.widget_set_vint_value(hpaint, Constant.PAINTFONTPTSIZE, size);
90 QtXnl.widget_set_vint_value(hpaint, Constant.PAINTFONTPXSIZE, size);
93 public void setPen(
int color, PenStyle penStyle,
double width) {
94 QtXnl.widget_set_v2int_double_value(hpaint, Constant.SETPEN, color, width, penStyle);
97 public void setBrush(
int color, QBrush.Style brushStyle) {
98 QtXnl.widget_set_v2int_value(hpaint, Constant.SETBRUSH, color, brushStyle);
102 QtXnl.widget_set_native_value(hpaint, Constant.SETBRUSH, brush.nativehandle);
105 public void drawLine(
int start_x,
int start_y,
int end_x,
int end_y) {
106 QtXnl.native_int4(hpaint, Constant.QXPAINTDRAWLINE, start_x, start_y, end_x, end_y);
110 QtXnl.native_int4(hpaint, Constant.QXPAINTDRAWRECT, x, y, w, h);
114 QtXnl.native_int4(hpaint, Constant.QXPAINTDRAWRECT, r.left, r.top, r.width(), r.height());
117 public void fillRect(
int x,
int y,
int w,
int h,
int color,
int brushStyle) {
118 QtXnl.long_long_int9(hpaint, Constant.FILLRECT, 0, x, y, w, h, color, brushStyle, 0, 0, 0);
121 public void setClipRect(
int x,
int y,
int w,
int h, ClipOperation op) {
122 QtXnl.long_long_int9(hpaint, Constant.QXPAINTSETCLIPRECT, 0, x, y, w, h, op, 0, 0, 0, 0);
126 QtXnl.widget_slot(hpaint, Constant.PAINTERSAVE);
130 QtXnl.widget_slot(hpaint, Constant.PAINTERRESTORE);
134 QtXnl.widget_slot(hpaint, Constant.PAINTRESETMATRIX);
138 return new QMatrix(QtXnl.long_get(hpaint, Constant.PAINTERGETMATRIX));
142 QtXnl.widget_set_native_value(hpaint, Constant.PAINTSETMATRIX, m.nativehandle);
146 return 0 != QtXnl.long_intlong(hpaint, Constant.PAINTBEGIN, m.nativehandle);
150 return QtXnl.widget_get_int_value(hpaint, Constant.PAINTEND) != 0;
154 QtXnl.widget_slot(hpaint, Constant.PAINTRESETTRANSFORM);
158 QtXnl.widget_set_intintstring_value(hpaint, Constant.DRAWTEXT, x, y,text);
163 setPen(p.color, PenStyle.SolidLine, p.width);
165 QtXnl.widget_set_intintstring_value(hpaint, Constant.DRAWTEXT, x, y,text);
168 public void fillRect(@NotNilptr QRect r,
int color,
int brushStyle) {
169 QtXnl.long_long_int9(hpaint, Constant.FILLRECT, 0, r.left, r.top, r.width(), r.height(), color, brushStyle, 0, 0, 0);
173 if ((points.length & 1) == 1 || points.length < 4) {
176 QtXnl.array_int2(hpaint, Constant.QXPAINTDRAWLINE, points, 0, 0);
180 QtXnl.widget_set_v2int_value(hpaint, Constant.SETBKBRUSH, color, brushStyle);
184 QtXnl.widget_set_double_value(hpaint, Constant.QXPAINTOPACITY, fopacity);
188 QtXnl.widget_set_vint_value(hpaint, Constant.QXPAINTBGMMODE, mode);
191 public void drawImage(@NotNilptr QImage image, @NotNilptr QRect dest, @NotNilptr QRect source,
int converFlags) {
192 QtXnl.long_long_int9(hpaint, Constant.DRAWIMAGE, image.himage,
193 dest.left, dest.top, dest.width(), dest.height(),
194 source.left, source.top, source.width(), source.height(),
198 public void drawImage(@NotNilptr QImage image,
int x,
int y) {
199 QtXnl.widget_set_intlongint_value(hpaint, Constant.DRAWIMAGE, image.himage,x, y);
202 public void drawRoundRect(
int x,
int y,
int w,
int h,
int rx,
int ry, Paint p) {
206 QtXnl.long_long_int9(hpaint, Constant.ROUNDRECT, 0, x, y, w, h, rx, ry, 0, 0, 0);
213 QtXnl.long_long_int9(hpaint, Constant.ROUNDEDRECT, 0, x, y, w, h, rx, ry, 0, 0, 0);
220 QtXnl.long_long_int9(hpaint, Constant.ROUNDRECT, 0, r.left, r.top, r.width(), r.height(), rx, ry, 0, 0, 0);
227 QtXnl.long_long_int9(hpaint, Constant.ROUNDEDRECT, 0, r.left, r.top, r.width(), r.height(), rx, ry, 0, 0, 0);
230 public void drawPath(@NotNilptr QPath path, Paint paint) {
232 QtXnl.widget_set_native_value(hpaint, Constant.DRAWPATH, path.nativehandle);
236 QtXnl.widget_set_native_value(hpaint, Constant.DRAWPATH, path.nativehandle);
239 public void rotate(
double r,
double cx,
double cy) {
240 QMatrix m = getMatrix();
244 m.translate(-cx, -cy);
250 QMatrix m = getMatrix();
257 public void scale(
double cx,
double cy) {
258 QMatrix m = getMatrix();
266 return QtXnl.widget_get_int_value(hpaint, Constant.PAINTFONTASCENT);
269 return QtXnl.widget_get_int_value(hpaint, Constant.PAINTFONTDESCENT);
272 QtXnl.widget_set_int_bool_value(hpaint, Constant.SETCOMPOSITIONMODE, flag,
false);
276 QtXnl.widget_set_int_bool_value(hpaint, Constant.SETRENDERHINT, flag, on);
280 return new QFont(QtXnl.long_get(hpaint, Constant.PAINTERGETFCONT));
284 QtXnl.widget_set_native_value(hpaint, Constant.PAINTERSETFONT, f.nativehandle);
288 setRenderHint(RenderHint.Antialiasing, ba);
296 QtXnl.native_int4(hpaint, Constant.DRAWELLIPSE, x - r, y - r, r *2, r * 2);
300 long pt= QtXnl.long_longstring(hpaint, Constant.PAINTMEASURETEXT, 0, text);
301 return new QRect(x, y, x + ((
int)(pt >> 32) & 0xffffffff), y + (
int)(pt & 0xffffffff));
306 QtXnl.widget_slot(hpaint, Constant.DELLOCPAINTER);
307 bneed_delloc =
false;
void setStrokeWidth(double sw)
void setTextSize(double ts)
void drawImage(@NotNilptr QImage image, @NotNilptr QRect dest, @NotNilptr QRect source, int converFlags)
void setRenderHint(int flag, bool on)
void drawCircle(int x,int y,int r, Paint p)
void setFontPointSize(int size)
void rotate(double r, double cx, double cy)
void setMatrix(@NotNilptr QMatrix m)
void fillRect(@NotNilptr QRect r, int color, int brushStyle)
void setBackgroundBrush(int color, int brushStyle)
void setFontPixelSize(int size)
void fillRect(int x,int y, int w,int h, int color, int brushStyle)
void drawLines(@NotNilptr int [] points)
void drawText(String text, int x,int y)
QPainter(@NotNilptr QPaintDevice device)
void drawRoundRect(int x,int y, int w,int h, int rx, int ry, Paint p)
void setFont(@NotNilptr QFont f)
QPainter(@NotNilptr QImage img)
void setBrush(@NotNilptr QBrush brush)
void setAntialiasing(bool ba)
void setBackMode(int mode)
void setClipRect(int x,int y, int w,int h, ClipOperation op)
void translate(double cx, double cy)
void scale(double cx, double cy)
void drawRect(@NotNilptr QRect r)
void drawPath(@NotNilptr QPath path)
void drawRoundedRect(int x,int y, int w,int h, int rx, int ry, Paint p)
void drawRect(int x, int y, int w, int h)
void drawImage(@NotNilptr QImage image, int x,int y)
void drawRoundRect(@NotNilptr QRect r, int rx, int ry, Paint p)
void setPaint(@NotNilptr Paint p)
void drawRoundedRect(@NotNilptr QRect r, int rx, int ry, Paint p)
bool begin(QPaintDevice m)
QRect measureText(int x, int y, String text)
void setCompositionMode(CompositionMode flag)
void setOpacity(double fopacity)
void setPen(int color, PenStyle penStyle, double width)
void setBrush(int color, QBrush.Style brushStyle)
void drawLine(int start_x, int start_y, int end_x, int end_y)
void drawText(String text, int x,int y, Paint p)
void drawPath(@NotNilptr QPath path, Paint paint)