00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef QSWINGGRAPHICS_H
00010 #define QSWINGGRAPHICS_H
00011
00012 #include "JavaQxQSwing.h"
00013
00014
00015
00016
00017
00024 class JAVAQX_EXPORT QSwingGraphics : public QPainter
00025 {
00026 public:
00027 QSwingGraphics(QPaintDevice *device);
00028 QSwingGraphics(QPaintDevice *device, jint x, jint y, jint width, jint height);
00029 public:
00030 jobject getColor();
00031 void setColor(jint argb);
00032 jobject getFont();
00033 void setFont(jobject font);
00034 void setLinearGradient(jint x1, jint y1, jint argb1, jint x2, jint y2,
00035 jint argb2, jboolean cyclic);
00036 void setTextureGradient(QPixmap *image);
00037 void setBasicStroke(jfloat width, jint cap, jint join, jfloat miterLimit,
00038 jfloatArray dash, jfloat dashPhase);
00039 void push();
00040 void pop();
00041 void drawImage(jbyteArray imageData, jint length, jint x, jint y);
00042 void fillRect(jint x, jint y, jint w, jint h);
00043 void fillOval(jint x, jint y, jint w, jint h);
00044 public:
00045 inline static bool canPaint(JNIEnv *env, jlong graphicsPointer);
00046 private:
00047 static const Qt::PenCapStyle PEN_CAP_STYLE[];
00048 static const Qt::PenJoinStyle PEN_JOIN_STYLE[];
00049 };
00050
00051
00052
00053
00054
00063 inline bool QSwingGraphics::canPaint(JNIEnv *env, jlong graphicsPointer)
00064 {
00065 return (graphicsPointer && JNIQSwingWrapper::isQSwingThread(env));
00066 }
00067
00068
00069
00070
00071
00072 #define qSwingGraphics (reinterpret_cast<QSwingGraphics *>(graphicsPointer))
00073 #define qPainterPath (reinterpret_cast<QPainterPath *>(painterPathPointer))
00074 #define qPaintDevice (reinterpret_cast<QPaintDevice *>(paintDevicePointer))
00075
00076 #endif //QSWINGGRAPHICS_H
00077
00078
00079
00080
00081
00082
00083
00084