// -*- c++ -*-

/*
 *  Copyright (C) 2003, Richard J. Moore <rich@kde.org>
 *
 *  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.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA 02111-1307, USA.
 */

#ifndef KJSEMBED_IMAGE_IMP_H
#define KJSEMBED_IMAGE_IMP_H

#include <qobject.h>

class QImage;

namespace KJSEmbed {
namespace Bindings {

/**
 * QObject Binding for QImage.
 */
class Image : public QObject
{
    Q_OBJECT
    Q_PROPERTY( int width READ width )
    Q_PROPERTY( int height READ height )
    Q_PROPERTY( int depth READ depth )
    Q_PROPERTY( bool ok READ isOk )
    Q_PROPERTY( QString format READ format WRITE setFormat )
    Q_PROPERTY( QString filename READ filename )

public:
    Image( QObject *parent, const char *name=0 );
    Image( QObject *parent, const char *name, QImage *img );
    virtual ~Image();

    QString filename() const;
    QString format() const;
    int width() const;
    int height() const;
    int depth() const;

    bool isOk() const;

public slots:
    bool load( const QString &filename );
    bool save( const QString &filename );
    void setFormat( const QString &fmt );
    void smoothScale( int w, int h );
    void smoothScaleMin( int w, int h );

private:
    QImage *img;
    QString nm;
    QString fmt;
    bool ok;
};

} // namespace
} // namespace

#endif // KJSEMBED_IMAGE_IMP_H

