コード例 #1
0
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)));
}
コード例 #2
0
/**
 * Create the container window for a Form. 
 * The container window should be created in background and displayed
 * after its content is populated.
 * Return the error condition.
 * On successful return, fields in *formPtr should be set properly.
 */
extern "C" MidpError
lfpport_form_create(MidpDisplayable* dispPtr,
		    const pcsl_string* title, const pcsl_string* tickerText) {

  /* Suppress unused-parameter warning */
  (void)tickerText;

  // create container widget for items
  // and set its size to be at least of the size of the viewport
  QWidget *container = new Form();
  MScreen * mscreen = PlatformMScreen::getMScreen();

  // we need to resize container to the default viewport width 
  // and height because items with use the default size as the 
  // base for there own
  container->resize(mscreen->getScreenWidth(), mscreen->getScreenHeight());
    
  // Fill in MidpDisplayable structure
  dispPtr->frame.widgetPtr	 = container;
  dispPtr->frame.show		 = form_show;
  dispPtr->frame.hideAndDelete   = form_hide_and_delete;
  dispPtr->frame.handleEvent	 = NULL; // Not used in Qt
  dispPtr->setTitle		 = displayable_set_title;
  dispPtr->setTicker		 = displayable_set_ticker;
  
  dispPtr->setTitle(dispPtr, title);
/*  dispPtr->setTicker(dispPtr, tickerText);*/

  return KNI_OK;
}
コード例 #3
0
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;
}
コード例 #4
0
/**
 * 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);
}
コード例 #5
0
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);
}
コード例 #6
0
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);
    }
}
コード例 #7
0
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;
}