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>
|
2018-03-14 21:33:59 +13:00
|
|
|
#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;
|
2021-07-08 23:59:34 +12:00
|
|
|
bool m_enableDynamicOpacity;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2018-03-14 21:33:59 +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,
|
2021-07-08 23:59:34 +12:00
|
|
|
bool doDynamicOpacity);
|
2023-02-04 15:05:42 +13:00
|
|
|
BluredBrush(BluredBrush *src);
|
2016-06-15 18:43:10 +12:00
|
|
|
~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,
|
2021-06-04 10:18:07 +12:00
|
|
|
const TRect &bbox, int styleId, int drawOrderMode,
|
|
|
|
bool lockAlpha) 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;
|
|
|
|
|
2018-03-14 21:33:59 +13:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2023-02-04 15:05:42 +13:00
|
|
|
//************************************************************************
|
|
|
|
// Raster Blurred Brush
|
|
|
|
//************************************************************************
|
|
|
|
class RasterBlurredBrush {
|
|
|
|
private:
|
|
|
|
std::vector<BluredBrush *> m_blurredBrushes;
|
|
|
|
|
|
|
|
int m_brushCount;
|
|
|
|
double m_rotation;
|
|
|
|
TPointD m_centerPoint;
|
|
|
|
bool m_useLineSymmetry;
|
|
|
|
TPointD m_rasCenter, m_dpiScale;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RasterBlurredBrush(const TRaster32P &ras, int size,
|
|
|
|
const QRadialGradient &gradient, bool doDynamicOpacity);
|
|
|
|
|
|
|
|
void addSymmetryBrushes(double lines, double rotation, TPointD centerPoint,
|
|
|
|
bool useLineSymmetry, TPointD dpiScale);
|
|
|
|
bool hasSymmetryBrushes() { return m_brushCount > 1; }
|
|
|
|
void setAboveStyleIds(QSet<int> &ids);
|
|
|
|
TRect getBoundFromPoints(const std::vector<TThickPoint> &points);
|
|
|
|
void addPoint(const TThickPoint &p, double opacity);
|
|
|
|
void addArc(const TThickPoint &pa, const TThickPoint &pb,
|
|
|
|
const TThickPoint &pc, double opacityA, double opacityC);
|
|
|
|
// colormapped
|
|
|
|
void updateDrawing(const TRasterCM32P rasCM, const TRasterCM32P rasBackupCM,
|
|
|
|
const TRect &bbox, int styleId, int drawOrderMode,
|
|
|
|
bool lockAlpha);
|
|
|
|
void eraseDrawing(const TRasterCM32P rasCM, const TRasterCM32P rasBackupCM,
|
|
|
|
const TRect &bbox, bool selective, int selectedStyleId,
|
|
|
|
const std::wstring &mode);
|
|
|
|
|
|
|
|
// fullcolor
|
|
|
|
void updateDrawing(const TRasterP ras, const TRasterP rasBackup,
|
|
|
|
const TPixel32 &color, const TRect &bbox, double opacity);
|
|
|
|
void eraseDrawing(const TRasterP ras, const TRasterP rasBackup,
|
|
|
|
const TRect &bbox, double opacity);
|
|
|
|
|
|
|
|
std::vector<TThickPoint> getSymmetryPoints(
|
|
|
|
const std::vector<TThickPoint> &points);
|
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // T_BLUREDBRUSH
|