extern "C" void gxpport_render_immutableimage (gxpport_image_native_handle immutableImagePtr, gxpport_mutableimage_native_handle dstMutableImagePtr, const jshort *clip, jint x_dest, jint y_dest) { _Platform_ImmutableImage* immutableImage = (_Platform_ImmutableImage*)immutableImagePtr; QPixmap *qpixmapDst = gxpportqt_get_mutableimage_pixmap(dstMutableImagePtr); if (NULL == immutableImage || immutableImage->qimage->isNull()) { /* not a valid image should not happen, log this */ return; } MScreen * mscreen = qteapp_get_mscreen(); QPainter *gc = mscreen->setupGC(-1, -1, clip, (QPaintDevice *)qpixmapDst, 0); if (immutableImage->qimage->hasAlphaBuffer()) { gc->drawImage(x_dest, y_dest, *immutableImage->qimage); return; } gc->drawPixmap(x_dest, y_dest, *(gxpportqt_get_immutableimage_pixmap(immutableImagePtr))); }
extern "C" void gxpport_destroy_mutable(gxpport_mutableimage_native_handle imagePtr) { /* we know : non-null QPixmap object has been allocated */ QPixmap* qpixmap = (QPixmap *)(imagePtr); /* make sure there is a valid qpixmap */ if (qpixmap == NULL) { return; } MScreen * mscreen = qteapp_get_mscreen(); if (mscreen->isCurrentPaintDevice(qpixmap)) { // remove pixmap as the current painting device short clip[] = {0, 0, 0, 0}; mscreen->setupGC(-1, -1, clip, NULL, 0); } /* Update the resource count */ if (midpDecResourceCount(RSC_TYPE_IMAGE_MUT, ImgRscSize(qpixmap)) == 0) { REPORT_INFO(LC_LOWUI,"Error in updating resource limit for" " Mutable image"); } /* RELEASE QT RESOURCES HELD */ delete qpixmap; }
/** * Draw the first n characters in charArray, with the anchor point of the * entire (sub)string located at x, y. */ extern "C" void gxpport_draw_chars( jint pixel, const jshort *clip, gxpport_mutableimage_native_handle dst, int dotted, int face, int style, int size, int x, int y, int anchor, const jchar *charArray, int n) { QPixmap* qpixmap = gxpportqt_get_mutableimage_pixmap(dst); QString s(make_string(charArray, n)); REPORT_INFO4(LC_LOWUI, "gxpport_draw_chars(%d, %d, %x, [chars...], %d)", x, y, anchor, n); find_font(face, style, size); switch (anchor & (LEFT | RIGHT | HCENTER)) { case LEFT: break; case RIGHT: x -= qfontInfo->width(s); break; case HCENTER: x -= (qfontInfo->width(s) >> 1); break; } switch (anchor & (TOP | BOTTOM | BASELINE)) { case BOTTOM: /* 1 pixel has to be added to account for baseline in Qt */ y -= qfontInfo->descent()+1; case BASELINE: break; case TOP: default: y += qfontInfo->ascent(); break; } MScreen * mscreen = qteapp_get_mscreen(); QPainter *gc = mscreen->setupGC(pixel, -1, clip, (QPaintDevice*)qpixmap, dotted); gc->setFont(find_font(face, style, size)); gc->drawText(x, y, s, n); }
extern "C" void gxpport_render_mutableimage(gxpport_mutableimage_native_handle srcImagePtr, gxpport_mutableimage_native_handle dstImagePtr, const jshort *clip, jint x_dest, jint y_dest) { QPixmap *qpixmapDst = (QPixmap *)(dstImagePtr); MScreen * mscreen = qteapp_get_mscreen(); QPainter *gc = mscreen->setupGC(-1, -1, clip, (QPaintDevice *)qpixmapDst, 0); QPixmap *qpixmapSrc = (QPixmap *)(srcImagePtr); gc->drawPixmap(x_dest, y_dest, *qpixmapSrc); }
extern "C" void gxpport_render_immutableregion (gxpport_image_native_handle immutableImagePtr, gxpport_mutableimage_native_handle dstMutableImagePtr, const jshort *clip, jint x_dest, jint y_dest, jint width, jint height, jint x_src, jint y_src, jint transform) { _Platform_ImmutableImage* immutableImage = (_Platform_ImmutableImage*)immutableImagePtr; QPixmap *qpixmapDst = gxpportqt_get_mutableimage_pixmap(dstMutableImagePtr); if (NULL == immutableImagePtr || immutableImage->qimage->isNull()) { /* not a valid image should not happen, log this */ return; } MScreen * mscreen = qteapp_get_mscreen(); QPainter *gc = mscreen->setupGC(-1, -1, clip, (QPaintDevice *)qpixmapDst, 0); if (0 == transform) { gc->drawImage(x_dest, y_dest, *immutableImage->qimage, x_src, y_src, width, height, 0); return; } QImage image = immutableImage->qimage->copy(x_src, y_src, width, height); transform_image(&image, transform); if (!image.isNull()) { gc->drawImage(x_dest, y_dest, image); } }
extern "C" void gxpport_render_mutableregion(gxpport_mutableimage_native_handle srcImagePtr, gxpport_mutableimage_native_handle dstImagePtr, const jshort *clip, jint x_dest, jint y_dest, jint width, jint height, jint x_src, jint y_src, jint transform) { QPixmap *qpixmapDst = (QPixmap *)(dstImagePtr); MScreen * mscreen = qteapp_get_mscreen(); QPainter *gc = mscreen->setupGC(-1, -1, clip, (QPaintDevice *)qpixmapDst, 0); QPixmap *qpixmapSrc = (QPixmap *)(srcImagePtr); if (NULL == qpixmapSrc || qpixmapSrc->isNull()) { /* not a valid pixmap. */ return; } if (0 == transform) { gc->drawPixmap(x_dest, y_dest, *qpixmapSrc, x_src, y_src, width, height); return; } QPixmap *qpixmap = new QPixmap(); get_transformed_pixmap(qpixmapSrc, qpixmap, x_src, y_src, width, height, transform, FALSE); gc->drawPixmap(x_dest, y_dest, *qpixmap); delete qpixmap; }