1 #include "qwpsdrawer.h"
7 void QWpsDrawer::putsxy(int x
, int y
, const unsigned char *str
) {
10 api
.get_current_vp(&avp
);
14 QFont
font("times",avp
.fontheight
,QFont::Bold
);
16 p
.drawText(x
+avp
.x
,y
+ avp
.fontheight
+ avp
.y
,(char*)str
);
18 void QWpsDrawer::transparent_bitmap_part(const void *src
, int src_x
, int src_y
,
19 int stride
, int x
, int y
, int width
, int height
) {
22 DEBUGF2("transparent_bitmap_part(const void *src=%s, int src_x=%d, int src_y=%d,int stride=%d, int x=%d, int y=%d, int width=%d, int height=%d",(char*)src
,src_x
, src_y
,stride
, x
, y
, width
, height
);
25 QRectF
source(src_x
, src_y
, width
, height
);
27 QImage pink
= img
.createMaskFromColor(qRgb(255,0,255),Qt::MaskOutColor
);
28 img
.setAlphaChannel(pink
);
30 p
.drawImage(target
, img
, source
);
32 void QWpsDrawer::bitmap_part(const void *src
, int src_x
, int src_y
,
33 int stride
, int x
, int y
, int width
, int height
) {
34 transparent_bitmap_part(src
,src_x
,src_y
,stride
,x
,y
,width
,height
);
36 void QWpsDrawer::drawpixel(int x
, int y
) {
41 void QWpsDrawer::fillrect(int x
, int y
, int width
, int height
) {
43 DEBUGF2("fillrect(int x=%d, int y=%d, int width=%d, int height=%d)\n",x
, y
, width
, height
);
46 void QWpsDrawer::hline(int x1
, int x2
, int y
) {
49 p
.drawLine(x1
,y
,x2
,y
);
51 void QWpsDrawer::vline(int x
, int y1
, int y2
) {
54 p
.drawLine(x
,y1
,x
,y2
);
56 bool QWpsDrawer::load_wps_backdrop(char* filename
) {
57 DEBUGF2("load backdrop: %s", filename
);
60 file
.copy(mTmpWpsString
+"/"+info
.fileName());
61 backdrop
.load(filename
);
65 int QWpsDrawer::read_bmp_file(const char* filename
,int *width
, int *height
) {
70 file
.copy(mTmpWpsString
+"/"+info
.fileName());
73 //qDebug()<<"QWpsDrawer::read_bmp_file"<<img.width()<<img.height();
75 *height
= img
.height();