/***************************************************************************
                            QPNGImageWriter.cpp -  description
                             -------------------
    begin                : Wed Nov 21 17:05:56 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 17:05:56 2001, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <qpngio.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <qtjava/QPNGImageWriter.h>

class QPNGImageWriterJBridge : public QPNGImageWriter
{
public:
	QPNGImageWriterJBridge(QIODevice* arg1) : QPNGImageWriter(arg1) {}
	~QPNGImageWriterJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_newQPNGImageWriter(JNIEnv *env, jobject obj, jobject arg1)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QPNGImageWriterJBridge((QIODevice*) QtSupport::getQt(env, arg1)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (QPNGImageWriter*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_setDisposalMethod(JNIEnv *env, jobject obj, jint arg1)
{
	((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->setDisposalMethod((QPNGImageWriter::DisposalMethod) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_setLooping__I(JNIEnv *env, jobject obj, jint loops)
{
	((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->setLooping((int) loops);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_setLooping__(JNIEnv *env, jobject obj)
{
	((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->setLooping(0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_setFrameDelay(JNIEnv *env, jobject obj, jint msecs)
{
	((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->setFrameDelay((int) msecs);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QPNGImageWriter_setGamma(JNIEnv *env, jobject obj, jfloat arg1)
{
	((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->setGamma((float) arg1);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPNGImageWriter_writeImage__Lorg_kde_qt_QImage_2II(JNIEnv *env, jobject obj, jobject img, jint x, jint y)
{
	return (jboolean) ((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->writeImage((QImage&) *(QImage *) QtSupport::getQt(env, img), (int) x, (int) y);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPNGImageWriter_writeImage__Lorg_kde_qt_QImage_2III(JNIEnv *env, jobject obj, jobject img, jint quality, jint x, jint y)
{
	return (jboolean) ((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->writeImage((QImage&) *(QImage *) QtSupport::getQt(env, img), (int) quality, (int) x, (int) y);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPNGImageWriter_writeImage__Lorg_kde_qt_QImage_2(JNIEnv *env, jobject obj, jobject img)
{
	return (jboolean) ((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->writeImage((QImage&) *(QImage *) QtSupport::getQt(env, img));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QPNGImageWriter_writeImage__Lorg_kde_qt_QImage_2I(JNIEnv *env, jobject obj, jobject img, jint quality)
{
	return (jboolean) ((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->writeImage((QImage&) *(QImage *) QtSupport::getQt(env, img), (int) quality);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QPNGImageWriter_device(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QPNGImageWriterJBridge*) QtSupport::getQt(env, obj))->device(), "org.kde.qt.QIODeviceInterface");
}

