2016-03-19 06:57:51 +13:00
|
|
|
#include "toonzqt/combohistogram.h"
|
|
|
|
#include "tcolorstyles.h"
|
|
|
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QStackedWidget>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include "toonz/preferences.h"
|
2018-02-19 16:06:07 +13:00
|
|
|
#include "toonzqt/lutcalibrator.h"
|
UI update and Icons from Konero (#126)
* add multi arc mockup
* implement mutli arc
* add join and smooth option
* reset multiarc and arc when deactivated
* create self loop if the last point is the same as the first
* make join option in multiarc consistent with tape tool
* fix a bug where thickness don't affect mutliarc in vector level
* remove join option in geometric tool
* stop mutliarc after closing shape
* double click can also end multi arc
* fix a bug where multiArc will produce buggy stroke
* fix a bug where geometric tools is not deactivated
* add multiArc shortcut
* rewrite multiArc
* revert changes to tvectorimage
* add undo data for multiArc
* Paste as Copy Command for XSheet
* Remove unneeded code
* Bug fix
* prevent guide lines from jumping around in MultiArc
* make stroke color consistent in MultiArc
* remove color in MultiArc's undo data
* make color consistent in MultiArc with previous version
* Fix single image raster levels
* fix compilation error
* fix a bug where multiArc might generate bugged stroke
* Remove ICONV dep (#3304)
* fix crash on saving studio palette
* Move to Paste Special Menu
* Don't Set Fixed Width if Docking a Floating Panel
* Update how_to_build_win.md
New draft of pr for requested changes to windows build instructions.
* fix geometric tool multiarc smooth option
* fix level saving failure
* fix wrong warning after saving palette
* fix a bug where moving a control point while holding alt has unintended result
* fix travis-install (#3389)
* Fix assert debug crash in flipconsole.cpp
Fix crash when using the viewer controls in the console (debug)
* Redraw Audio Waveform
Fills the waveform rather than outlines it.
* Update .gitignore
* fix undo data when drawing arc and mutliarc
* fix overwriting raster drawing palette (#3387)
* mode sensitive fx settings
* Create New Style Command Button (#3394)
* Create New Style Command Button
This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz.
Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com>
* Update paletteviewergui.cpp
Made changes to the PR per request by Shun.
* Fixed a space within the code that wasn't suppose to be there.
Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com>
* tahoma license (#3396)
* new style button optional
* fix loading pegbars (removing updateKeyframes)
* periodic random expression
* add fx in linear color space
this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd.
in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories.
* fractal noise iwa fx
* skip unnecessary icon invalidation
* fix frame range fill with tablet
* stop function editor to open by dbl clicking key
* Expanding the radius of the rotation handle.
This just changes when the cursor transforms into the rotation tool.
(cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39)
* fix vector img patern stroke style
* Update Stylesheets
- Support the new icon sizes
- XSheet and Timeline significantly redesigned
- Lots of margin fixes and refactoring
- Remove deprecated icons, as some icons are moved into binary
- New Light theme
* New Icons
- Redesigns almost every icon as symbolic
- Adds icons for most commands
* Add Option for Icon Themes
- Adds option for icon themes
- Removes useless label from Preferences category list
* Update Icon Functions
- Adds themePath() boolean
- Adds function for recoloring black pixels in pixmaps to any color
- Rebuilds createQIcon to use fromTheme() and recolorPixmap()
- Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon
- Removes a grey horizontal line drawn above the console play bar in the viewer
* Set Default Icon Theme and Paths
- Sets search paths for icons for use with QIcon::fromTheme()
- Sets default start icon theme on first install
- Sets flag for displaying icons in menus, so we can selectively hide them
* Set Icons for Commands
- Sets icons for the commands
- Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16
- Selectively allows icons to display for Tools in menus
* Change Icon Sizes, General Fixes and Stylesheet Additions
- Change icon sizes to new size
- Remove margin around FX Editor window
- Remove white line under color sliders in Style Editor
- Make keyframe icons uniform and color stylable in the stylesheets
- Removes deprecated stylesheet strings
- Redesign GUI for palette list view
- Make tree list header sort row stylable
- Remove black lines from scrollbars in New Project window
- Remove margin around combobox in Level Strip
- Alter how some lines are drawn in the Timeline to fix some alpha issues
- Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility
- Make text always viewable in the FPS field in console bar
- Increase size of radio buttons in Cleanup Settings
- Increase size of switches in motion path nodes
- Remove unessesary "Layer" label in Timeline and other rects
- Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more
- Moves some external stylesheet icons into binary
* Make TPanelTitleBar Icon States Stylable
- Makes icon states for TPanelTitleBar buttons stylable in stylesheets
* Travis Fixes
* Swap Startup Popup Logos
They were in the wrong folders
* Revert "Swap Startup Popup Logos"
This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d.
* Fix Startup Popup Logo
It wasn't switching
* Feedback Changes
- Change render visualization to clapboard
- Fix text contrast on levels in XSheet
* Make Cell Selection More Clear
* Darken Light Theme and Tint Empty Cell Selection
* Fix missing icons
* Fix memo button
* Bring back colors
* Hide Motion Tab
* Fix Play Range Area (Light)
Make play range area more visible
* Vector Column Color
Co-authored-by: pojienie <pojienie@gmail.com>
Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com>
Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp>
Co-authored-by: Rodney <rodney.baker@gmail.com>
Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com>
Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com>
Co-authored-by: Kite <konero@users.noreply.github.com>
Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com>
Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
2020-09-01 06:51:22 +12:00
|
|
|
#include "toonzqt/gutil.h"
|
2021-10-14 18:13:07 +13:00
|
|
|
#include "timagecache.h"
|
|
|
|
#include "trasterimage.h"
|
|
|
|
|
|
|
|
// TnzBase includes
|
|
|
|
#include "tenv.h"
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QDialog>
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
TEnv::IntVar HistogramChannelDisplayMode(
|
|
|
|
"HistogramChannelDisplayMode",
|
|
|
|
(int)ComboHistoRGBLabel::Display_8bit); // 8bit display by default
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
inline int idx(int y, int x) { return y * COMBOHIST_RESOLUTION_W + x; }
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
//=============================================================================
|
|
|
|
// ChannelHistoGraph
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
ChannelHistoGraph::ChannelHistoGraph(int index, QWidget *parent,
|
|
|
|
bool *showComparePtr)
|
|
|
|
: QWidget(parent)
|
|
|
|
, m_showComparePtr(showComparePtr)
|
|
|
|
, m_channelIndex(index)
|
|
|
|
, m_pickedValue(-1) {
|
2016-06-15 18:43:10 +12:00
|
|
|
// width 256+2 pixels, height 100+2 pixels (with margin)
|
|
|
|
setFixedSize(COMBOHIST_RESOLUTION_W + 2, COMBOHIST_RESOLUTION_H + 2);
|
2021-10-14 18:13:07 +13:00
|
|
|
m_values[0].reserve(COMBOHIST_RESOLUTION_W);
|
|
|
|
m_values[1].reserve(COMBOHIST_RESOLUTION_W);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
ChannelHistoGraph::~ChannelHistoGraph() {
|
|
|
|
m_values[0].clear();
|
|
|
|
m_values[1].clear();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
void ChannelHistoGraph::setValues(int *buf, bool isComp) {
|
|
|
|
int id = (isComp) ? 1 : 0;
|
|
|
|
m_values[id].clear();
|
|
|
|
m_values[id].resize(COMBOHIST_RESOLUTION_W);
|
|
|
|
m_maxValue[id] = 1;
|
2016-06-15 18:43:10 +12:00
|
|
|
int i;
|
|
|
|
// normalize with the maximum value
|
|
|
|
int maxValue = 1;
|
|
|
|
for (i = 0; i < COMBOHIST_RESOLUTION_W; i++) {
|
2021-10-14 18:13:07 +13:00
|
|
|
m_values[id][i] = buf[i];
|
|
|
|
if (m_maxValue[id] < buf[i]) m_maxValue[id] = buf[i];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
// for (i = 0; i < COMBOHIST_RESOLUTION_W; i++) {
|
|
|
|
// int v = buf[i];
|
|
|
|
// m_values[id][i] =
|
|
|
|
// tround((double)(v * COMBOHIST_RESOLUTION_H) / (double)maxValue);
|
|
|
|
//}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ChannelHistoGraph::paintEvent(QPaintEvent *event) {
|
|
|
|
QPainter p(this);
|
|
|
|
|
|
|
|
p.setPen(QColor(144, 144, 144));
|
|
|
|
p.setBrush(QColor(214, 214, 214));
|
|
|
|
p.drawRect(rect().x(), rect().y(), rect().width() - 1, rect().height() - 1);
|
|
|
|
p.setBrush(Qt::NoBrush);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// draw scale marks
|
|
|
|
p.setPen(QColor(144, 144, 144));
|
|
|
|
for (i = 1; i < 10; i++) {
|
|
|
|
int posx = rect().width() * i / 10;
|
|
|
|
p.drawLine(posx, 1, posx, COMBOHIST_RESOLUTION_H);
|
|
|
|
}
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
QColor compColor = (m_channelIndex == 0)
|
|
|
|
? Qt::red
|
|
|
|
: (m_channelIndex == 1)
|
|
|
|
? Qt::green
|
|
|
|
: (m_channelIndex == 2) ? Qt::blue : Qt::magenta;
|
|
|
|
compColor.setAlpha(120);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
int maxValue = m_maxValue[0];
|
|
|
|
if (!m_values[1].isEmpty() && m_showComparePtr && *m_showComparePtr &&
|
|
|
|
m_maxValue[0] < m_maxValue[1])
|
|
|
|
maxValue = m_maxValue[1];
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
p.translate(0, COMBOHIST_RESOLUTION_H);
|
|
|
|
p.scale(1.0, -(double)COMBOHIST_RESOLUTION_H / (double)maxValue);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
for (int id = 0; id < 2; id++) {
|
|
|
|
if (m_values[id].isEmpty()) continue;
|
|
|
|
if (id == 1 && (!m_showComparePtr || !(*m_showComparePtr))) continue;
|
|
|
|
|
|
|
|
p.setPen((id == 0) ? Qt::black : compColor);
|
|
|
|
|
|
|
|
// draw each histogram
|
|
|
|
for (i = 0; i < COMBOHIST_RESOLUTION_W; i++) {
|
|
|
|
int v = m_values[id][i];
|
|
|
|
if (v <= 0) continue;
|
|
|
|
int x = 1 + i;
|
|
|
|
p.drawLine(x, 0, x, v);
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw picked color's channel value
|
|
|
|
if (m_pickedValue > -1) {
|
|
|
|
p.setPen(Qt::white);
|
|
|
|
int x = 1 + m_pickedValue;
|
|
|
|
p.drawLine(x, 1, x, maxValue);
|
|
|
|
}
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ChannelHistoGraph::showCurrentChannelValue(int val) {
|
|
|
|
m_pickedValue = val;
|
|
|
|
update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ChannelHistoGraph
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
RGBHistoGraph::RGBHistoGraph(int index, QWidget *parent)
|
|
|
|
: ChannelHistoGraph(index, parent) {
|
2016-06-15 18:43:10 +12:00
|
|
|
m_histoImg = QImage(COMBOHIST_RESOLUTION_W, COMBOHIST_RESOLUTION_H,
|
|
|
|
QImage::Format_ARGB32_Premultiplied);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
RGBHistoGraph::~RGBHistoGraph() {
|
|
|
|
for (int i = 0; i < 3; i++) m_rgbValues[i].clear();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
void RGBHistoGraph::setValues(int *buf, bool) {
|
2016-06-15 18:43:10 +12:00
|
|
|
for (int chan = 0; chan < 3; chan++) {
|
|
|
|
m_rgbValues[chan].clear();
|
|
|
|
m_rgbValues[chan].resize(COMBOHIST_RESOLUTION_W);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// normalize with the maximum value
|
|
|
|
int maxValue = 1;
|
|
|
|
for (i = 0; i < COMBOHIST_RESOLUTION_W; i++) {
|
2021-10-14 18:13:07 +13:00
|
|
|
int count = buf[COMBOHIST_RESOLUTION_W * chan + i];
|
2016-06-15 18:43:10 +12:00
|
|
|
if (maxValue < count) maxValue = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < COMBOHIST_RESOLUTION_W; i++) {
|
2021-10-14 18:13:07 +13:00
|
|
|
int v = buf[COMBOHIST_RESOLUTION_W * chan + i];
|
2016-06-15 18:43:10 +12:00
|
|
|
m_rgbValues[chan][i] =
|
|
|
|
tround((double)(v * COMBOHIST_RESOLUTION_H) / (double)maxValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QPainter imgPainter(&m_histoImg);
|
|
|
|
|
|
|
|
imgPainter.fillRect(m_histoImg.rect(), Qt::black);
|
|
|
|
|
|
|
|
if (m_rgbValues[0].size() == 0 || m_rgbValues[1].size() == 0 ||
|
|
|
|
m_rgbValues[2].size() == 0) {
|
|
|
|
imgPainter.end();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
imgPainter.setCompositionMode(QPainter::CompositionMode_Plus);
|
|
|
|
|
|
|
|
for (int chan = 0; chan < 3; chan++) {
|
2021-10-14 18:13:07 +13:00
|
|
|
imgPainter.setPen((chan == 0) ? Qt::red
|
|
|
|
: (chan == 1) ? Qt::green : Qt::blue);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
for (int i = 0; i < COMBOHIST_RESOLUTION_W; i++) {
|
|
|
|
int v = m_rgbValues[chan][i];
|
|
|
|
if (v <= 0) continue;
|
|
|
|
int x = 1 + i;
|
|
|
|
imgPainter.drawLine(x, COMBOHIST_RESOLUTION_H + 1 - v, x,
|
|
|
|
COMBOHIST_RESOLUTION_H);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
imgPainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
|
|
|
imgPainter.end();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void RGBHistoGraph::paintEvent(QPaintEvent *event) {
|
|
|
|
QPainter p(this);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
p.setPen(QColor(144, 144, 144));
|
|
|
|
p.setBrush(QColor(64, 64, 64));
|
|
|
|
p.drawRect(rect().x(), rect().y(), rect().width() - 1, rect().height() - 1);
|
|
|
|
p.setBrush(Qt::NoBrush);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
p.drawImage(1, 1, m_histoImg);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ChannelColorBar
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
ChannelColorBar::ChannelColorBar(QWidget *parent, QColor color)
|
2016-06-15 18:43:10 +12:00
|
|
|
: QWidget(parent), m_color(color) {
|
|
|
|
// 2 pixels margin for width
|
|
|
|
setFixedSize(COMBOHIST_RESOLUTION_W + 2, 6);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ChannelColorBar::paintEvent(QPaintEvent *event) {
|
|
|
|
QPainter p(this);
|
|
|
|
|
|
|
|
QLinearGradient linearGrad(QPoint(1, 0), QPoint(COMBOHIST_RESOLUTION_W, 0));
|
|
|
|
if (m_color == QColor(0, 0, 0, 0)) {
|
|
|
|
linearGrad.setColorAt(0, m_color);
|
|
|
|
linearGrad.setColorAt(1, Qt::white);
|
|
|
|
} else {
|
|
|
|
linearGrad.setColorAt(0, Qt::black);
|
|
|
|
linearGrad.setColorAt(1, m_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
p.setBrush(QBrush(linearGrad));
|
|
|
|
p.setPen(Qt::NoPen);
|
|
|
|
p.drawRect(rect());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ChannelHisto
|
|
|
|
//-----------------------------------------------------------------------------
|
2021-10-14 18:13:07 +13:00
|
|
|
ChannelHisto::ChannelHisto(int channelIndex, bool *showComparePtr,
|
2016-06-15 18:43:10 +12:00
|
|
|
QWidget *parent) {
|
|
|
|
QString label;
|
|
|
|
QColor color;
|
|
|
|
switch (channelIndex) {
|
|
|
|
case 0:
|
|
|
|
label = tr("Red");
|
|
|
|
color = Qt::red;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
label = tr("Green");
|
|
|
|
color = Qt::green;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
label = tr("Blue");
|
|
|
|
color = Qt::blue;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
label = tr("Alpha");
|
|
|
|
color = QColor(0, 0, 0, 0);
|
|
|
|
break;
|
|
|
|
case 4:
|
2021-10-14 18:13:07 +13:00
|
|
|
label = tr("RGB");
|
2016-06-15 18:43:10 +12:00
|
|
|
color = Qt::white;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channelIndex != 4)
|
2021-10-14 18:13:07 +13:00
|
|
|
m_histogramGraph =
|
|
|
|
new ChannelHistoGraph(channelIndex, this, showComparePtr);
|
2016-06-15 18:43:10 +12:00
|
|
|
else
|
2021-10-14 18:13:07 +13:00
|
|
|
m_histogramGraph = new RGBHistoGraph(channelIndex, this);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
m_colorBar = new ChannelColorBar(this, color);
|
|
|
|
|
|
|
|
// show/hide the alpha channel
|
|
|
|
QPushButton *showAlphaChannelButton = 0;
|
|
|
|
if (channelIndex == 3) {
|
|
|
|
showAlphaChannelButton = new QPushButton("", this);
|
UI update and Icons from Konero (#126)
* add multi arc mockup
* implement mutli arc
* add join and smooth option
* reset multiarc and arc when deactivated
* create self loop if the last point is the same as the first
* make join option in multiarc consistent with tape tool
* fix a bug where thickness don't affect mutliarc in vector level
* remove join option in geometric tool
* stop mutliarc after closing shape
* double click can also end multi arc
* fix a bug where multiArc will produce buggy stroke
* fix a bug where geometric tools is not deactivated
* add multiArc shortcut
* rewrite multiArc
* revert changes to tvectorimage
* add undo data for multiArc
* Paste as Copy Command for XSheet
* Remove unneeded code
* Bug fix
* prevent guide lines from jumping around in MultiArc
* make stroke color consistent in MultiArc
* remove color in MultiArc's undo data
* make color consistent in MultiArc with previous version
* Fix single image raster levels
* fix compilation error
* fix a bug where multiArc might generate bugged stroke
* Remove ICONV dep (#3304)
* fix crash on saving studio palette
* Move to Paste Special Menu
* Don't Set Fixed Width if Docking a Floating Panel
* Update how_to_build_win.md
New draft of pr for requested changes to windows build instructions.
* fix geometric tool multiarc smooth option
* fix level saving failure
* fix wrong warning after saving palette
* fix a bug where moving a control point while holding alt has unintended result
* fix travis-install (#3389)
* Fix assert debug crash in flipconsole.cpp
Fix crash when using the viewer controls in the console (debug)
* Redraw Audio Waveform
Fills the waveform rather than outlines it.
* Update .gitignore
* fix undo data when drawing arc and mutliarc
* fix overwriting raster drawing palette (#3387)
* mode sensitive fx settings
* Create New Style Command Button (#3394)
* Create New Style Command Button
This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz.
Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com>
* Update paletteviewergui.cpp
Made changes to the PR per request by Shun.
* Fixed a space within the code that wasn't suppose to be there.
Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com>
* tahoma license (#3396)
* new style button optional
* fix loading pegbars (removing updateKeyframes)
* periodic random expression
* add fx in linear color space
this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd.
in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories.
* fractal noise iwa fx
* skip unnecessary icon invalidation
* fix frame range fill with tablet
* stop function editor to open by dbl clicking key
* Expanding the radius of the rotation handle.
This just changes when the cursor transforms into the rotation tool.
(cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39)
* fix vector img patern stroke style
* Update Stylesheets
- Support the new icon sizes
- XSheet and Timeline significantly redesigned
- Lots of margin fixes and refactoring
- Remove deprecated icons, as some icons are moved into binary
- New Light theme
* New Icons
- Redesigns almost every icon as symbolic
- Adds icons for most commands
* Add Option for Icon Themes
- Adds option for icon themes
- Removes useless label from Preferences category list
* Update Icon Functions
- Adds themePath() boolean
- Adds function for recoloring black pixels in pixmaps to any color
- Rebuilds createQIcon to use fromTheme() and recolorPixmap()
- Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon
- Removes a grey horizontal line drawn above the console play bar in the viewer
* Set Default Icon Theme and Paths
- Sets search paths for icons for use with QIcon::fromTheme()
- Sets default start icon theme on first install
- Sets flag for displaying icons in menus, so we can selectively hide them
* Set Icons for Commands
- Sets icons for the commands
- Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16
- Selectively allows icons to display for Tools in menus
* Change Icon Sizes, General Fixes and Stylesheet Additions
- Change icon sizes to new size
- Remove margin around FX Editor window
- Remove white line under color sliders in Style Editor
- Make keyframe icons uniform and color stylable in the stylesheets
- Removes deprecated stylesheet strings
- Redesign GUI for palette list view
- Make tree list header sort row stylable
- Remove black lines from scrollbars in New Project window
- Remove margin around combobox in Level Strip
- Alter how some lines are drawn in the Timeline to fix some alpha issues
- Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility
- Make text always viewable in the FPS field in console bar
- Increase size of radio buttons in Cleanup Settings
- Increase size of switches in motion path nodes
- Remove unessesary "Layer" label in Timeline and other rects
- Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more
- Moves some external stylesheet icons into binary
* Make TPanelTitleBar Icon States Stylable
- Makes icon states for TPanelTitleBar buttons stylable in stylesheets
* Travis Fixes
* Swap Startup Popup Logos
They were in the wrong folders
* Revert "Swap Startup Popup Logos"
This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d.
* Fix Startup Popup Logo
It wasn't switching
* Feedback Changes
- Change render visualization to clapboard
- Fix text contrast on levels in XSheet
* Make Cell Selection More Clear
* Darken Light Theme and Tint Empty Cell Selection
* Fix missing icons
* Fix memo button
* Bring back colors
* Hide Motion Tab
* Fix Play Range Area (Light)
Make play range area more visible
* Vector Column Color
Co-authored-by: pojienie <pojienie@gmail.com>
Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com>
Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp>
Co-authored-by: Rodney <rodney.baker@gmail.com>
Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com>
Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com>
Co-authored-by: Kite <konero@users.noreply.github.com>
Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com>
Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
2020-09-01 06:51:22 +12:00
|
|
|
showAlphaChannelButton->setObjectName("menuToggleButton");
|
2016-06-15 18:43:10 +12:00
|
|
|
showAlphaChannelButton->setFixedSize(15, 15);
|
UI update and Icons from Konero (#126)
* add multi arc mockup
* implement mutli arc
* add join and smooth option
* reset multiarc and arc when deactivated
* create self loop if the last point is the same as the first
* make join option in multiarc consistent with tape tool
* fix a bug where thickness don't affect mutliarc in vector level
* remove join option in geometric tool
* stop mutliarc after closing shape
* double click can also end multi arc
* fix a bug where multiArc will produce buggy stroke
* fix a bug where geometric tools is not deactivated
* add multiArc shortcut
* rewrite multiArc
* revert changes to tvectorimage
* add undo data for multiArc
* Paste as Copy Command for XSheet
* Remove unneeded code
* Bug fix
* prevent guide lines from jumping around in MultiArc
* make stroke color consistent in MultiArc
* remove color in MultiArc's undo data
* make color consistent in MultiArc with previous version
* Fix single image raster levels
* fix compilation error
* fix a bug where multiArc might generate bugged stroke
* Remove ICONV dep (#3304)
* fix crash on saving studio palette
* Move to Paste Special Menu
* Don't Set Fixed Width if Docking a Floating Panel
* Update how_to_build_win.md
New draft of pr for requested changes to windows build instructions.
* fix geometric tool multiarc smooth option
* fix level saving failure
* fix wrong warning after saving palette
* fix a bug where moving a control point while holding alt has unintended result
* fix travis-install (#3389)
* Fix assert debug crash in flipconsole.cpp
Fix crash when using the viewer controls in the console (debug)
* Redraw Audio Waveform
Fills the waveform rather than outlines it.
* Update .gitignore
* fix undo data when drawing arc and mutliarc
* fix overwriting raster drawing palette (#3387)
* mode sensitive fx settings
* Create New Style Command Button (#3394)
* Create New Style Command Button
This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz.
Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com>
* Update paletteviewergui.cpp
Made changes to the PR per request by Shun.
* Fixed a space within the code that wasn't suppose to be there.
Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com>
* tahoma license (#3396)
* new style button optional
* fix loading pegbars (removing updateKeyframes)
* periodic random expression
* add fx in linear color space
this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd.
in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories.
* fractal noise iwa fx
* skip unnecessary icon invalidation
* fix frame range fill with tablet
* stop function editor to open by dbl clicking key
* Expanding the radius of the rotation handle.
This just changes when the cursor transforms into the rotation tool.
(cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39)
* fix vector img patern stroke style
* Update Stylesheets
- Support the new icon sizes
- XSheet and Timeline significantly redesigned
- Lots of margin fixes and refactoring
- Remove deprecated icons, as some icons are moved into binary
- New Light theme
* New Icons
- Redesigns almost every icon as symbolic
- Adds icons for most commands
* Add Option for Icon Themes
- Adds option for icon themes
- Removes useless label from Preferences category list
* Update Icon Functions
- Adds themePath() boolean
- Adds function for recoloring black pixels in pixmaps to any color
- Rebuilds createQIcon to use fromTheme() and recolorPixmap()
- Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon
- Removes a grey horizontal line drawn above the console play bar in the viewer
* Set Default Icon Theme and Paths
- Sets search paths for icons for use with QIcon::fromTheme()
- Sets default start icon theme on first install
- Sets flag for displaying icons in menus, so we can selectively hide them
* Set Icons for Commands
- Sets icons for the commands
- Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16
- Selectively allows icons to display for Tools in menus
* Change Icon Sizes, General Fixes and Stylesheet Additions
- Change icon sizes to new size
- Remove margin around FX Editor window
- Remove white line under color sliders in Style Editor
- Make keyframe icons uniform and color stylable in the stylesheets
- Removes deprecated stylesheet strings
- Redesign GUI for palette list view
- Make tree list header sort row stylable
- Remove black lines from scrollbars in New Project window
- Remove margin around combobox in Level Strip
- Alter how some lines are drawn in the Timeline to fix some alpha issues
- Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility
- Make text always viewable in the FPS field in console bar
- Increase size of radio buttons in Cleanup Settings
- Increase size of switches in motion path nodes
- Remove unessesary "Layer" label in Timeline and other rects
- Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more
- Moves some external stylesheet icons into binary
* Make TPanelTitleBar Icon States Stylable
- Makes icon states for TPanelTitleBar buttons stylable in stylesheets
* Travis Fixes
* Swap Startup Popup Logos
They were in the wrong folders
* Revert "Swap Startup Popup Logos"
This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d.
* Fix Startup Popup Logo
It wasn't switching
* Feedback Changes
- Change render visualization to clapboard
- Fix text contrast on levels in XSheet
* Make Cell Selection More Clear
* Darken Light Theme and Tint Empty Cell Selection
* Fix missing icons
* Fix memo button
* Bring back colors
* Hide Motion Tab
* Fix Play Range Area (Light)
Make play range area more visible
* Vector Column Color
Co-authored-by: pojienie <pojienie@gmail.com>
Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com>
Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp>
Co-authored-by: Rodney <rodney.baker@gmail.com>
Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com>
Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com>
Co-authored-by: Kite <konero@users.noreply.github.com>
Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com>
Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
2020-09-01 06:51:22 +12:00
|
|
|
showAlphaChannelButton->setIcon(createQIcon("menu_toggle"));
|
2016-06-15 18:43:10 +12:00
|
|
|
showAlphaChannelButton->setCheckable(true);
|
|
|
|
showAlphaChannelButton->setChecked(false);
|
|
|
|
showAlphaChannelButton->setFocusPolicy(Qt::NoFocus);
|
|
|
|
}
|
|
|
|
|
|
|
|
// layout
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
|
|
|
mainLayout->setMargin(0);
|
|
|
|
mainLayout->setSpacing(2);
|
|
|
|
{
|
|
|
|
QHBoxLayout *titleLay = new QHBoxLayout();
|
|
|
|
titleLay->setMargin(0);
|
|
|
|
titleLay->setSpacing(2);
|
|
|
|
{
|
|
|
|
titleLay->addWidget(new QLabel(label, this), 0);
|
|
|
|
if (channelIndex == 3) titleLay->addWidget(showAlphaChannelButton, 0);
|
|
|
|
titleLay->addStretch(1);
|
|
|
|
}
|
|
|
|
mainLayout->addLayout(titleLay);
|
|
|
|
mainLayout->addSpacing(3);
|
|
|
|
mainLayout->addWidget(m_histogramGraph);
|
|
|
|
mainLayout->addWidget(m_colorBar);
|
|
|
|
}
|
|
|
|
setLayout(mainLayout);
|
|
|
|
|
|
|
|
if (channelIndex == 3) {
|
|
|
|
connect(showAlphaChannelButton, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(onShowAlphaButtonToggled(bool)));
|
|
|
|
onShowAlphaButtonToggled(false);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/*! update the picked color's channel value
|
2019-08-30 18:19:05 +12:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
void ChannelHisto::showCurrentChannelValue(int val) {
|
|
|
|
m_histogramGraph->showCurrentChannelValue(val);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ChannelHisto::onShowAlphaButtonToggled(bool visible) {
|
|
|
|
m_histogramGraph->setVisible(visible);
|
|
|
|
m_colorBar->setVisible(visible);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ComboHistoRGBLabel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
ComboHistoRGBLabel::ComboHistoRGBLabel(QColor color, QWidget *parent)
|
2021-10-14 18:13:07 +13:00
|
|
|
: QWidget(parent), m_color(color), m_mode(DisplayMode::Display_8bit) {
|
2016-06-15 18:43:10 +12:00
|
|
|
setFixedSize(COMBOHIST_RESOLUTION_W, 30);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ComboHistoRGBLabel::setColorAndUpdate(QColor color) {
|
|
|
|
if (m_color == color) return;
|
|
|
|
m_color = color;
|
|
|
|
update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ComboHistoRGBLabel::paintEvent(QPaintEvent *pe) {
|
|
|
|
QPainter p(this);
|
|
|
|
p.setPen(Qt::black);
|
|
|
|
QRect bgRect = QRect(rect().left(), rect().top(), rect().width() - 1,
|
|
|
|
rect().height() - 1);
|
|
|
|
|
|
|
|
if (m_color.alpha() == 0) {
|
|
|
|
p.setBrush(Qt::gray);
|
|
|
|
p.drawRect(bgRect);
|
|
|
|
return;
|
|
|
|
}
|
2018-03-14 19:32:28 +13:00
|
|
|
if (LutManager::instance()->isValid()) {
|
2018-02-19 16:06:07 +13:00
|
|
|
QColor convertedColor(m_color);
|
2018-03-14 19:32:28 +13:00
|
|
|
LutManager::instance()->convert(convertedColor);
|
2018-02-19 16:06:07 +13:00
|
|
|
p.setBrush(convertedColor);
|
|
|
|
} else
|
|
|
|
p.setBrush(m_color);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
p.drawRect(bgRect);
|
|
|
|
|
|
|
|
// white text for dark color, black text for light color
|
|
|
|
int val = m_color.red() * 30 + m_color.green() * 59 + m_color.blue() * 11;
|
|
|
|
if (val < 12800)
|
|
|
|
p.setPen(Qt::white);
|
|
|
|
else
|
|
|
|
p.setPen(Qt::black);
|
|
|
|
p.setBrush(Qt::NoBrush);
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
QFont font = p.font();
|
|
|
|
const int pixelSizes[3] = {18, 14, 14};
|
|
|
|
font.setPixelSize(pixelSizes[(int)m_mode]);
|
|
|
|
p.setFont(font);
|
|
|
|
QString colorStr;
|
|
|
|
switch (m_mode) {
|
|
|
|
case Display_8bit: {
|
|
|
|
colorStr = tr("R:%1 G:%2 B:%3")
|
|
|
|
.arg(m_color.red())
|
|
|
|
.arg(m_color.green())
|
|
|
|
.arg(m_color.blue());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Display_16bit: {
|
|
|
|
QRgba64 rgba64 = m_color.rgba64();
|
|
|
|
colorStr = tr("R:%1 G:%2 B:%3")
|
|
|
|
.arg(rgba64.red())
|
|
|
|
.arg(rgba64.green())
|
|
|
|
.arg(rgba64.blue());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Display_0_1: {
|
|
|
|
colorStr = tr("R:%1 G:%2 B:%3")
|
|
|
|
.arg(m_color.redF())
|
|
|
|
.arg(m_color.greenF())
|
|
|
|
.arg(m_color.blueF());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p.drawText(rect(), Qt::AlignCenter, colorStr);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ComboHistogram
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ComboHistogram::ComboHistogram(QWidget *parent)
|
2021-10-14 18:13:07 +13:00
|
|
|
: QWidget(parent)
|
|
|
|
, m_raster(0)
|
|
|
|
, m_palette(0)
|
|
|
|
, m_showCompare(false)
|
|
|
|
, m_compHistoIsValid(true) {
|
|
|
|
for (int chan = 0; chan < 4; chan++)
|
|
|
|
m_histograms[chan] = new ChannelHisto(chan, &m_showCompare, this);
|
|
|
|
m_histograms[4] = new ChannelHisto(4, &m_showCompare, this);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
// RGB label
|
|
|
|
m_rgbLabel = new ComboHistoRGBLabel(QColor(128, 128, 128), this);
|
2021-10-14 18:13:07 +13:00
|
|
|
// m_rgbLabel->setStyleSheet("font-size: 18px;");
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
m_rectAverageRgbLabel = new ComboHistoRGBLabel(QColor(128, 128, 128), this);
|
2021-10-14 18:13:07 +13:00
|
|
|
// m_rectAverageRgbLabel->setStyleSheet("font-size: 18px;");
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
m_xPosLabel = new QLabel("", this);
|
|
|
|
m_yPosLabel = new QLabel("", this);
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
m_displayModeCombo = new QComboBox(this);
|
|
|
|
|
|
|
|
m_displayModeCombo->addItem(
|
|
|
|
tr("8bit (0-255)"), (int)ComboHistoRGBLabel::DisplayMode::Display_8bit);
|
|
|
|
m_displayModeCombo->addItem(
|
|
|
|
tr("16bit (0-65535)"),
|
|
|
|
(int)ComboHistoRGBLabel::DisplayMode::Display_16bit);
|
|
|
|
m_displayModeCombo->addItem(
|
|
|
|
tr("0.0-1.0"), (int)ComboHistoRGBLabel::DisplayMode::Display_0_1);
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// layout
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout();
|
|
|
|
mainLayout->setMargin(5);
|
|
|
|
mainLayout->setSpacing(5);
|
|
|
|
{
|
|
|
|
mainLayout->addWidget(m_histograms[4]); // RGB
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
QHBoxLayout *labelLay = new QHBoxLayout();
|
|
|
|
labelLay->setMargin(0);
|
|
|
|
labelLay->setSpacing(0);
|
|
|
|
{
|
|
|
|
labelLay->addWidget(new QLabel(tr("Picked Color"), this), 0);
|
|
|
|
labelLay->addStretch(1);
|
|
|
|
labelLay->addWidget(m_displayModeCombo, 0);
|
|
|
|
}
|
|
|
|
mainLayout->addLayout(labelLay, 0);
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
mainLayout->addWidget(m_rgbLabel, 0, Qt::AlignCenter);
|
|
|
|
|
2018-06-04 15:18:43 +12:00
|
|
|
mainLayout->addWidget(new QLabel(tr("Average Color (Ctrl + Drag)"), this),
|
|
|
|
0, Qt::AlignLeft | Qt::AlignVCenter);
|
2016-06-15 18:43:10 +12:00
|
|
|
mainLayout->addWidget(m_rectAverageRgbLabel, 0, Qt::AlignCenter);
|
|
|
|
|
|
|
|
QGridLayout *infoParamLay = new QGridLayout();
|
|
|
|
infoParamLay->setHorizontalSpacing(3);
|
|
|
|
infoParamLay->setVerticalSpacing(5);
|
|
|
|
{
|
2018-06-04 15:18:43 +12:00
|
|
|
infoParamLay->addWidget(new QLabel(tr("X:"), this), 0, 0,
|
2016-06-15 18:43:10 +12:00
|
|
|
Qt::AlignRight | Qt::AlignVCenter);
|
|
|
|
infoParamLay->addWidget(m_xPosLabel, 0, 1,
|
|
|
|
Qt::AlignLeft | Qt::AlignVCenter);
|
2018-06-04 15:18:43 +12:00
|
|
|
infoParamLay->addWidget(new QLabel(tr("Y:"), this), 1, 0,
|
2016-06-15 18:43:10 +12:00
|
|
|
Qt::AlignRight | Qt::AlignVCenter);
|
|
|
|
infoParamLay->addWidget(m_yPosLabel, 1, 1,
|
|
|
|
Qt::AlignLeft | Qt::AlignVCenter);
|
|
|
|
}
|
|
|
|
mainLayout->addLayout(infoParamLay, 0);
|
|
|
|
|
|
|
|
mainLayout->addWidget(m_histograms[0]); // R
|
|
|
|
mainLayout->addWidget(m_histograms[1]); // G
|
|
|
|
mainLayout->addWidget(m_histograms[2]); // B
|
|
|
|
mainLayout->addWidget(m_histograms[3]); // A
|
|
|
|
mainLayout->addStretch(1);
|
|
|
|
}
|
|
|
|
setLayout(mainLayout);
|
|
|
|
|
|
|
|
m_rectAverageRgbLabel->setColorAndUpdate(Qt::transparent);
|
2021-10-14 18:13:07 +13:00
|
|
|
|
|
|
|
connect(m_displayModeCombo, SIGNAL(activated(int)), this,
|
|
|
|
SLOT(onDisplayModeChanged()));
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
ComboHistogram::~ComboHistogram() {
|
|
|
|
memset(m_channelValue, 0, sizeof m_channelValue);
|
2021-10-14 18:13:07 +13:00
|
|
|
memset(m_channelValueComp, 0, sizeof m_channelValueComp);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ComboHistogram::setRaster(const TRasterP &raster,
|
|
|
|
const TPaletteP &palette) {
|
|
|
|
if (palette.getPointer()) m_palette = palette;
|
2021-10-14 18:13:07 +13:00
|
|
|
m_raster = raster;
|
|
|
|
computeChannelsValue(&m_channelValue[0][0], sizeof(m_channelValue), m_raster);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
for (int chan = 0; chan < 4; chan++)
|
|
|
|
m_histograms[chan]->refleshValue(&m_channelValue[chan][0]);
|
|
|
|
m_histograms[4]->refleshValue(&m_channelValue[0][0]);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
update();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
void ComboHistogram::computeChannelsValue(int *buf, size_t size, TRasterP ras,
|
|
|
|
TPalette *extPlt) {
|
|
|
|
memset(buf, 0, size);
|
|
|
|
if (!ras.getPointer()) return;
|
|
|
|
TRasterCM32P cmRaster = ras;
|
2016-06-15 18:43:10 +12:00
|
|
|
bool isCmRaster = !!cmRaster;
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
TRaster64P raster64 = ras;
|
2016-06-15 18:43:10 +12:00
|
|
|
bool is64bit = !!raster64;
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
int lx = ras->getLx();
|
|
|
|
int ly = ras->getLy();
|
2016-06-15 18:43:10 +12:00
|
|
|
if (lx > 1 && ly > 1) {
|
|
|
|
int i, j;
|
|
|
|
if (is64bit) {
|
|
|
|
for (j = 0; j < ly; j++) {
|
|
|
|
TPixel64 *pix_64 = raster64->pixels(j);
|
|
|
|
for (i = 0; i < lx; i++, pix_64++) {
|
|
|
|
int mValue = (int)byteFromUshort(pix_64->m);
|
|
|
|
if (mValue != 0) {
|
2021-10-14 18:13:07 +13:00
|
|
|
++buf[idx(0, (int)byteFromUshort(pix_64->r))];
|
|
|
|
++buf[idx(1, (int)byteFromUshort(pix_64->g))];
|
|
|
|
++buf[idx(2, (int)byteFromUshort(pix_64->b))];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
2021-10-14 18:13:07 +13:00
|
|
|
++buf[idx(3, mValue)];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (isCmRaster) {
|
2021-10-14 18:13:07 +13:00
|
|
|
TPalette *plt = (extPlt) ? extPlt : m_palette.getPointer();
|
|
|
|
assert(plt);
|
2016-06-15 18:43:10 +12:00
|
|
|
for (j = 0; j < ly; j++) {
|
|
|
|
TPixelCM32 *pix_cm = cmRaster->pixels(j);
|
|
|
|
for (i = 0; i < lx; i++, pix_cm++) {
|
|
|
|
int styleId =
|
|
|
|
pix_cm->getTone() < 127 ? pix_cm->getInk() : pix_cm->getPaint();
|
2021-10-14 18:13:07 +13:00
|
|
|
TColorStyle *colorStyle = plt->getStyle(styleId);
|
2016-06-15 18:43:10 +12:00
|
|
|
if (!colorStyle) continue;
|
|
|
|
TPixel color = colorStyle->getAverageColor();
|
|
|
|
int mValue = color.m;
|
|
|
|
if (mValue != 0) {
|
2021-10-14 18:13:07 +13:00
|
|
|
++buf[idx(0, color.r)];
|
|
|
|
++buf[idx(1, color.g)];
|
|
|
|
++buf[idx(2, color.b)];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
2021-10-14 18:13:07 +13:00
|
|
|
++buf[idx(3, color.m)];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else // 8bpc raster
|
|
|
|
{
|
|
|
|
for (j = 0; j < ly; j++) {
|
2021-10-14 18:13:07 +13:00
|
|
|
TPixel *pix = (TPixel *)ras->getRawData(0, j);
|
2016-06-15 18:43:10 +12:00
|
|
|
for (i = 0; i < lx; i++, pix++) {
|
|
|
|
int mValue = pix->m;
|
|
|
|
if (mValue != 0) {
|
2021-10-14 18:13:07 +13:00
|
|
|
++buf[idx(0, pix->r)];
|
|
|
|
++buf[idx(1, pix->g)];
|
|
|
|
++buf[idx(2, pix->b)];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
2021-10-14 18:13:07 +13:00
|
|
|
++buf[idx(3, pix->m)];
|
2016-06-15 18:43:10 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ComboHistogram::updateInfo(const TPixel32 &pix, const TPointD &imagePos) {
|
|
|
|
if (pix == TPixel32::Transparent) {
|
|
|
|
m_histograms[0]->showCurrentChannelValue(-1);
|
|
|
|
m_histograms[1]->showCurrentChannelValue(-1);
|
|
|
|
m_histograms[2]->showCurrentChannelValue(-1);
|
|
|
|
m_rgbLabel->setColorAndUpdate(Qt::transparent);
|
|
|
|
m_xPosLabel->setText("");
|
|
|
|
m_yPosLabel->setText("");
|
|
|
|
} else {
|
|
|
|
// show picked color's channel values
|
|
|
|
m_histograms[0]->showCurrentChannelValue((int)pix.r);
|
|
|
|
m_histograms[1]->showCurrentChannelValue((int)pix.g);
|
|
|
|
m_histograms[2]->showCurrentChannelValue((int)pix.b);
|
|
|
|
m_rgbLabel->setColorAndUpdate(QColor((int)pix.r, (int)pix.g, (int)pix.b));
|
|
|
|
m_xPosLabel->setText(QString::number(tround(imagePos.x)));
|
|
|
|
m_yPosLabel->setText(QString::number(tround(imagePos.y)));
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2021-10-14 18:13:07 +13:00
|
|
|
void ComboHistogram::updateInfo(const TPixel64 &pix, const TPointD &imagePos) {
|
|
|
|
if (pix == TPixel64::Transparent) {
|
|
|
|
m_histograms[0]->showCurrentChannelValue(-1);
|
|
|
|
m_histograms[1]->showCurrentChannelValue(-1);
|
|
|
|
m_histograms[2]->showCurrentChannelValue(-1);
|
|
|
|
m_rgbLabel->setColorAndUpdate(Qt::transparent);
|
|
|
|
m_xPosLabel->setText("");
|
|
|
|
m_yPosLabel->setText("");
|
|
|
|
} else {
|
|
|
|
TPixel32 pix32 = toPixel32(pix);
|
|
|
|
// show picked color's channel values
|
|
|
|
m_histograms[0]->showCurrentChannelValue((int)pix32.r);
|
|
|
|
m_histograms[1]->showCurrentChannelValue((int)pix32.g);
|
|
|
|
m_histograms[2]->showCurrentChannelValue((int)pix32.b);
|
|
|
|
m_rgbLabel->setColorAndUpdate(
|
|
|
|
QColor::fromRgba64((ushort)pix.r, (ushort)pix.g, (ushort)pix.b));
|
|
|
|
m_xPosLabel->setText(QString::number(tround(imagePos.x)));
|
|
|
|
m_yPosLabel->setText(QString::number(tround(imagePos.y)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void ComboHistogram::updateAverageColor(const TPixel32 &pix) {
|
|
|
|
if (pix == TPixel32::Transparent) {
|
|
|
|
m_rectAverageRgbLabel->setColorAndUpdate(Qt::transparent);
|
|
|
|
} else {
|
|
|
|
m_rectAverageRgbLabel->setColorAndUpdate(
|
|
|
|
QColor((int)pix.r, (int)pix.g, (int)pix.b));
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2021-10-14 18:13:07 +13:00
|
|
|
|
|
|
|
void ComboHistogram::updateAverageColor(const TPixel64 &pix) {
|
|
|
|
if (pix == TPixel64::Transparent) {
|
|
|
|
m_rectAverageRgbLabel->setColorAndUpdate(Qt::transparent);
|
|
|
|
} else {
|
|
|
|
m_rectAverageRgbLabel->setColorAndUpdate(
|
|
|
|
QColor::fromRgba64((ushort)pix.r, (ushort)pix.g, (ushort)pix.b));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ComboHistogram::onDisplayModeChanged() {
|
|
|
|
ComboHistoRGBLabel::DisplayMode mode =
|
|
|
|
static_cast<ComboHistoRGBLabel::DisplayMode>(
|
|
|
|
m_displayModeCombo->currentData().toInt());
|
|
|
|
m_rgbLabel->setDisplayMode(mode);
|
|
|
|
m_rectAverageRgbLabel->setDisplayMode(mode);
|
|
|
|
HistogramChannelDisplayMode = (int)mode;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ComboHistogram::updateCompHistogram() {
|
|
|
|
assert(!m_compHistoIsValid);
|
|
|
|
m_compHistoIsValid = true;
|
|
|
|
|
|
|
|
TImageP refimg =
|
|
|
|
TImageCache::instance()->get(QString("TnzCompareImg"), false);
|
|
|
|
|
|
|
|
if (!(TToonzImageP)refimg && !(TRasterImageP)refimg) return;
|
|
|
|
|
|
|
|
computeChannelsValue(&m_channelValueComp[0][0], sizeof m_channelValueComp,
|
|
|
|
refimg->raster(), refimg->getPalette());
|
|
|
|
|
|
|
|
for (int chan = 0; chan < 4; chan++)
|
|
|
|
m_histograms[chan]->refleshValue(&m_channelValueComp[chan][0], true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ComboHistogram::showEvent(QShowEvent *) {
|
|
|
|
if (!m_compHistoIsValid && m_showCompare) updateCompHistogram();
|
|
|
|
|
|
|
|
int envMode = HistogramChannelDisplayMode;
|
|
|
|
m_displayModeCombo->setCurrentIndex(m_displayModeCombo->findData(envMode));
|
|
|
|
ComboHistoRGBLabel::DisplayMode mode =
|
|
|
|
static_cast<ComboHistoRGBLabel::DisplayMode>(envMode);
|
|
|
|
m_rgbLabel->setDisplayMode(mode);
|
|
|
|
m_rectAverageRgbLabel->setDisplayMode(mode);
|
|
|
|
}
|