diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-26 00:29:37 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-26 00:29:37 +0000 |
commit | 2785103a6bd4de55bd26d79e34d0fdd4b329a73a (patch) | |
tree | c2738b1095bfdb263da27bc1391403d829522a14 /krita/core/kis_brush.h | |
parent | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (diff) | |
download | koffice-2785103a6bd4de55bd26d79e34d0fdd4b329a73a.tar.gz koffice-2785103a6bd4de55bd26d79e34d0fdd4b329a73a.zip |
Remove krita* in preparation for name switch from Krita to Chalk
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238361 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/core/kis_brush.h')
-rw-r--r-- | krita/core/kis_brush.h | 192 |
1 files changed, 0 insertions, 192 deletions
diff --git a/krita/core/kis_brush.h b/krita/core/kis_brush.h deleted file mode 100644 index 43fc3259..00000000 --- a/krita/core/kis_brush.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 1999 Matthias Elter <me@kde.org> - * Copyright (c) 2002 Patrick Julien <freak@codepimps.org> - * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef KIS_BRUSH_ -#define KIS_BRUSH_ - -#include <tqcstring.h> -#include <tqstring.h> -#include <tqsize.h> -#include <tqimage.h> -#include <tqvaluevector.h> - -#include <kio/job.h> - -#include "kis_resource.h" -#include "kis_types.h" -#include "kis_point.h" -#include "kis_alpha_tqmask.h" -#include "koffice_export.h" -#include "kis_boundary.h" -#include "kis_paintop.h" - -class TQPoint; -class TQPixmap; -class KisBoundary; -class KisColorSpace; -class TQIODevice; - -enum enumBrushType { - INVALID, - MASK, - IMAGE, - PIPE_MASK, - PIPE_IMAGE, - AIRBRUSH -}; - -class KRITACORE_EXPORT KisBrush : public KisResource { - typedef KisResource super; - Q_OBJECT - TQ_OBJECT - -public: - /// Construct brush to load filename later as brush - KisBrush(const TQString& filename); - /// Load brush from the specified data, at position dataPos, and set the filename - KisBrush(const TQString& filename, - const TQByteArray & data, - TQ_UINT32 & dataPos); - /// Load brush from the specified paint device, in the specified region - KisBrush(KisPaintDevice* image, int x, int y, int w, int h); - /// Load brush as a copy from the specified TQImage (handy when you need to copy a brush!) - KisBrush(const TQImage& image, const TQString& name = TQString("")); - - virtual ~KisBrush(); - - virtual bool load(); - /// synchronous, doesn't emit any signal (none defined!) - virtual bool save(); - virtual TQImage img(); - virtual bool saveToDevice(TQIODevice* dev) const; - - /** - @return a tqmask computed from the grey-level values of the - pixels in the brush. - */ - virtual KisAlphaMaskSP tqmask(const KisPaintInformation& info, - double subPixelX = 0, double subPixelY = 0) const; - // XXX: return non-tiled simple buffer - virtual KisPaintDeviceSP image(KisColorSpace * colorSpace, const KisPaintInformation& info, - double subPixelX = 0, double subPixelY = 0) const; - - void setHotSpot(KisPoint); - KisPoint hotSpot(const KisPaintInformation& info = KisPaintInformation()) const; - - void setSpacing(double s) { m_spacing = s; } - double spacing() const { return m_spacing; } - double xSpacing(double pressure = PRESSURE_DEFAULT) const; - double ySpacing(double pressure = PRESSURE_DEFAULT) const; - - // Dimensions in pixels of the tqmask/image at a given pressure. - TQ_INT32 tqmaskWidth(const KisPaintInformation& info) const; - TQ_INT32 tqmaskHeight(const KisPaintInformation& info) const; - - virtual void setUseColorAsMask(bool useColorAsMask) { m_useColorAsMask = useColorAsMask; } - virtual bool useColorAsMask() const { return m_useColorAsMask; } - virtual bool hasColor() const; - - virtual void makeMaskImage(); - TQ_INT32 width() const; - TQ_INT32 height() const; - - virtual enumBrushType brushType() const; - - //TQImage outline(double pressure = PRESSURE_DEFAULT); - virtual KisBoundary boundary(); - - /** - * Returns true if this brush can return something useful for the info. This is used - * by Pipe Brushes that can't paint sometimes - **/ - virtual bool canPaintFor(const KisPaintInformation& /*info*/) { return true; } - - virtual KisBrush* clone() const; - -protected: - void setWidth(TQ_INT32 w); - void setHeight(TQ_INT32 h); - void setImage(const TQImage& img); - void setBrushType(enumBrushType type) { m_brushType = type; }; - static double scaleForPressure(double pressure); - -private: - class ScaledBrush { - public: - ScaledBrush(); - ScaledBrush(KisAlphaMaskSP scaledMask, const TQImage& scaledImage, double scale, double xScale, double yScale); - - double scale() const { return m_scale; } - double xScale() const { return m_xScale; } - double yScale() const { return m_yScale; } - KisAlphaMaskSP tqmask() const { return m_tqmask; } - TQImage image() const { return m_image; } - - private: - KisAlphaMaskSP m_tqmask; - TQImage m_image; - double m_scale; - double m_xScale; - double m_yScale; - }; - - - bool init(); - bool initFromPaintDev(KisPaintDevice* image, int x, int y, int w, int h); - void createScaledBrushes() const; - - KisAlphaMaskSP scaleMask(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const; - TQImage scaleImage(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const; - - static TQImage scaleImage(const TQImage& srcImage, int width, int height); - static TQImage interpolate(const TQImage& image1, const TQImage& image2, double t); - - static KisAlphaMaskSP scaleSinglePixelMask(double scale, TQ_UINT8 tqmaskValue, double subPixelX, double subPixelY); - static TQImage scaleSinglePixelImage(double scale, TQRgb pixel, double subPixelX, double subPixelY); - - // Find the scaled brush(es) nearest to the given scale. - void findScaledBrushes(double scale, const ScaledBrush **aboveBrush, const ScaledBrush **belowBrush) const; - - // Initialize our boundary - void generateBoundary(); - - TQByteArray m_data; - bool m_ownData; - KisPoint m_hotSpot; - double m_spacing; - bool m_useColorAsMask; - bool m_hasColor; - TQImage m_img; - mutable TQValueVector<ScaledBrush> m_scaledBrushes; - - TQ_INT32 m_width; - TQ_INT32 m_height; - - TQ_UINT32 m_header_size; /* header_size = sizeof (BrushHeader) + brush name */ - TQ_UINT32 m_version; /* brush file version # */ - TQ_UINT32 m_bytes; /* depth of brush in bytes */ - TQ_UINT32 m_magic_number; /* GIMP brush magic number */ - - enumBrushType m_brushType; - - KisBoundary* m_boundary; - -}; -#endif // KIS_BRUSH_ - |