Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB Matrix: allow to get/set multiple colors programmatically #1653

Merged
merged 78 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
941baf2
Add a new script version which digests the raw selected colors.
hjtappe Apr 2, 2023
41ca80a
Implement an additional rawColors array function argument
hjtappe Apr 4, 2023
fbfe04a
Integrate JS rgbScript updates.
hjtappe Apr 6, 2023
a360e26
Update the scripts to follow the stage colors.
hjtappe Apr 6, 2023
b87b7cb
Convert startColor and endColor into an array
hjtappe Apr 6, 2023
1ea868f
Merge duplicate defined values
hjtappe Mar 19, 2023
bc7a4b8
Fix whitespace tabs to spaces
hjtappe Apr 7, 2023
a2e9b40
Evaluate properties on apiVersion 2 and above.
hjtappe Apr 12, 2023
2ae4286
Handle script errors and use corrected array handling.
hjtappe Apr 14, 2023
301c3b7
Rotate color array and format the algorithm.
hjtappe Apr 15, 2023
8a62f6a
Unify plasma.js and plasmacolor.js to make them diffable
hjtappe Apr 15, 2023
24dcb0e
Fix lost bracket
hjtappe Apr 15, 2023
33107b2
Fix the problem of the first color being mostly suppressed
hjtappe Apr 16, 2023
e6bd8c0
Make the rgbMap parameter an Array object.
hjtappe Apr 17, 2023
a95439f
Perform more robust parameter evaluation
hjtappe Apr 17, 2023
eb53109
Add a test to check the effectiveness of the rawColors
hjtappe Apr 17, 2023
edd09d8
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Apr 19, 2023
2438f65
Fix tabs to spaces.
hjtappe Apr 19, 2023
7a43f12
Fix reasonable Codacy remarks.
hjtappe Apr 20, 2023
9bfc06a
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Apr 25, 2023
d9ab549
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Apr 25, 2023
55b36b0
Use the second raw Color for the highlights in marquee.js
hjtappe Apr 26, 2023
486bf92
Initialize background feature when the color changes.
hjtappe Apr 26, 2023
1dbf566
Recalculate & reset marquee only on dimension change.
hjtappe Apr 27, 2023
ffc2b85
remove unused function
hjtappe Apr 27, 2023
03200b0
Initialize the marquee also when pattern width changes.
hjtappe Apr 27, 2023
401fe6f
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe May 3, 2023
04910ed
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Sep 13, 2023
7d0fdb9
Fix Windows build of tests
hjtappe Sep 14, 2023
e8f0e12
Implement five colors support in ui code.
hjtappe Nov 16, 2023
b36df53
Implement five colors in qmlui
hjtappe Nov 17, 2023
6d81e14
Update test to cope with up to 5 colors in apiVersion 3.
hjtappe Nov 17, 2023
b020f90
Correct some errors in qml
hjtappe Nov 17, 2023
7f6e799
Thorough review and related fixes.
hjtappe Dec 16, 2023
ebc0f65
Load and store the additional colors. Extend the test.
hjtappe Dec 16, 2023
9cb0e68
Do not overwrite configured colors
hjtappe Dec 17, 2023
94ca479
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Dec 20, 2023
b3094b5
Integrate latest changes from webaccess
hjtappe Jan 2, 2024
5179962
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Jan 2, 2024
e6e3ab2
Fix C&P typo in the function name.
hjtappe Jan 2, 2024
19bf6af
Consistently use the intended base argument in parseInt.
hjtappe Jan 2, 2024
ca386ad
Uodate ballscolors to support more than 5 balls
hjtappe Jan 2, 2024
5496516
Update translations of new knobs.
hjtappe Jan 2, 2024
127192d
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Mar 25, 2024
bdd74ee
Resurrect original scripts for backward compatibility.
hjtappe Mar 25, 2024
dbdb363
Fix the VC UI matrix properties layout to 5-color scheme.
hjtappe Mar 26, 2024
34f7463
Modify file names to exclude numbers.
hjtappe Mar 26, 2024
1196ba1
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Mar 26, 2024
d22dc4b
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe May 24, 2024
9870df2
Fix typo.
hjtappe May 24, 2024
8b0046d
Align color pickers in matrix editor
hjtappe May 26, 2024
8bda20e
Remplace static array with dynamic QVector.
hjtappe Jun 5, 2024
577f16f
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Jun 5, 2024
05fd4b3
Fix for unit test in the new structure.
hjtappe Jun 6, 2024
d02415f
Implement v3 color hook API in scripts.
hjtappe Oct 15, 2024
82ed54c
Add rgbMapSetColors script API to be called on color change.
hjtappe Oct 15, 2024
79dca9f
Implement Codacy recommendations
hjtappe Oct 16, 2024
81ad09e
Modify engine logic to support the separate color call.
hjtappe Oct 16, 2024
4147c93
Merge branch 'master' of https://github.com/mcallegari/qlcplus into r…
hjtappe Oct 17, 2024
98c4a98
Merge pull request #1422 from hjtappe/rgbScript-colorArray
mcallegari Oct 19, 2024
6cd67bd
engine: add rgbMapGetColors to RGBAlgorithm
mcallegari Oct 24, 2024
bdced4f
engine: fix QJSValue usage
mcallegari Oct 24, 2024
7a52145
engine: fix RGBMatrix copy and test unit
mcallegari Oct 24, 2024
3b53dd1
Update pixel colors when properties change
hjtappe Oct 28, 2024
ea8186f
Gracefully handle unset colors by setting them to black.
hjtappe Oct 28, 2024
6d74f37
Replace isNaN by different null check in plasma.js
hjtappe Oct 28, 2024
c344273
Remove isNaN from other productive code.
hjtappe Oct 28, 2024
7d943f0
Merge new scripts over existing ones.
hjtappe Oct 28, 2024
56a2fa8
In ballscolorsdirect, populate the colors with the colors that have b…
hjtappe Oct 28, 2024
eec1965
Merge ballsColors.js into balls.js
hjtappe Oct 28, 2024
7b74247
Fix cmake / Windows build.
hjtappe Oct 28, 2024
90d14b0
Also remove plasmaColors.js in cmake.
hjtappe Oct 28, 2024
e490a6a
Merge pull request #1632 from hjtappe/stagecolor-fixes
mcallegari Nov 1, 2024
6cc7209
Merge branch 'master' into stagecolors
mcallegari Dec 29, 2024
0cc5540
engine: improve some coverage
mcallegari Dec 30, 2024
a53cc94
qmlui: improve RGBMatrix editor code
mcallegari Dec 30, 2024
4d99a82
qmlui: fix RGBMatrix color reset
mcallegari Dec 30, 2024
9eb789e
qmlui: notify RGBMatrix color change to the UI
mcallegari Dec 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions engine/src/rgbalgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,27 @@

