QSwingImageBridge.h

00001 /*
00002  * @(#)QSwingImageBridge.h  0.2.0 / 2007-09-14
00003  *
00004  * Copyright (c) 2007, ETF and contributors. All rights reserved.
00005  *
00006  * This software is licensed under the LGPL, version 2.1, license.
00007  * A copy of the license is included in the file LICENSE-LGPL.txt.
00008  */
00009 #ifndef QSWINGIMAGEBRIDGE_H
00010 #define QSWINGIMAGEBRIDGE_H
00011 
00012 #include "JavaQxQSwing.h"
00013 
00014 /*^**************************************************************************^*/
00015 /*- QSwingImageBridge Class.                                                 -*/
00016 /*^**************************************************************************^*/
00017 
00024 class JAVAQX_EXPORT QSwingImageBridge
00025 {
00026 public: // native calls
00027   static jlong createImage(JNIEnv *env);
00028   static jlong createImage(JNIEnv *env, jobject obj, jbyteArray imageData,
00029                            jint lenght);
00030   static jobject createScaled(JNIEnv *env, jlong imagePointer, jint width,
00031                               jint height, jint hints, jstring format);
00032   static void initialize(JNIEnv *env, jclass cls);
00033 public:
00034   static jobject newInstance(const QPixmap &pixmap, jstring format);
00035   static QPixmap *createDisabledPixmap(QPixmap *pm);
00036   static bool loadImage(JNIEnv *env, jbyteArray imageData, jint length,
00037                         QPixmap *pixmap);
00038 private:
00039   static jclass sm_imageClass;
00040   static jmethodID sm_constructorMID;
00041   static jfieldID sm_widthFID;
00042   static jfieldID sm_heightFID;
00043 };
00044 
00045 /*^**************************************************************************^*/
00046 /*- Macro Definition.                                                        -*/
00047 /*^**************************************************************************^*/
00048 
00049 #define qSwingImage (reinterpret_cast<QPixmap *>(imagePointer))
00050 
00051 #endif //QSWINGIMAGEBRIDGE_H
00052 
00053 /*^*****************************************************************************
00054   File History:
00055 
00056  - 2007-09-14 12:50:39 Slobodan
00057    Initial version
00058 
00059 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.