/***************************************************************************
                            KIconEffect.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

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

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KIconEffect.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KIconEffect.h>
#include <qtobjc/QColor.h>
#include <qtobjc/QImage.h>
#include <qtobjc/QPixmap.h>
#include <qtobjc/QRect.h>
#include <qtobjc/QWidget.h>


@implementation  KIconEffect

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KIconEffect()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_KIconEffect((kde_KIconEffect *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

//- init
//{
//	kde_KIconEffect_init((kde_KIconEffect *)[self qt]);
//	return self;
//}

- (BOOL) hasEffect: (int)group state: (int)state
{
	return (BOOL) kde_KIconEffect_hasEffect((kde_KIconEffect *)[self qt], (int)group, (int)state);
}

- (NSString *) fingerprint: (int)group state: (int)state
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KIconEffect_fingerprint((kde_KIconEffect *)[self qt], (int)group, (int)state);
	return [NSString fromQString: _qstring];
}

- (QImage*) applyToImage: (QImage *)src group: (int)group state: (int)state
{
	return (QImage*) [QtSupport objectForQtKey: kde_KIconEffect_apply((kde_KIconEffect *)[self qt], (qt_QImage *) [src qt], (int)group, (int)state) withClass: [QImage class] allocatedInObjcWorld: YES];
}

- (QImage*) applyToImage: (QImage *)src effect: (int)effect value: (float)value rgb: (QColor *)rgb trans: (BOOL)trans
{
	return (QImage*) [QtSupport objectForQtKey: kde_KIconEffect_apply1((kde_KIconEffect *)[self qt], (qt_QImage *) [src qt], (int)effect, (float)value, (qt_QColor *) [rgb qt], (int)trans) withClass: [QImage class] allocatedInObjcWorld: YES];
}

- (QPixmap*) applyToPixmap: (QPixmap *)src group: (int)group state: (int)state
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KIconEffect_apply2((kde_KIconEffect *)[self qt], (qt_QPixmap *) [src qt], (int)group, (int)state) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (QPixmap*) applyToPixmap: (QPixmap *)src effect: (int)effect value: (float)value rgb: (QColor *)rgb trans: (BOOL)trans
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KIconEffect_apply3((kde_KIconEffect *)[self qt], (qt_QPixmap *) [src qt], (int)effect, (float)value, (qt_QColor *) [rgb qt], (int)trans) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (QImage*) doublePixels: (QImage *)src
{
	return (QImage*) [QtSupport objectForQtKey: kde_KIconEffect_doublePixels((kde_KIconEffect *)[self qt], (qt_QImage *) [src qt]) withClass: [QImage class] allocatedInObjcWorld: YES];
}

+ visualActivate: (QWidget *)arg1 rect: (QRect*)arg2
{
	kde_KIconEffect_visualActivate((qt_QWidget *) [arg1 qt], (qt_QRect*) [arg2 qt]);
	return self;
}

+ toGray: (QImage *)image value: (float)value
{
	kde_KIconEffect_toGray((qt_QImage *) [image qt], (float)value);
	return self;
}

+ colorize: (QImage *)image col: (QColor *)col value: (float)value
{
	kde_KIconEffect_colorize((qt_QImage *) [image qt], (qt_QColor *) [col qt], (float)value);
	return self;
}

+ deSaturate: (QImage *)image value: (float)value
{
	kde_KIconEffect_deSaturate((qt_QImage *) [image qt], (float)value);
	return self;
}

+ toGamma: (QImage *)image value: (float)value
{
	kde_KIconEffect_toGamma((qt_QImage *) [image qt], (float)value);
	return self;
}

+ semiTransparentImage: (QImage *)image
{
	kde_KIconEffect_semiTransparent((qt_QImage *) [image qt]);
	return self;
}

+ semiTransparentPixmap: (QPixmap *)pixmap
{
	kde_KIconEffect_semiTransparent1((qt_QPixmap *) [pixmap qt]);
	return self;
}

+ overlay: (QImage *)src overlay: (QImage *)overlay
{
	kde_KIconEffect_overlay((qt_QImage *) [src qt], (qt_QImage *) [overlay qt]);
	return self;
}

+ (int) NoEffect
{
	return (int) KICONEFFECT_NoEffect;
}

+ (int) ToGray
{
	return (int) KICONEFFECT_ToGray;
}

+ (int) Colorize
{
	return (int) KICONEFFECT_Colorize;
}

+ (int) ToGamma
{
	return (int) KICONEFFECT_ToGamma;
}

+ (int) DeSaturate
{
	return (int) KICONEFFECT_DeSaturate;
}

+ (int) LastEffect
{
	return (int) KICONEFFECT_LastEffect;
}

@end