RGBAlgorithm::RGBAlgorithm(Doc * doc)
: m_doc(doc)
, m_startColor(QColor())
, m_endColor(QColor())
{
}

void RGBAlgorithm::setColors(QColor start, QColor end)
void RGBAlgorithm::setColors(QVector<QColor> colors)
{
m_startColor = start;
m_endColor = end;
int nCols = acceptColors();
m_colors.clear();

for (int i = 0; i < nCols; i++)
{
if (i < colors.count())
m_colors.append(colors.at(i));
}
}

QColor RGBAlgorithm::getColor(uint i) const
{
if (i >= (uint)m_colors.count())
return QColor();

return m_colors[i];
}

/****************************************************************************
Expand Down
19 changes: 13 additions & 6 deletions engine/src/rgbalgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ typedef QVector<QVector<uint> > RGBMap;
#define KXMLQLCRGBAlgorithm QString("Algorithm")
#define KXMLQLCRGBAlgorithmType QString("Type")

#define RGBAlgorithmColorDisplayCount 5

class RGBAlgorithm
{
public:
Expand Down Expand Up @@ -72,6 +74,12 @@ class RGBAlgorithm
/** Maximum step count for rgbMap() function. */
virtual int rgbMapStepCount(const QSize& size) = 0;

/** Set the colors for the RGBmap */
virtual void rgbMapSetColors(QVector<uint> &colors) = 0;

/** Get the colors from the RGB script */
virtual QVector<uint> rgbMapGetColors() = 0;

