added shadow to rich text effect and removed old effect residue
This commit is contained in:
+65
@@ -0,0 +1,65 @@
|
||||
#include "blur.h"
|
||||
|
||||
void olive::ui::blur(QImage& result, const QRect& rect, int radius, bool alphaOnly) {
|
||||
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
|
||||
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
|
||||
|
||||
int r1 = rect.top();
|
||||
int r2 = rect.bottom();
|
||||
int c1 = rect.left();
|
||||
int c2 = rect.right();
|
||||
|
||||
int bpl = result.bytesPerLine();
|
||||
int rgba[4];
|
||||
unsigned char* p;
|
||||
|
||||
int i1 = 0;
|
||||
int i2 = 3;
|
||||
|
||||
if (alphaOnly)
|
||||
i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
|
||||
|
||||
for (int col = c1; col <= c2; col++) {
|
||||
p = result.scanLine(r1) + col * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p += bpl;
|
||||
for (int j = r1; j < r2; j++, p += bpl)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
for (int row = r1; row <= r2; row++) {
|
||||
p = result.scanLine(row) + c1 * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p += 4;
|
||||
for (int j = c1; j < c2; j++, p += 4)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
for (int col = c1; col <= c2; col++) {
|
||||
p = result.scanLine(r2) + col * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p -= bpl;
|
||||
for (int j = r1; j < r2; j++, p -= bpl)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
for (int row = r1; row <= r2; row++) {
|
||||
p = result.scanLine(row) + c2 * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p -= 4;
|
||||
for (int j = c1; j < c2; j++, p -= 4)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef BLUR_H
|
||||
#define BLUR_H
|
||||
|
||||
#include <QImage>
|
||||
#include <QRect>
|
||||
|
||||
namespace olive {
|
||||
namespace ui {
|
||||
void blur(QImage& result, const QRect& rect, int radius, bool alphaOnly);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BLUR_H
|
||||
@@ -33,15 +33,10 @@ QColor ColorButton::get_color() {
|
||||
}
|
||||
|
||||
void ColorButton::set_color(QColor c) {
|
||||
previousColor = color;
|
||||
color = c;
|
||||
set_button_color();
|
||||
}
|
||||
|
||||
const QColor &ColorButton::getPreviousValue() {
|
||||
return previousColor;
|
||||
}
|
||||
|
||||
void ColorButton::set_button_color() {
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::Button, color);
|
||||
|
||||
@@ -31,10 +31,8 @@ public:
|
||||
ColorButton(QWidget* parent = nullptr);
|
||||
QColor get_color();
|
||||
void set_color(QColor c);
|
||||
const QColor& getPreviousValue();
|
||||
private:
|
||||
QColor color;
|
||||
QColor previousColor;
|
||||
void set_button_color();
|
||||
signals:
|
||||
void color_changed(const QColor& c);
|
||||
|
||||
@@ -42,12 +42,7 @@ const QString &EmbeddedFileChooser::getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
const QString &EmbeddedFileChooser::getPreviousValue() {
|
||||
return old_filename;
|
||||
}
|
||||
|
||||
void EmbeddedFileChooser::setFilename(const QString &s) {
|
||||
old_filename = filename;
|
||||
filename = s;
|
||||
update_label();
|
||||
emit changed(filename);
|
||||
|
||||
@@ -31,14 +31,12 @@ public:
|
||||
EmbeddedFileChooser(QWidget* parent = 0);
|
||||
|
||||
const QString& getFilename();
|
||||
const QString& getPreviousValue();
|
||||
void setFilename(const QString& s);
|
||||
signals:
|
||||
void changed(const QString& s);
|
||||
private:
|
||||
QLabel* file_label;
|
||||
QString filename;
|
||||
QString old_filename;
|
||||
void update_label();
|
||||
private slots:
|
||||
void browse();
|
||||
|
||||
@@ -30,11 +30,6 @@ FontCombobox::FontCombobox(QWidget* parent) : QComboBox(parent) {
|
||||
connect(this, SIGNAL(currentTextChanged(QString)), this, SLOT(updateInternals()));
|
||||
}
|
||||
|
||||
const QString& FontCombobox::getPreviousValue() {
|
||||
return previousValue;
|
||||
}
|
||||
|
||||
void FontCombobox::updateInternals() {
|
||||
previousValue = value;
|
||||
value = currentText();
|
||||
}
|
||||
|
||||
+1
-3
@@ -26,12 +26,10 @@
|
||||
class FontCombobox : public QComboBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontCombobox(QWidget* parent = 0);
|
||||
const QString &getPreviousValue();
|
||||
FontCombobox(QWidget* parent = nullptr);
|
||||
private slots:
|
||||
void updateInternals();
|
||||
private:
|
||||
QString previousValue;
|
||||
QString value;
|
||||
};
|
||||
|
||||
|
||||
@@ -245,8 +245,6 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
|
||||
drag_proc = false;
|
||||
|
||||
previous_value = drag_start_value;
|
||||
|
||||
emit valueChanged(internal_value);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -160,7 +160,6 @@ private:
|
||||
double default_value;
|
||||
double internal_value;
|
||||
double drag_start_value;
|
||||
double previous_value;
|
||||
|
||||
int decimal_places;
|
||||
|
||||
|
||||
@@ -21,48 +21,6 @@
|
||||
#include "texteditex.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
/*
|
||||
TextEditEx::TextEditEx(QWidget *parent) : QTextEdit(parent) {
|
||||
setUndoRedoEnabled(false);
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(updateInternals()));
|
||||
connect(this, SIGNAL(updateSelf()), this, SLOT(updateText()));
|
||||
}
|
||||
|
||||
const QString& TextEditEx::getPlainTextEx() {
|
||||
return text;
|
||||
}
|
||||
|
||||
void TextEditEx::setPlainTextEx(const QString &t) {
|
||||
previousText = text;
|
||||
text = t;
|
||||
emit updateSelf();
|
||||
}
|
||||
|
||||
const QString &TextEditEx::getPreviousValue() {
|
||||
return previousText;
|
||||
}
|
||||
|
||||
void TextEditEx::updateInternals() {
|
||||
previousText = text;
|
||||
text = toPlainText();
|
||||
}
|
||||
|
||||
void TextEditEx::updateText() {
|
||||
blockSignals(true);
|
||||
|
||||
int pos = textCursor().position();
|
||||
|
||||
setPlainText(text);
|
||||
|
||||
QTextCursor newCursor(document());
|
||||
newCursor.setPosition(pos);
|
||||
setTextCursor(newCursor);
|
||||
|
||||
blockSignals(false);
|
||||
}
|
||||
*/
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "dialogs/texteditdialog.h"
|
||||
|
||||
Reference in New Issue
Block a user