Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
color-preview.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/*
3
* Authors:
4
* Lauris Kaplinski <lauris@kaplinski.com>
5
* Ralf Stephan <ralf@ark.in-berlin.de>
6
* Michael Kowalski
7
*
8
* Copyright (C) 2001-2005 Authors
9
* Copyright (C) 2001 Ximian, Inc.
10
*
11
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
12
*/
13
14
#ifndef SEEN_COLOR_PREVIEW_H
15
#define SEEN_COLOR_PREVIEW_H
16
17
#include <cairomm/pattern.h>
18
#include <cstdint>
19
#include <cairomm/refptr.h>
20
#include <gtkmm/drawingarea.h>
21
22
namespace
Cairo
{
23
class
Context;
24
}
// namespace Cairo
25
26
namespace
Inkscape::UI::Widget
{
27
43
class
ColorPreview
final :
public
Gtk::DrawingArea {
44
public
:
45
ColorPreview
(std::uint32_t rgba);
46
// set preview color RGBA with opacity (alpha)
47
void
setRgba32
(std::uint32_t rgba);
48
// set arbitrary pattern-based preview
49
void
setPattern
(Cairo::RefPtr<Cairo::Pattern> pattern);
50
// simple color patch vs outlined color patch
51
enum
Style
{
Simple
,
Outlined
};
52
void
setStyle
(
Style
style);
53
// add indicator on top of the preview: swatch or spot color
54
enum
Indicator
{
None
,
Swatch
,
SpotColor
};
55
void
setIndicator
(
Indicator
indicator);
56
private
:
57
std::uint32_t
_rgba
;
// requested RGBA color, used if there is no pattern given
58
Cairo::RefPtr<Cairo::Pattern>
_pattern
;
// pattern to show, if provided
59
Style
_style
=
Simple
;
60
Indicator
_indicator
=
None
;
61
void
draw_func
(Cairo::RefPtr<Cairo::Context>
const
&cr,
int
width
,
int
height
);
62
};
63
64
}
// namespace Inkscape::UI::Widget
65
66
#endif
// SEEN_COLOR_PREVIEW_H
67
68
/*
69
Local Variables:
70
mode:c++
71
c-file-style:"stroustrup"
72
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
73
indent-tabs-mode:nil
74
fill-column:99
75
End:
76
*/
77
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
Inkscape::UI::Widget::ColorPreview
A color preview widget, used within a picker button and style indicator.
Definition
color-preview.h:43
Inkscape::UI::Widget::ColorPreview::_rgba
std::uint32_t _rgba
Definition
color-preview.h:57
Inkscape::UI::Widget::ColorPreview::_pattern
Cairo::RefPtr< Cairo::Pattern > _pattern
Definition
color-preview.h:58
Inkscape::UI::Widget::ColorPreview::draw_func
void draw_func(Cairo::RefPtr< Cairo::Context > const &cr, int width, int height)
Definition
color-preview.cpp:76
Inkscape::UI::Widget::ColorPreview::Indicator
Indicator
Definition
color-preview.h:54
Inkscape::UI::Widget::ColorPreview::SpotColor
@ SpotColor
Definition
color-preview.h:54
Inkscape::UI::Widget::ColorPreview::Swatch
@ Swatch
Definition
color-preview.h:54
Inkscape::UI::Widget::ColorPreview::None
@ None
Definition
color-preview.h:54
Inkscape::UI::Widget::ColorPreview::_indicator
Indicator _indicator
Definition
color-preview.h:60
Inkscape::UI::Widget::ColorPreview::setIndicator
void setIndicator(Indicator indicator)
Definition
color-preview.cpp:218
Inkscape::UI::Widget::ColorPreview::_style
Style _style
Definition
color-preview.h:59
Inkscape::UI::Widget::ColorPreview::Style
Style
Definition
color-preview.h:51
Inkscape::UI::Widget::ColorPreview::Outlined
@ Outlined
Definition
color-preview.h:51
Inkscape::UI::Widget::ColorPreview::Simple
@ Simple
Definition
color-preview.h:51
Inkscape::UI::Widget::ColorPreview::setRgba32
void setRgba32(std::uint32_t rgba)
Definition
color-preview.cpp:41
Inkscape::UI::Widget::ColorPreview::setStyle
void setStyle(Style style)
Definition
color-preview.cpp:207
Inkscape::UI::Widget::ColorPreview::setPattern
void setPattern(Cairo::RefPtr< Cairo::Pattern > pattern)
Definition
color-preview.cpp:49
Cairo
Control handle rendering/caching.
Definition
ctrl-handle-rendering.h:21
Inkscape::UI::Widget
Custom widgets.
Definition
desktop.h:126
Inkscape::UI::Widget::height
static constexpr int height
Definition
color-palette-preview.cpp:23
width
double width
Definition
convex_hull.cpp:106
src
ui
widget
color-preview.h
Generated on Sun Jul 13 2025 04:02:22 for Inkscape by
1.9.8