krita
kis_image_iface.cc
00001 /* 00002 * This file is part of the KDE project 00003 * 00004 * Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 #include <kapplication.h> 00021 00022 #include "kis_image_iface.h" 00023 #include "kis_types.h" 00024 #include "kis_image.h" 00025 #include "kis_paint_device.h" 00026 #include "kis_paint_device_iface.h" 00027 #include <dcopclient.h> 00028 00029 KisImageIface::KisImageIface( KisImage * img ) 00030 : DCOPObject(img->name().utf8()) 00031 { 00032 m_img = img; 00033 } 00034 00035 int KisImageIface::height() const 00036 { 00037 return m_img->height(); 00038 } 00039 00040 int KisImageIface::width() const 00041 { 00042 return m_img->width(); 00043 } 00044 00045 void KisImageIface::setName(const QString& name) 00046 { 00047 m_img->setName( name ); 00048 } 00049 00050 void KisImageIface::rotateCCW() 00051 { 00052 // XXX: Add progress display if there is a view 00053 m_img->rotate(270, 0); 00054 } 00055 00056 void KisImageIface::rotateCW() 00057 { 00058 // XXX: Add progressdisplay if there is a view 00059 m_img->rotate(90, 0); 00060 } 00061 00062 void KisImageIface::rotate180() 00063 { 00064 // XXX: Add progressdisplay if there is a view 00065 m_img->rotate(180, 0); 00066 } 00067 00068 void KisImageIface::rotate(double angle) 00069 { 00070 // XXX: Add progressdisplay if there is a view 00071 angle *= M_PI/180; 00072 m_img->rotate(angle, 0); 00073 } 00074 00075 DCOPRef KisImageIface::activeDevice() 00076 { 00077 KisPaintDeviceSP dev = m_img->activeDevice(); 00078 00079 if( !dev ) 00080 return DCOPRef(); 00081 else 00082 return DCOPRef( kapp->dcopClient()->appId(), 00083 dev->dcopObject()->objId(), 00084 "KisPaintDeviceIface"); 00085 00086 } 00087 00088 DCOPRef KisImageIface::colorSpace() const 00089 { 00090 KisColorSpace * cs = m_img->colorSpace(); 00091 if ( !cs ) 00092 return DCOPRef(); 00093 else 00094 return DCOPRef( kapp->dcopClient()->appId(), 00095 cs->dcopObject()->objId(), 00096 "KisColorSpaceIface" ); 00097 }