Commit 96081886 authored by nobody's avatar nobody

This commit was manufactured by cvs2svn to accommodate

a server-side copy/move.

svn path=/trunk/koffice/; revision=139325
parent 49672e56
Andrew Richards <physajr@phys.canterbury.ac.nz>
Matthias Elter <elter@kde.org>
Michael Koch <koch@kde.org>
Carsten Pfeiffer <pfeiffer@kde.org>
John Califf <jcaliff@compuzone.net>
Current maintainer: John Califf <jcaliff@compuzone.net>
INCLUDES = $(KOFFICE_INCLUDES) -I$(interfacedir) $(all_includes)
## The part
kde_module_LTLIBRARIES = libkritapart.la
libkritapart_la_SOURCES = dummy.cc
libkritapart_la_LDFLAGS = $(KDE_PLUGIN)
libkritapart_la_LIBADD = core/libkiscore.la ui/libkisui.la tools/libkistools.la \
../lib/kofficeui/libkofficeui.la
METASOURCES = AUTO
## The kdeinit loadable module
lib_LTLIBRARIES = krita.la
krita_la_SOURCES = main.cc
krita_la_LDFLAGS = $(all_libraries) -avoid-version -module
krita_la_LIBADD = ../lib/kofficecore/libkofficecore.la
## The executable
bin_PROGRAMS = krita
krita_SOURCES = dummy.cc
krita_LDFLAGS = $(all_libraries) $(KDE_RPATH)
krita_LDADD = krita.la
dummy.cc:
echo > dummy.cc
kdelnk_DATA = krita.desktop
kdelnkdir = $(kde_appsdir)/Office
#kdemime_DATA = x-krita.desktop
kdemimedir = $(kde_mimedir)/application
rcdir = $(kde_datadir)/krita
rc_DATA = krita.rc
SUBDIRS = core tools ui . dtd plugins data pics
messages: rc.cpp
$(XGETTEXT) rc.cpp *.cc */*.cc core/kis_aboutdata.h -o $(podir)/krita.pot
Krayon is the KOffice image manipulation application.
It does not aim to be a direct competitor to the GIMP,
but to integrate well with the other KOffice applications,
to be easy to use and yet powerfull.
We are curently in a beta developement stage but
work towards a 1.0 release that comes with all basic
image manipulation features.
The following feature list aims to give us an idea of what
we want to have in the 1.0 release:
- color modes: Indexed, Greyscale, RGB and RGBA.
- layers/channels
- layer masks
- plugin filter API
- plugin tool API
- basic image manipulation (contrast/brightness/saturation etc.)
- scale images
- zooming
- native XML file format
- basic import/export filters (png/jpg/tif/gif)
- basic plugin filters (blur/sharpen etc.)
- basic image transformations (rotate, mirror)
- move tool
- crop tool
- basic text tool
- color picker tool
- fill tool (fill with color or pattern)
- gradient tool
- pen (paint brush or pattern)
- brush (paint brush or pattern)
- airbrush (paint brush or pattern)
- eraser
- blur/sharpen with brush tool
- fullscreen editing mode
- Rules a la gimp
- Rotate layouts
- Saves channel information to file
- Undo/Redo
BUGS
- Selection tools don't get redrawed when they need to (except for rectangle select now)
- opacity is totally broken, it sort of almost works for a white background, but nothing else
- Paint offset causes mispaint
- Save in tool propeties does not work
- New for modified document does not give error
# krita has two problems currently:
# - the lack of developers ;)
# - its name conflicts with an existing product
# If anyone starts developing krita again, please rename it, first thing.
DO_NOT_COMPILE="$DO_NOT_COMPILE krita"
/* This file is part of the KDE project
Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
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.
*/
#include "KRayonViewIface.h"
#include "kis_view.h"
#include <dcopclient.h>
KRayonViewIface::KRayonViewIface( KisView *view_ )
: KoViewIface( view_ )
{
m_view = view_;
}
void KRayonViewIface::copy()
{
m_view->copy();
}
void KRayonViewIface::cut()
{
m_view->cut();
}
void KRayonViewIface::removeSelection()
{
m_view->removeSelection();
}
void KRayonViewIface::paste()
{
m_view->paste();
}
void KRayonViewIface::crop()
{
m_view->crop();
}
void KRayonViewIface::selectAll()
{
m_view->selectAll();
}
void KRayonViewIface::unSelectAll()
{
m_view->unSelectAll();
}
void KRayonViewIface::dialog_gradient()
{
m_view->dialog_gradient();
}
void KRayonViewIface::dialog_colors()
{
m_view->dialog_colors();
}
void KRayonViewIface::dialog_krayons()
{
m_view->dialog_krayons();
}
void KRayonViewIface::dialog_brushes()
{
m_view->dialog_brushes();
}
void KRayonViewIface::dialog_patterns()
{
m_view->dialog_patterns();
}
void KRayonViewIface::dialog_layers()
{
m_view->dialog_layers();
}
void KRayonViewIface::dialog_channels()
{
m_view->dialog_channels();
}
void KRayonViewIface::insert_layer()
{
m_view->insert_layer();
}
void KRayonViewIface::remove_layer()
{
m_view->remove_layer();
}
void KRayonViewIface::link_layer()
{
m_view->link_layer();
}
void KRayonViewIface::hide_layer()
{
m_view->hide_layer();
}
void KRayonViewIface::next_layer()
{
m_view->next_layer();
}
void KRayonViewIface::previous_layer()
{
m_view->previous_layer();
}
void KRayonViewIface::layer_properties()
{
m_view->layer_properties();
}
/* This file is part of the KDE project
Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
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 KRAYON_VIEW_IFACE_H
#define KRAYON_VIEW_IFACE_H
#include <KoViewIface.h>
#include <qstring.h>
class KisView;
class KRayonViewIface : public KoViewIface
{
K_DCOP
public:
KRayonViewIface( KisView *view_ );
k_dcop:
void copy();
void cut();
void removeSelection();
void paste();
void crop();
void selectAll();
void unSelectAll();
// dialog action slots
void dialog_gradient();
void dialog_colors();
void dialog_krayons();
void dialog_brushes();
void dialog_patterns();
void dialog_layers();
void dialog_channels();
// layer action slots
void insert_layer();
void remove_layer();
void link_layer();
void hide_layer();
void next_layer();
void previous_layer();
void layer_properties();
private:
KisView *m_view;
};
#endif
INCLUDES = -I$(srcdir)/../ui -I$(srcdir)/../tools $(KOFFICE_INCLUDES) -I$(interfacedir) $(all_includes)
noinst_LTLIBRARIES = libkiscore.la
libkiscore_la_SOURCES = kis_shell.cc kis_view.cc kis_channel.cc kis_layer.cc kis_image.cc \
kis_pluginserver.cc kis_resourceserver.cc \
kis_factory.cc kis_config.cc kis_undo.cc \
kis_doc.cc \
kis_krayon.cc kis_brush.cc kis_pattern.cc kis_gradient.cc \
kis_util.cc kis_tool.cc kis_vec.cc kis_color.cc \
kis_cursor.cc kis_timer.cc \
kis_selection.cc kis_framebuffer.cc kis_painter.cc kis_tool_factory.cc \
KRayonViewIface.skel KRayonViewIface.cc
libkiscore_la_METASOURCES = AUTO
/*
* kis_aboutdata.h - part of Krayon
*
* Copyright (c) 1999-2000 Matthias Elter <me@kde.org>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef KRAYON_ABOUTDATA
#define KRAYON_ABOUTDATA
#include <kaboutdata.h>
#include <klocale.h>
KAboutData * newKrayonAboutData()
{
KAboutData * aboutData = new KAboutData( "krayon",
I18N_NOOP("Krayon"),
"0.2.0",
I18N_NOOP("KOffice image manipulation application."),
KAboutData::License_GPL,
"(c) 1999-2001 The Krayon team.",
"",
"http://koffice.kde.org/krayon",
"submit@bugs.kde.org");
aboutData->addAuthor("Matthias Elter", 0, "me@kde.org");
aboutData->addAuthor("Carsten Pfeiffer", 0, "carpdjih@cetus.zrz.tu-berlin.de");
aboutData->addAuthor("Michael Koch", 0, "koch@kde.org");
aboutData->addAuthor("John Califf",0, "jcaliff@compuzone.net");
aboutData->addAuthor("Laurent Montel",0, "lmontel@mandrakesoft.com");
aboutData->addAuthor("Toshitaka Fujioka", 0, "fujioka@kde.org");
return aboutData;
}
#endif
/*
* kis_brush.cc - part of Krayon
*
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
* 2001 John Califf
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <qpoint.h>
#include <qsize.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qfileinfo.h>
#include <kimageeffect.h>
#include <ksimpleconfig.h>
#include <kdebug.h>
#include "kis_brush.h"
#include "kis_util.h"
#define THUMB_SIZE 30
KisBrush::KisBrush(QString file, bool monochrome, bool special)
: KisKrayon()
{
// set defaults
m_valid = false;
validThumb = false;
validPixmap = false;
m_spacing = 4;
m_hotSpot = QPoint( 0, 0 );
// load the brush image data
loadViaQImage(file, monochrome);
if(m_valid)
{
int meanSize = (width() + height())/2;
m_spacing = meanSize / 4;
if(m_spacing < 1) m_spacing = 1;
if(m_spacing > 20) m_spacing = 20;
// default hotspot
if(!special)
m_hotSpot = QPoint(width()/2, height()/2);
else
m_hotSpot = QPoint(0, 0);
// search and load the brushinfo file
if(!special)
{
QFileInfo fi(file);
file = fi.dirPath() + "/" + fi.baseName() + ".brushinfo";
fi.setFile(file);
if (fi.exists() && fi.isFile())
readBrushInfo(file);
}
}
}
KisBrush::~KisBrush()
{
if(hasValidPixmap())
{
delete [] m_pData;
delete m_pPixmap;
}
if(hasValidThumb())
{
delete m_pThumbPixmap;
}
}
void KisBrush::readBrushInfo(QString file)
{
KSimpleConfig config(file, true);
config.setGroup("General");
int spacing = config.readNumEntry("Spacing", m_spacing);
int hotspotX = config.readNumEntry("hotspotX", m_hotSpot.x());
int hotspotY = config.readNumEntry("hotspotY", m_hotSpot.y());
if(spacing > 0) m_spacing = spacing;
if(hotspotX > 0 && hotspotY > 0) m_hotSpot = QPoint(hotspotX, hotspotY);
}
/*
Load from file, actually
*/
void KisBrush::loadViaQImage(QString file, bool monochrome)
{
QImage img(file);
if (img.isNull())
{
m_valid = false;
kdDebug()<<"Failed to load brush: "<< file.latin1()<<endl;
}
// scale a pixmap for iconview cell to size of cell
if(img.width() > THUMB_SIZE || img.height() > THUMB_SIZE)
{
QPixmap filePixmap;
filePixmap.load(file);
QImage fileImage = filePixmap.convertToImage();
int xsize = THUMB_SIZE;
int ysize = THUMB_SIZE;
int picW = fileImage.width();
int picH = fileImage.height();
if(picW > picH)
{
float yFactor = (float)((float)(float)picH/(float)picW);
ysize = (int)(yFactor * (float)THUMB_SIZE);
//kdDebug() << "ysize is " << ysize << endl;
if (ysize > THUMB_SIZE)
ysize = THUMB_SIZE;
}
else if(picW < picH)
{
float xFactor = (float)((float)picW/(float)picH);
xsize = (int)(xFactor * (float)THUMB_SIZE);
//kdDebug() << "xsize is " << xsize << endl;
if(xsize > THUMB_SIZE)
xsize = THUMB_SIZE;
}
QImage thumbImg = fileImage.smoothScale(xsize, ysize);
if (!thumbImg.isNull()) {
m_pThumbPixmap = new QPixmap();
m_pThumbPixmap -> convertFromImage(thumbImg);
validThumb = !m_pThumbPixmap -> isNull();
if(!validThumb) {
delete m_pThumbPixmap;
m_pThumbPixmap = 0;
}
}
}
img = img.convertDepth(32);
if(monochrome) img = KImageEffect::toGray(img, true);
// create pixmap for preview
m_pPixmap = new QPixmap;
m_pPixmap->convertFromImage(img, QPixmap::AutoColor);
m_w = img.width();
m_h = img.height();
m_pData = new uchar[m_h * m_w];
uint *p;
for (int h = 0; h < m_h; h++)
{
p = (QRgb*)img.scanLine(h);
for (int w = 0; w < m_w; w++)
{
// no need to use qGray here, we have
// converted the image to grayscale already
if(monochrome)
m_pData[m_w * h + w] = 255 - qRed(*(p+w));
else
m_pData[m_w * h + w] = *(p+w);
}
}
m_valid = true;
validPixmap = true;
// kdDebug()<<"Loading brush: "<<file.latin1()<<endl;
}
void KisBrush::setHotSpot(QPoint pt)
{
int x = pt.x();
int y = pt.y();
if (x < 0) x = 0;
else if (x >= m_w) x = m_w-1;
if (y < 0) y = 0;
else if (y >= m_h) y = m_h-1;
m_hotSpot = QPoint(x,y);
}
uchar KisBrush::value(int x, int y) const
{
return m_pData[m_w * y + x];
}
uchar* KisBrush::scanline(int i) const
{
if (i < 0) i = 0;
if (i >= m_h) i = m_h-1;
return (m_pData + m_w * i);
}
uchar* KisBrush::bits() const
{
return m_pData;
}
void KisBrush::dump() const
{
kdDebug()<<"KisBrush data:\n";
for (int h = 0; h < m_h; h++)
{
for (int w = 0; w < m_w; w++)
{
kdDebug()<<" :"<< m_pData[m_w * h + w]<<endl;
}
}
}