/*************************************************************************** * Copyright (C) 2004 by Johan Maes - ON4QZ * * on4qz@telenet.be * * http://users.telenet.be/on4qz * * * * 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. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CANVAS_H #define CANVAS_H #include #include #include #include #include #include "canvasitems.h" /** \file */ /** @author Johan Maes - ON4QZ */ class mcanvas : public QCanvas { public: /*! loaded image type */ enum eImageType { FLATIMAGE, /*!< loaded image is a simple image (png,jpeg,...) */ TEMPLATE /*!< tloaded image is a template file */ }; mcanvas(int w,int h); ~mcanvas(); void resize(int w,int h); bool load(QFile &f); bool save(QFile &f,bool asTemplate); QImage *getImage(QSize size); void setImage(QImage *ima,int w=0,int h=0); void bringToFront(); void sendToBack(); void forward(); void backward(); void clearAll(); canvasItemBase *createItem(int itemType); QImage *overlay(QImage *im,int templateIndex); QImage *overlay(QImage *im,QString fn); canvasItemBase *current(); void copy(); void paste(); void selectFront(); void deleteObject(); bool checkSelected(); void resetSelected(); void setSelected(); void setSelected(QPoint p); canvasItemBase * makeSelection(QPoint cl,bool selectObject=TRUE); int count(); eImageType getImageType(){ return imageType;} private: void optimizeDepth(); void flattenImage(); /** mcanvas keeps track of the latest acccessed item */ canvasItemBase * currentObject; QImage im; int depth; scanvasItemParam copyParam; eImageType imageType; }; #endif