tahoma2d/toonz/sources/tnztools/bluredbrush.h

59 lines
1.8 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef T_BLUREDBRUSH
#define T_BLUREDBRUSH
#include "traster.h"
#include "trastercm.h"
#include "tcurves.h"
#include <QPainter>
#include <QImage>
#include <QSet>
2016-03-19 06:57:51 +13:00
//=======================================================
//
2016-06-15 18:43:10 +12:00
// BluredBrush
2016-03-19 06:57:51 +13:00
//
//=======================================================
2016-06-15 18:43:10 +12:00
class BluredBrush {
TRaster32P m_ras;
QImage m_rasImage;
int m_size;
QRadialGradient m_gradient;
TThickPoint m_lastPoint;
double m_oldOpacity;
bool m_enableDinamicOpacity;
2016-03-19 06:57:51 +13:00
QSet<int> m_aboveStyleIds;
2016-06-15 18:43:10 +12:00
double getNextPadPosition(const TThickQuadratic &q, double t) const;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
BluredBrush(const TRaster32P &ras, int size, const QRadialGradient &gradient,
bool doDinamicOpacity);
~BluredBrush();
void addPoint(const TThickPoint &p, double opacity);
void addArc(const TThickPoint &pa, const TThickPoint &pb,
const TThickPoint &pc, double opacityA, double opacityC);
TRect getBoundFromPoints(const std::vector<TThickPoint> &points) const;
// colormapped
void updateDrawing(const TRasterCM32P rasCM, const TRasterCM32P rasBackupCM,
const TRect &bbox, int styleId, int drawOrderMode) const;
2016-06-15 18:43:10 +12:00
void eraseDrawing(const TRasterCM32P rasCM, const TRasterCM32P rasBackupCM,
const TRect &bbox, bool selective, int selectedStyleId,
const std::wstring &mode) const;
void setAboveStyleIds(QSet<int> &ids) { m_aboveStyleIds = ids; }
2016-06-15 18:43:10 +12:00
// fullcolor
void updateDrawing(const TRasterP ras, const TRasterP rasBackup,
const TPixel32 &color, const TRect &bbox,
double opacity) const;
void eraseDrawing(const TRasterP ras, const TRasterP rasBackup,
const TRect &bbox, double opacity) const;
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // T_BLUREDBRUSH