/** Load a RGBMap for the given step. */
virtual void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) = 0;

Expand Down Expand Up @@ -101,15 +109,14 @@ class RGBAlgorithm
* RGB Colors
************************************************************************/
public:
/** Set the start/end color the algorithm can use */
virtual void setColors(QColor start, QColor end);

QColor startColor() { return m_startColor; }
/** Set the colors the algorithm can use */
virtual void setColors(QVector<QColor>);

QColor endColor() { return m_endColor; }
/** Get the color which is set for the algorithm */
virtual QColor getColor(uint i) const;

private:
QColor m_startColor, m_endColor;
QVector<QColor> m_colors;

/************************************************************************
* Available algorithms
Expand Down
28 changes: 20 additions & 8 deletions engine/src/rgbaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,21 @@ void RGBAudio::calculateColors(int barsHeight)
{
if (barsHeight > 0)
{
QColor startColor = getColor(0);
QColor endColor = getColor(1);
m_barColors.clear();
if (endColor() == QColor()
if (endColor == QColor()
|| barsHeight == 1) // to avoid division by 0 below
{
for (int i = 0; i < barsHeight; i++)
m_barColors.append(startColor().rgb());
m_barColors.append(startColor.rgb());
}
else
{
int crDelta = (endColor().red() - startColor().red()) / (barsHeight - 1);
int cgDelta = (endColor().green() - startColor().green()) / (barsHeight - 1);
int cbDelta = (endColor().blue() - startColor().blue()) / (barsHeight - 1);
QColor pixelColor = startColor();
int crDelta = (endColor.red() - startColor.red()) / (barsHeight - 1);
int cgDelta = (endColor.green() - startColor.green()) / (barsHeight - 1);
int cbDelta = (endColor.blue() - startColor.blue()) / (barsHeight - 1);
QColor pixelColor = startColor;

for (int i = 0; i < barsHeight; i++)
{
Expand All @@ -121,6 +123,16 @@ int RGBAudio::rgbMapStepCount(const QSize& size)
return 1;
}

void RGBAudio::rgbMapSetColors(QVector<uint> &colors)
{
Q_UNUSED(colors);
}

QVector<uint> RGBAudio::rgbMapGetColors()
{
return QVector<uint>();
}

void RGBAudio::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map)
{
Q_UNUSED(step);
Expand Down Expand Up @@ -203,9 +215,9 @@ int RGBAudio::apiVersion() const
return 1;
}

void RGBAudio::setColors(QColor start, QColor end)
void RGBAudio::setColors(QVector<QColor> colors)
{
RGBAlgorithm::setColors(start, end);
RGBAlgorithm::setColors(colors);

// invalidate bars colors so the next time a rendering is
// required, it will be filled with the right values
Expand Down
8 changes: 7 additions & 1 deletion engine/src/rgbaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ protected slots:
/** @reimp */
int rgbMapStepCount(const QSize& size);

/** @reimp */
void rgbMapSetColors(QVector<uint> &colors);

/** @reimp */
QVector<uint> rgbMapGetColors();

/** @reimp */
void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map);

Expand All @@ -86,7 +92,7 @@ protected slots:
int apiVersion() const;

/** @reimp */
void setColors(QColor start, QColor end);
void setColors(QVector<QColor> colors);

/** @reimp */
RGBAlgorithm::Type type() const;
Expand Down
10 changes: 10 additions & 0 deletions engine/src/rgbimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ int RGBImage::rgbMapStepCount(const QSize& size)
}
}

void RGBImage::rgbMapSetColors(QVector<uint> &colors)
{
Q_UNUSED(colors);
}

QVector<uint> RGBImage::rgbMapGetColors()
{
return QVector<uint>();
}

void RGBImage::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map)
{
Q_UNUSED(rgb);
Expand Down
6 changes: 6 additions & 0 deletions engine/src/rgbimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ class RGBImage : public RGBAlgorithm
/** @reimp */
int rgbMapStepCount(const QSize& size);

/** @reimp */
void rgbMapSetColors(QVector<uint> &colors);

/** @reimp */
QVector<uint> rgbMapGetColors();

/** @reimp */
void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map);

Expand Down
Loading
Loading