Skip to content

Commit

Permalink
feat(ColorWidget) : Add CMYK support
Browse files Browse the repository at this point in the history
A new setting activeCmykComponent has been introduced, while the old
one activeComponent refers now only to the Rgb/Hsv part
  • Loading branch information
troopa81 committed May 22, 2024
1 parent eee787f commit 4bd56fa
Show file tree
Hide file tree
Showing 11 changed files with 1,361 additions and 812 deletions.
4 changes: 4 additions & 0 deletions python/PyQt6/gui/auto_additions/qgscolorwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
QgsColorWidget.Saturation = QgsColorWidget.ColorComponent.Saturation
QgsColorWidget.Value = QgsColorWidget.ColorComponent.Value
QgsColorWidget.Alpha = QgsColorWidget.ColorComponent.Alpha
QgsColorWidget.Cyan = QgsColorWidget.ColorComponent.Cyan
QgsColorWidget.Magenta = QgsColorWidget.ColorComponent.Magenta
QgsColorWidget.Yellow = QgsColorWidget.ColorComponent.Yellow
QgsColorWidget.Black = QgsColorWidget.ColorComponent.Black

This comment has been minimized.

Copy link
@alexCCI

alexCCI Aug 7, 2024

The CMYK components are not displayed as a line.
image

This comment has been minimized.

Copy link
@troopa81

troopa81 Aug 12, 2024

Author Contributor

true, I'll fix this

This comment has been minimized.

Copy link
@troopa81

troopa81 Aug 12, 2024

Author Contributor

Hummm, actually this is an HTML notation, defined with RGB component, so there is nothing much to be fixed here

This comment has been minimized.

Copy link
@alexCCI

alexCCI Aug 28, 2024

I wanted to say that it would make sense to have not only the RGB(r, g, b) description in addition to the HEX format, but also the CMYK(c, m, y, k) one.

Like this:
355864516-19a40797-ed72-40d0-bd97-301a411289fe

This comment has been minimized.

Copy link
@troopa81

troopa81 Aug 29, 2024

Author Contributor

Ok, I get it.

I'm running out of fund on the CMYK topic, so I'm adding it to the todo list until someone show up to fund.

QgsColorRampWidget.Horizontal = QgsColorRampWidget.Orientation.Horizontal
QgsColorRampWidget.Vertical = QgsColorRampWidget.Orientation.Vertical
QgsColorTextWidget.HexRgb = QgsColorTextWidget.ColorTextFormat.HexRgb
Expand Down
20 changes: 17 additions & 3 deletions python/PyQt6/gui/auto_generated/qgscolorwidgets.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ set to a color with an ambiguous hue (e.g., black or white shades).
Hue,
Saturation,
Value,
Alpha
Alpha,
Cyan,
Magenta,
Yellow,
Black
};

QgsColorWidget( QWidget *parent /TransferThis/ = 0, ColorComponent component = Multiple );
Expand Down Expand Up @@ -145,7 +149,7 @@ Returns the range of valid values for the color widget's component
:return: maximum value allowed for color component, or -1 if widget has multiple components
%End

int componentRange( ColorComponent component ) const;
static int componentRange( ColorComponent component );
%Docstring
Returns the range of valid values a color component

Expand All @@ -172,7 +176,7 @@ as QColor returns a hue of -1 if the color's hue is ambiguous (e.g., if the satu
:return: explicitly set hue for widget
%End

void alterColor( QColor &color, QgsColorWidget::ColorComponent component, int newValue ) const;
static void alterColor( QColor &color, QgsColorWidget::ColorComponent component, int newValue );
%Docstring
Alters a color by modifying the value of a specific color component

Expand All @@ -182,6 +186,16 @@ Alters a color by modifying the value of a specific color component
valid range for the color component.
%End

bool isCmyk() const;
%Docstring
Returns true if the color widget component is either Cyan, Magenta, Yellow or Black
%End

static bool isCmyk( QgsColorWidget::ColorComponent component );
%Docstring
Returns true if ``component`` is either Cyan, Magenta, Yellow or Black
%End

static const QPixmap &transparentBackground();
%Docstring
Generates a checkboard pattern pixmap for use as a background to transparent colors
Expand Down
20 changes: 17 additions & 3 deletions python/gui/auto_generated/qgscolorwidgets.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ set to a color with an ambiguous hue (e.g., black or white shades).
Hue,
Saturation,
Value,
Alpha
Alpha,
Cyan,
Magenta,
Yellow,
Black
};

QgsColorWidget( QWidget *parent /TransferThis/ = 0, ColorComponent component = Multiple );
Expand Down Expand Up @@ -145,7 +149,7 @@ Returns the range of valid values for the color widget's component
:return: maximum value allowed for color component, or -1 if widget has multiple components
%End

int componentRange( ColorComponent component ) const;
static int componentRange( ColorComponent component );
%Docstring
Returns the range of valid values a color component

Expand All @@ -172,7 +176,7 @@ as QColor returns a hue of -1 if the color's hue is ambiguous (e.g., if the satu
:return: explicitly set hue for widget
%End

void alterColor( QColor &color, QgsColorWidget::ColorComponent component, int newValue ) const;
static void alterColor( QColor &color, QgsColorWidget::ColorComponent component, int newValue );
%Docstring
Alters a color by modifying the value of a specific color component

Expand All @@ -182,6 +186,16 @@ Alters a color by modifying the value of a specific color component
valid range for the color component.
%End

bool isCmyk() const;
%Docstring
Returns true if the color widget component is either Cyan, Magenta, Yellow or Black
%End

static bool isCmyk( QgsColorWidget::ColorComponent component );
%Docstring
Returns true if ``component`` is either Cyan, Magenta, Yellow or Black
%End

static const QPixmap &transparentBackground();
%Docstring
Generates a checkboard pattern pixmap for use as a background to transparent colors
Expand Down
Loading

0 comments on commit 4bd56fa

Please sign in to comment.