17 Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic>
data;
34 return d->data.cols();
39 return d->data.rows();
77 Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic>&
data = kernel->
data();
78 const quint8* itImage = image.constBits();
81 for (
int r = 0; r < image.height(); r++) {
82 for (
int c = 0; c < image.width(); c++, itImage += 4)
84 uint value = 255 - (*itImage + *(itImage + 1) + *(itImage + 2)) / 3;
103 qreal cosa = cos(angle);
104 qreal sina = sin(angle);
105 qreal xc = 0.5 *
width - 0.5;
106 qreal yc = 0.5 *
height - 0.5;
108 Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic>&
data = kernel->
data();
112 for (
int r = 0; r <
height; ++r) {
113 for (
int c = 0; c <
width; ++c) {
116 qreal x = cosa * x_ - sina * y_;
117 qreal y = sina * x_ + cosa * y_;
131 kernel->
data() = matrix;
142double n = norme(xr * m_xcoef, yr * m_ycoef);
148 double normeFade = norme(xr * m_xfadecoef, yr * m_yfadecoef);
157 yle = yr > 0 ? 1 / m_ycoef : -1 / m_ycoef;
159 double c = yr / (double)xr;
160 xle = sqrt(1 / norme(m_xcoef, c * m_ycoef));
161 xle = xr > 0 ? xle : -xle;
165 double normeFadeLimitE = norme(xle * m_xfadecoef, yle * m_yfadecoef);
166 return (uchar)(255 *(normeFade - 1) / (normeFadeLimitE - 1));
177 debug.nospace() <<
"[" << c.
width() <<
"," << c.
height() <<
"]{";
178 for (
unsigned int i = 0; i < c.
width(); ++i) {
179 debug.nospace() <<
" {";
180 for (
unsigned int j = 0; j < c.
height(); ++j) {
181 debug.nospace() << (*(c.
data()))(j, i) <<
" ";
183 debug.nospace() <<
" }";
185 debug.nospace() << c.
factor() <<
" " << c.
offset() <<
" }";
186 return debug.space();
float value(const T *src, size_t ch)
virtual quint8 valueAt(qreal x, qreal y) const =0
QDebug operator<<(QDebug debug, const KisConvolutionKernel &c)
KisConvolutionKernel(quint32 width, quint32 height, qreal offset, qreal factor)
void setSize(quint32 width, quint32 height)
virtual ~KisConvolutionKernel()
static KisConvolutionKernelSP fromQImage(const QImage &image)
static KisConvolutionKernelSP fromMatrix(Eigen::Matrix< qreal, Eigen::Dynamic, Eigen::Dynamic > matrix, qreal offset, qreal factor)
Eigen::Matrix< qreal, Eigen::Dynamic, Eigen::Dynamic > data
static KisConvolutionKernelSP fromMaskGenerator(KisMaskGenerator *, qreal angle=0.0)