Refactoring: layColor -> tlColor

This commit is contained in:
Matthias Koefferlein 2022-05-30 23:21:32 +02:00
parent 84cf60dbb7
commit 62bbef53ac
91 changed files with 555 additions and 555 deletions

View File

@ -24,7 +24,7 @@
#include "layPlugin.h"
#include "layConverters.h"
#include "layDispatcher.h"
#include "layColor.h"
#include "tlColor.h"
#if defined(HAVE_QT)
# include "layConfigurationDialog.h"
# include "layAbstractMenu.h"
@ -67,7 +67,7 @@ PluginDeclaration::get_options (std::vector < std::pair<std::string, std::string
{
options.push_back (std::pair<std::string, std::string> (cfg_max_number_of_rulers, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_ruler_snap_range, "8"));
options.push_back (std::pair<std::string, std::string> (cfg_ruler_color, lay::ColorConverter ().to_string (lay::Color ())));
options.push_back (std::pair<std::string, std::string> (cfg_ruler_color, lay::ColorConverter ().to_string (tl::Color ())));
options.push_back (std::pair<std::string, std::string> (cfg_ruler_halo, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_ruler_snap_mode, ACConverter ().to_string (lay::AC_Any)));
options.push_back (std::pair<std::string, std::string> (cfg_ruler_obj_snap, tl::to_string (true)));

View File

@ -763,7 +763,7 @@ View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas)
int basic_width = int(0.5 + 1.0 / canvas.resolution ());
lay::Color c (mp_rulers->color ());
tl::Color c (mp_rulers->color ());
if (! c.is_valid ()) {
c = canvas.foreground_color ();
}
@ -823,7 +823,7 @@ Service::configure (const std::string &name, const std::string &value)
if (name == cfg_ruler_color) {
lay::Color color;
tl::Color color;
lay::ColorConverter ().from_string (value, color);
// make the color available for the dynamic view objects too.
@ -914,7 +914,7 @@ Service::annotations_changed ()
}
std::vector <lay::ViewOp>
Service::get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color /*active*/) const
Service::get_view_ops (lay::RedrawThreadCanvas &canvas, tl::Color background, tl::Color foreground, tl::Color /*active*/) const
{
int basic_width = int(0.5 + 1.0 / canvas.resolution ());

View File

@ -389,7 +389,7 @@ public:
/**
* @brief Color accessor
*/
lay::Color color () const
tl::Color color () const
{
return m_color;
}
@ -500,7 +500,7 @@ public:
private:
// Ruler display and snapping configuration
lay::Color m_color;
tl::Color m_color;
bool m_halo;
lay::angle_constraint_type m_snap_mode;
double m_grid;
@ -601,7 +601,7 @@ private:
/**
* @brief implementation of the "Drawing" interface: configuration
*/
std::vector <lay::ViewOp> get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color active) const;
std::vector <lay::ViewOp> get_view_ops (lay::RedrawThreadCanvas &canvas, tl::Color background, tl::Color foreground, tl::Color active) const;
/**
* @brief Update m_rulers to reflect the selection

View File

@ -1230,7 +1230,7 @@ PartialService::clear_partial_transient_selection ()
}
void
PartialService::set_colors (lay::Color /*background*/, lay::Color color)
PartialService::set_colors (tl::Color /*background*/, tl::Color color)
{
m_color = color.rgb ();
if (mp_box) {

View File

@ -288,7 +288,7 @@ public:
/**
* @brief Reimplementation of the ViewService interface: set the colors
*/
virtual void set_colors (lay::Color background, lay::Color text);
virtual void set_colors (tl::Color background, tl::Color text);
/**
* @brief Cancel any edit operations (in this case, unselect all & cancel any drag operation)

View File

@ -32,7 +32,7 @@
#include "layMarker.h"
#include "laySnap.h"
#include "layObjectInstPath.h"
#include "layColor.h"
#include "tlColor.h"
#include "dbLayout.h"
#include "dbShape.h"
#include "edtUtils.h"
@ -220,7 +220,7 @@ public:
/**
* @brief Color accessor
*/
lay::Color color () const
tl::Color color () const
{
return m_color;
}
@ -593,7 +593,7 @@ private:
db::ShapeIterator::flags_type m_flags;
// The look of the markers
lay::Color m_color;
tl::Color m_color;
// The current transformation on movement
db::DTrans m_move_trans;

View File

@ -43,14 +43,14 @@ static void clear_colormap (img::DataMapping *dm)
dm->false_color_nodes.clear ();
}
static void add_colormap (img::DataMapping *dm, double value, lay::color_t color)
static void add_colormap (img::DataMapping *dm, double value, tl::color_t color)
{
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (lay::Color (color), lay::Color (color))));
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (tl::Color (color), tl::Color (color))));
}
static void add_colormap2 (img::DataMapping *dm, double value, lay::color_t lcolor, lay::color_t rcolor)
static void add_colormap2 (img::DataMapping *dm, double value, tl::color_t lcolor, tl::color_t rcolor)
{
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (lay::Color (lcolor), lay::Color (rcolor))));
dm->false_color_nodes.push_back (std::make_pair (value, std::make_pair (tl::Color (lcolor), tl::Color (rcolor))));
}
static size_t num_colormap_entries (const img::DataMapping *dm)
@ -58,7 +58,7 @@ static size_t num_colormap_entries (const img::DataMapping *dm)
return dm->false_color_nodes.size ();
}
static lay::color_t colormap_color (const img::DataMapping *dm, size_t i)
static tl::color_t colormap_color (const img::DataMapping *dm, size_t i)
{
if (i < dm->false_color_nodes.size ()) {
return dm->false_color_nodes [i].second.first.rgb ();
@ -67,7 +67,7 @@ static lay::color_t colormap_color (const img::DataMapping *dm, size_t i)
}
}
static lay::color_t colormap_lcolor (const img::DataMapping *dm, size_t i)
static tl::color_t colormap_lcolor (const img::DataMapping *dm, size_t i)
{
if (i < dm->false_color_nodes.size ()) {
return dm->false_color_nodes [i].second.first.rgb ();
@ -76,7 +76,7 @@ static lay::color_t colormap_lcolor (const img::DataMapping *dm, size_t i)
}
}
static lay::color_t colormap_rcolor (const img::DataMapping *dm, size_t i)
static tl::color_t colormap_rcolor (const img::DataMapping *dm, size_t i)
{
if (i < dm->false_color_nodes.size ()) {
return dm->false_color_nodes [i].second.second.rgb ();

View File

@ -346,7 +346,7 @@ public:
ui ()->ungrab_mouse (this);
}
void set_colors (lay::Color /*background*/, lay::Color /*color*/)
void set_colors (tl::Color /*background*/, tl::Color /*color*/)
{
// ...
}

View File

@ -53,8 +53,8 @@ namespace img
DataMapping::DataMapping ()
: brightness (0.0), contrast (0.0), gamma (1.0), red_gain (1.0), green_gain (1.0), blue_gain (1.0)
{
false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (0, 0, 0), tl::Color (0, 0, 0))));
false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
}
bool
@ -212,7 +212,7 @@ DataMapping::create_data_mapping (bool monochrome, double xmin, double xmax, uns
for (int j = 0; j < n; ++j) {
lay::Color c = interpolated_color (false_color_nodes, x);
tl::Color c = interpolated_color (false_color_nodes, x);
double y = 0.0;
if (channel == 0) {
@ -273,7 +273,7 @@ namespace
struct compare_first_of_node
{
bool operator() (const std::pair <double, std::pair<lay::Color, lay::Color> > &a, const std::pair <double, std::pair<lay::Color, lay::Color> > &b) const
bool operator() (const std::pair <double, std::pair<tl::Color, tl::Color> > &a, const std::pair <double, std::pair<tl::Color, tl::Color> > &b) const
{
return a.first < b.first;
}
@ -281,16 +281,16 @@ struct compare_first_of_node
}
lay::Color
tl::Color
interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x)
{
if (nodes.size () < 1) {
return lay::Color ();
return tl::Color ();
} else if (nodes.size () < 2) {
return x < nodes[0].first ? nodes[0].second.first : nodes[0].second.second;
} else {
std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator p = std::lower_bound (nodes.begin (), nodes.end (), std::make_pair (x, std::make_pair (lay::Color (), lay::Color ())), compare_first_of_node ());
std::vector<std::pair<double, std::pair<tl::Color, tl::Color> > >::const_iterator p = std::lower_bound (nodes.begin (), nodes.end (), std::make_pair (x, std::make_pair (tl::Color (), tl::Color ())), compare_first_of_node ());
if (p == nodes.end ()) {
return nodes.back ().second.second;
} else if (p == nodes.begin ()) {
@ -310,7 +310,7 @@ interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x)
int s = int (0.5 + s1 + double(x - x1) * double (int (s2) - int (s1)) / double(x2 - x1));
int v = int (0.5 + v1 + double(x - x1) * double (int (v2) - int (v1)) / double(x2 - x1));
return lay::Color::from_hsv ((unsigned int) h, (unsigned int) s, (unsigned int) v);
return tl::Color::from_hsv ((unsigned int) h, (unsigned int) s, (unsigned int) v);
}
@ -1340,7 +1340,7 @@ Object::from_string (const char *str, const char *base_dir)
double x = 0.0;
lay::ColorConverter cc;
lay::Color cl, cr;
tl::Color cl, cr;
std::string s;
m_data_mapping.false_color_nodes.clear ();
@ -1637,10 +1637,10 @@ Object::read_file ()
bool is_color = false;
for (unsigned int i = 0; i < img.height () && ! is_color; ++i) {
const lay::color_t *d = img.scan_line (i);
const lay::color_t *dd = d + img.width ();
const tl::color_t *d = img.scan_line (i);
const tl::color_t *dd = d + img.width ();
while (! is_color && d != dd) {
lay::color_t c = *d++;
tl::color_t c = *d++;
is_color = (((c >> 8) ^ c) & 0xffff) != 0;
}
}
@ -1669,10 +1669,10 @@ Object::read_file ()
unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0;
for (unsigned int y = 0; y < h; ++y) {
const lay::color_t *d = img.scan_line (h - y - 1);
const lay::color_t *dd = d + img.width ();
const tl::color_t *d = img.scan_line (h - y - 1);
const tl::color_t *dd = d + img.width ();
while (d != dd) {
lay::color_t rgb = *d++;
tl::color_t rgb = *d++;
*red++ = lay::red (rgb);
*green++ = lay::green (rgb);
*blue++ = lay::blue (rgb);
@ -1688,10 +1688,10 @@ Object::read_file ()
unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0;
for (unsigned int y = 0; y < h; ++y) {
const lay::color_t *d = img.scan_line (h - y - 1);
const lay::color_t *dd = d + img.width ();
const tl::color_t *d = img.scan_line (h - y - 1);
const tl::color_t *dd = d + img.width ();
while (d != dd) {
lay::color_t rgb = *d++;
tl::color_t rgb = *d++;
*mono++ = lay::green (rgb);
if (msk) {
*msk++ = lay::alpha (rgb) > 128;
@ -1792,7 +1792,7 @@ Object::to_string () const
for (unsigned int i = 0; i < data_mapping ().false_color_nodes.size (); ++i) {
os << data_mapping ().false_color_nodes[i].first;
os << ",";
const std::pair<lay::Color, lay::Color> &clr = data_mapping ().false_color_nodes[i].second;
const std::pair<tl::Color, tl::Color> &clr = data_mapping ().false_color_nodes[i].second;
os << tl::to_word_or_quoted_string (cc.to_string (clr.first));
if (clr.first != clr.second) {
os << ",";
@ -2223,7 +2223,7 @@ Object::validate_pixel_data () const
size_t n = data_length ();
lay::color_t *nc_pixel_data = new lay::color_t [n];
tl::color_t *nc_pixel_data = new tl::color_t [n];
mp_pixel_data = nc_pixel_data;
double min = 0.0, max = 255.0;
@ -2248,7 +2248,7 @@ Object::validate_pixel_data () const
if (mp_data->is_color ()) {
lay::color_t *pixel_data = nc_pixel_data;
tl::color_t *pixel_data = nc_pixel_data;
const unsigned char *f = mp_data->byte_data (0);
const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) {
@ -2271,7 +2271,7 @@ Object::validate_pixel_data () const
} else {
lay::color_t *pixel_data = nc_pixel_data;
tl::color_t *pixel_data = nc_pixel_data;
const unsigned char *f = mp_data->byte_data ();
const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) {
@ -2298,7 +2298,7 @@ Object::validate_pixel_data () const
if (mp_data->is_color ()) {
lay::color_t *pixel_data = nc_pixel_data;
tl::color_t *pixel_data = nc_pixel_data;
const float *f = mp_data->float_data (0);
const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) {
@ -2321,7 +2321,7 @@ Object::validate_pixel_data () const
} else {
lay::color_t *pixel_data = nc_pixel_data;
tl::color_t *pixel_data = nc_pixel_data;
const float *f = mp_data->float_data ();
const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) {

View File

@ -33,7 +33,7 @@
#include "dbMatrix.h"
#include "dbPolygon.h"
#include "tlDataMapping.h"
#include "layColor.h"
#include "tlColor.h"
#include <string>
#include <vector>
@ -50,7 +50,7 @@ class DataHeader;
struct IMG_PUBLIC DataMapping
{
public:
typedef std::vector< std::pair<double, std::pair<lay::Color, lay::Color> > > false_color_nodes_type;
typedef std::vector< std::pair<double, std::pair<tl::Color, tl::Color> > > false_color_nodes_type;
/**
* @brief The constructor
@ -140,7 +140,7 @@ public:
/**
* @brief A helper function to interpolate a color in the color bar at a given x
*/
lay::Color interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x);
tl::Color interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x);
/**
* @brief A image object
@ -883,7 +883,7 @@ public:
/**
* @brief Get the RGB pixel data sets obtained by applying the LUT's
*/
const lay::color_t *pixel_data () const
const tl::color_t *pixel_data () const
{
validate_pixel_data ();
return mp_pixel_data;
@ -974,7 +974,7 @@ private:
bool m_min_value_set, m_max_value_set;
DataMapping m_data_mapping;
bool m_visible;
mutable const lay::color_t *mp_pixel_data;
mutable const tl::color_t *mp_pixel_data;
std::vector <db::DPoint> m_landmarks;
int m_z_position;
bool m_updates_enabled;

View File

@ -736,9 +736,9 @@ PropertiesPage::blue_spinbox_changed (double value)
void
PropertiesPage::black_to_white ()
{
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (0, 0, 0), tl::Color (0, 0, 0))));
nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
false_color_control->set_nodes (nodes);
emit edited ();
}
@ -746,9 +746,9 @@ PropertiesPage::black_to_white ()
void
PropertiesPage::white_to_black ()
{
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (0, 0, 0), tl::Color (0, 0, 0))));
false_color_control->set_nodes (nodes);
emit edited ();
}
@ -756,9 +756,9 @@ PropertiesPage::white_to_black ()
void
PropertiesPage::red_to_blue ()
{
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (255, 0, 0), lay::Color (255, 0, 0))));
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (0, 0, 255), lay::Color (0, 0, 255))));
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (255, 0, 0), tl::Color (255, 0, 0))));
nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (0, 0, 255), tl::Color (0, 0, 255))));
false_color_control->set_nodes (nodes);
emit edited ();
}
@ -766,9 +766,9 @@ PropertiesPage::red_to_blue ()
void
PropertiesPage::blue_to_red ()
{
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 255), lay::Color (0, 0, 255))));
nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 0, 0), lay::Color (255, 0, 0))));
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > nodes;
nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (0, 0, 255), tl::Color (0, 0, 255))));
nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 0, 0), tl::Color (255, 0, 0))));
false_color_control->set_nodes (nodes);
emit edited ();
}
@ -776,7 +776,7 @@ PropertiesPage::blue_to_red ()
void
PropertiesPage::reverse_color_order ()
{
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes (false_color_control->nodes ());
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > nodes (false_color_control->nodes ());
for (size_t i = 0; i < nodes.size () / 2; ++i) {
std::swap (nodes [i].second.second, nodes [nodes.size () - 1 - i].second.first);
std::swap (nodes [i].second.first, nodes [nodes.size () - 1 - i].second.second);

View File

@ -122,8 +122,8 @@ draw_scanline (unsigned int level, const img::Object &image_object, lay::PixelBu
double dpx = (p2.x () - p1.x ()) / double (xstop - xstart);
double dpy = (p2.y () - p1.y ()) / double (xstop - xstart);
lay::color_t *scanline_data = pxbuffer.scan_line (pxbuffer.height () - y - 1) + xstart;
lay::color_t *pixel_data = (lay::color_t *) image_object.pixel_data ();
tl::color_t *scanline_data = pxbuffer.scan_line (pxbuffer.height () - y - 1) + xstart;
tl::color_t *pixel_data = (tl::color_t *) image_object.pixel_data ();
const unsigned char *mask_data = image_object.mask ();
for (int x = xstart; x < xstop; ++x) {

View File

@ -373,7 +373,7 @@ namespace {
struct ColorMapConverter
{
std::string to_string (const std::pair<double, std::pair<lay::Color, lay::Color> > &cm) const
std::string to_string (const std::pair<double, std::pair<tl::Color, tl::Color> > &cm) const
{
std::string s;
s = tl::to_string (cm.first);
@ -389,7 +389,7 @@ namespace {
return s;
}
void from_string (const std::string &s, std::pair<double, std::pair<lay::Color, lay::Color> > &cm) const
void from_string (const std::string &s, std::pair<double, std::pair<tl::Color, tl::Color> > &cm) const
{
tl::Extractor ex (s.c_str ());
@ -427,7 +427,7 @@ tl::XMLStruct<ImageProxy> s_img_structure ("image-data",
tl::make_member (&ImageProxy::max_value, &ImageProxy::set_max_value, "max-value") +
tl::make_element (&ImageProxy::data_mapping, &ImageProxy::set_data_mapping, "data-mapping",
tl::make_element (&img::DataMapping::false_color_nodes, "color-map",
tl::make_member<std::pair<double, std::pair<lay::Color, lay::Color> >, img::DataMapping::false_color_nodes_type::const_iterator, img::DataMapping::false_color_nodes_type, ColorMapConverter> (&img::DataMapping::false_color_nodes_type::begin, &img::DataMapping::false_color_nodes_type::end, &img::DataMapping::false_color_nodes_type::push_back, "color-map-entry", ColorMapConverter ())
tl::make_member<std::pair<double, std::pair<tl::Color, tl::Color> >, img::DataMapping::false_color_nodes_type::const_iterator, img::DataMapping::false_color_nodes_type, ColorMapConverter> (&img::DataMapping::false_color_nodes_type::begin, &img::DataMapping::false_color_nodes_type::end, &img::DataMapping::false_color_nodes_type::push_back, "color-map-entry", ColorMapConverter ())
) +
tl::make_member (&img::DataMapping::brightness, "brightness") +
tl::make_member (&img::DataMapping::contrast, "contrast") +

View File

@ -128,8 +128,8 @@ TwoColorWidget::lock_changed (bool checked)
ColorBar::ColorBar (QWidget *parent)
: QWidget (parent), m_dragging (false), m_selected (-1)
{
m_nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
m_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
m_nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (0, 0, 0), tl::Color (0, 0, 0))));
m_nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
}
ColorBar::~ColorBar ()
@ -161,7 +161,7 @@ void
ColorBar::set_current_color (std::pair<QColor, QColor> c)
{
if (has_selection ()) {
m_nodes [m_selected].second = std::make_pair (lay::Color (c.first.rgb ()), lay::Color (c.second.rgb ()));
m_nodes [m_selected].second = std::make_pair (tl::Color (c.first.rgb ()), tl::Color (c.second.rgb ()));
emit color_mapping_changed ();
update ();
}
@ -220,7 +220,7 @@ namespace
struct compare_first_of_node
{
bool operator() (const std::pair <double, std::pair<lay::Color, lay::Color> > &a, const std::pair <double, std::pair<lay::Color, lay::Color> > &b) const
bool operator() (const std::pair <double, std::pair<tl::Color, tl::Color> > &a, const std::pair <double, std::pair<tl::Color, tl::Color> > &b) const
{
return a.first < b.first;
}
@ -229,21 +229,21 @@ struct compare_first_of_node
}
void
ColorBar::set_nodes (const std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > > &nodes)
ColorBar::set_nodes (const std::vector<std::pair<double, std::pair<tl::Color, tl::Color> > > &nodes)
{
m_nodes = nodes;
std::sort (m_nodes.begin (), m_nodes.end (), compare_first_of_node ());
if (m_nodes.size () == 0 || fabs (m_nodes[0].first) > epsilon) {
m_nodes.insert (m_nodes.begin (), std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
m_nodes.insert (m_nodes.begin (), std::make_pair (0.0, std::make_pair (tl::Color (0, 0, 0), tl::Color (0, 0, 0))));
} else {
m_nodes[0].first = 0.0;
}
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > >::iterator w = m_nodes.begin ();
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > >::const_iterator nn = m_nodes.begin ();
for (std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > >::const_iterator n = m_nodes.begin () + 1; n != m_nodes.end (); ++n) {
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > >::iterator w = m_nodes.begin ();
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > >::const_iterator nn = m_nodes.begin ();
for (std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > >::const_iterator n = m_nodes.begin () + 1; n != m_nodes.end (); ++n) {
if (fabs (nn->first - n->first) > min_value_interval) {
*w++ = *nn;
nn = n;
@ -256,7 +256,7 @@ ColorBar::set_nodes (const std::vector<std::pair<double, std::pair<lay::Color, l
if (m_nodes.back ().first > 1.0 - min_value_interval) {
m_nodes.back ().first = 1.0;
} else {
m_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
m_nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
}
m_selected = -1;
@ -281,8 +281,8 @@ ColorBar::mousePressEvent (QMouseEvent *event)
double xx = double (event->x () - xl) / double (xr - xl);
double dmin = 100.0;
std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator pmin = m_nodes.end ();
for (std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator p = m_nodes.begin (); p != m_nodes.end (); ++p) {
std::vector<std::pair<double, std::pair<tl::Color, tl::Color> > >::const_iterator pmin = m_nodes.end ();
for (std::vector<std::pair<double, std::pair<tl::Color, tl::Color> > >::const_iterator p = m_nodes.begin (); p != m_nodes.end (); ++p) {
double d = fabs (p->first - xx);
if (d < 0.05 && d < dmin) {
dmin = d;
@ -291,9 +291,9 @@ ColorBar::mousePressEvent (QMouseEvent *event)
}
if (pmin != m_nodes.end ()) {
m_selected = int (std::distance (std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::const_iterator (m_nodes.begin ()), pmin));
m_selected = int (std::distance (std::vector<std::pair<double, std::pair<tl::Color, tl::Color> > >::const_iterator (m_nodes.begin ()), pmin));
emit selection_changed ();
std::pair<lay::Color, lay::Color> cp = m_nodes [m_selected].second;
std::pair<tl::Color, tl::Color> cp = m_nodes [m_selected].second;
emit selection_changed (std::make_pair (QColor (cp.first.rgb ()), QColor (cp.second.rgb ())));
m_dragging = true;
update ();
@ -328,13 +328,13 @@ ColorBar::mouseDoubleClickEvent (QMouseEvent *event)
double xx = double (event->x () - xl) / double (xr - xl);
std::vector<std::pair<double, std::pair<lay::Color, lay::Color> > >::iterator p = std::lower_bound (m_nodes.begin (), m_nodes.end (), std::make_pair (xx, std::make_pair (lay::Color (), lay::Color ())), compare_first_of_node ());
std::vector<std::pair<double, std::pair<tl::Color, tl::Color> > >::iterator p = std::lower_bound (m_nodes.begin (), m_nodes.end (), std::make_pair (xx, std::make_pair (tl::Color (), tl::Color ())), compare_first_of_node ());
if (p != m_nodes.begin () && p != m_nodes.end ()) {
m_selected = int (std::distance (m_nodes.begin (), p));
lay::Color ci = interpolated_color (m_nodes, xx);
tl::Color ci = interpolated_color (m_nodes, xx);
m_nodes.insert (p, std::make_pair (xx, std::make_pair (ci, ci)));
emit selection_changed ();
std::pair<lay::Color, lay::Color> cp = m_nodes [m_selected].second;
std::pair<tl::Color, tl::Color> cp = m_nodes [m_selected].second;
emit selection_changed (std::make_pair (QColor (cp.first.rgb ()), QColor (cp.second.rgb ())));
emit color_mapping_changed ();
update ();
@ -410,7 +410,7 @@ ColorBar::paintEvent (QPaintEvent *)
if (xr != xl) {
xx = double (x - xl) / double (xr - xl);
}
lay::Color c = interpolated_color (m_nodes, xx);
tl::Color c = interpolated_color (m_nodes, xx);
painter.fillRect (x, yb - hbar, 1, hbar + 1, QBrush (QColor (c.rgb ())));

View File

@ -26,7 +26,7 @@
#define HDR_imgWidgets
#include "layWidgets.h"
#include "layColor.h"
#include "tlColor.h"
#include "imgObject.h"
#include <QObject>
@ -111,9 +111,9 @@ public:
return m_selected >= 0;
}
void set_nodes (const std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > &nodes);
void set_nodes (const std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > &nodes);
const std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > &nodes () const
const std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > &nodes () const
{
return m_nodes;
}
@ -132,7 +132,7 @@ signals:
private:
bool m_dragging;
int m_selected;
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > m_nodes;
std::vector <std::pair <double, std::pair<tl::Color, tl::Color> > > m_nodes;
std::vector <size_t> m_histogram;
};

View File

@ -45,9 +45,9 @@ TEST(1_FloatMono)
dm.gamma = 1.5;
dm.brightness = 1.25;
dm.false_color_nodes.clear ();
dm.false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (lay::Color (0, 0, 0), lay::Color (0, 0, 0))));
dm.false_color_nodes.push_back (std::make_pair (0.5, std::make_pair (lay::Color (255, 0, 0), lay::Color (0, 255, 0))));
dm.false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (lay::Color (255, 255, 255), lay::Color (255, 255, 255))));
dm.false_color_nodes.push_back (std::make_pair (0.0, std::make_pair (tl::Color (0, 0, 0), tl::Color (0, 0, 0))));
dm.false_color_nodes.push_back (std::make_pair (0.5, std::make_pair (tl::Color (255, 0, 0), tl::Color (0, 255, 0))));
dm.false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
image.set_data_mapping (dm);
image.set_pixel (0, 0, 0.25);

View File

@ -101,8 +101,8 @@ TEST(1)
dm.red_gain = 1.25;
dm.green_gain = 0.75;
dm.blue_gain = 2.5;
lay::Color c (128, 255, 64);
lay::Color c2 (64, 32, 192);
tl::Color c (128, 255, 64);
tl::Color c2 (64, 32, 192);
dm.false_color_nodes.insert (dm.false_color_nodes.begin () + 1, std::make_pair (0.5, std::make_pair (c, c)));
image.set_data_mapping (dm);
EXPECT_EQ (copy1.equals (&image), false);
@ -226,7 +226,7 @@ TEST(2)
dm.red_gain = 1.25;
dm.green_gain = 0.75;
dm.blue_gain = 2.5;
lay::Color c (128, 255, 64);
tl::Color c (128, 255, 64);
dm.false_color_nodes.insert (dm.false_color_nodes.begin () + 1, std::make_pair (0.5, std::make_pair (c, c)));
image.set_data_mapping (dm);
EXPECT_EQ (copy1.equals (&image), false);

View File

@ -72,22 +72,22 @@ public:
void background_color_changed ()
{
lay::Color c = mp_view->background_color ();
tl::Color c = mp_view->background_color ();
// replace by "real" background color if required
if (! c.is_valid ()) {
if (mp_view->widget ()) {
c = lay::Color (mp_view->widget ()->palette ().color (QPalette::Normal, QPalette::Base).rgb ());
c = tl::Color (mp_view->widget ()->palette ().color (QPalette::Normal, QPalette::Base).rgb ());
} else {
c = lay::Color (0xffffff); // white
c = tl::Color (0xffffff); // white
}
}
lay::Color contrast;
tl::Color contrast;
if (c.to_mono ()) {
contrast = lay::Color (0, 0, 0);
contrast = tl::Color (0, 0, 0);
} else {
contrast = lay::Color (255, 255, 255);
contrast = tl::Color (255, 255, 255);
}
set_colors (c, contrast);
@ -392,7 +392,7 @@ public:
ui ()->ungrab_mouse (this);
}
void set_colors (lay::Color /*background*/, lay::Color color)
void set_colors (tl::Color /*background*/, tl::Color color)
{
// set zoom box color
m_color = color.rgb ();

View File

@ -299,22 +299,22 @@ static void clear_lower_hier_level (lay::LayerProperties *n)
n->set_source (s);
}
static lay::color_t get_eff_frame_color_1 (const lay::LayerProperties *n)
static tl::color_t get_eff_frame_color_1 (const lay::LayerProperties *n)
{
return n->eff_frame_color (true);
}
static lay::color_t get_eff_fill_color_1 (const lay::LayerProperties *n)
static tl::color_t get_eff_fill_color_1 (const lay::LayerProperties *n)
{
return n->eff_fill_color (true);
}
static lay::color_t get_frame_color_1 (const lay::LayerProperties *n)
static tl::color_t get_frame_color_1 (const lay::LayerProperties *n)
{
return n->frame_color (true);
}
static lay::color_t get_fill_color_1 (const lay::LayerProperties *n)
static tl::color_t get_fill_color_1 (const lay::LayerProperties *n)
{
return n->fill_color (true);
}

View File

@ -329,23 +329,23 @@ static void save_as2 (lay::LayoutViewBase *view, unsigned int index, const std::
static lay::PixelBuffer get_pixels_with_options (lay::LayoutViewBase *view, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, const db::DBox &target_box)
{
return view->get_pixels_with_options (width, height, linewidth, oversampling, resolution, lay::Color (), lay::Color (), lay::Color (), target_box);
return view->get_pixels_with_options (width, height, linewidth, oversampling, resolution, tl::Color (), tl::Color (), tl::Color (), target_box);
}
static lay::BitmapBuffer get_pixels_with_options_mono (lay::LayoutViewBase *view, unsigned int width, unsigned int height, int linewidth, const db::DBox &target_box)
{
return view->get_pixels_with_options_mono (width, height, linewidth, lay::Color (), lay::Color (), lay::Color (), target_box);
return view->get_pixels_with_options_mono (width, height, linewidth, tl::Color (), tl::Color (), tl::Color (), target_box);
}
static void save_image_with_options (lay::LayoutViewBase *view, const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, const db::DBox &target_box, bool monochrome)
{
view->save_image_with_options (fn, width, height, linewidth, oversampling, resolution, lay::Color (), lay::Color (), lay::Color (), target_box, monochrome);
view->save_image_with_options (fn, width, height, linewidth, oversampling, resolution, tl::Color (), tl::Color (), tl::Color (), target_box, monochrome);
}
#if defined(HAVE_QTBINDINGS)
static QImage get_image_with_options (lay::LayoutViewBase *view, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, const db::DBox &target_box, bool monochrome)
{
return view->get_image_with_options (width, height, linewidth, oversampling, resolution, lay::Color (), lay::Color (), lay::Color (), target_box, monochrome);
return view->get_image_with_options (width, height, linewidth, oversampling, resolution, tl::Color (), tl::Color (), tl::Color (), target_box, monochrome);
}
#endif

View File

@ -37,13 +37,13 @@ lay::DMarker *create_marker (lay::LayoutViewBase *view)
static
void reset_frame_color (lay::DMarker *marker)
{
marker->set_frame_color (lay::Color ());
marker->set_frame_color (tl::Color ());
}
static
void set_frame_color (lay::DMarker *marker, unsigned int color)
{
marker->set_frame_color (lay::Color (color));
marker->set_frame_color (tl::Color (color));
}
static
@ -61,13 +61,13 @@ bool has_frame_color (const lay::DMarker *marker)
static
void reset_color (lay::DMarker *marker)
{
marker->set_color (lay::Color ());
marker->set_color (tl::Color ());
}
static
void set_color (lay::DMarker *marker, unsigned int color)
{
marker->set_color (lay::Color (color));
marker->set_color (tl::Color (color));
}
static

View File

@ -46,16 +46,16 @@ static void fill_with_qcolor (lay::PixelBuffer *pb, QColor c)
}
#endif
lay::color_t get_pixel_from_pixel_buffer (const lay::PixelBuffer *pb, unsigned int x, unsigned int y)
tl::color_t get_pixel_from_pixel_buffer (const lay::PixelBuffer *pb, unsigned int x, unsigned int y)
{
if (x < pb->width () && y < pb->height ()) {
return pb->scan_line (y)[x];
} else {
return lay::color_t (0);
return tl::color_t (0);
}
}
void set_pixel_in_pixel_buffer (lay::PixelBuffer *pb, unsigned int x, unsigned int y, lay::color_t c)
void set_pixel_in_pixel_buffer (lay::PixelBuffer *pb, unsigned int x, unsigned int y, tl::color_t c)
{
if (! pb->transparent ()) {
c |= 0xff000000; // ensures that alpha is set properly even if not required

View File

@ -462,7 +462,7 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
std::vector<lay::ViewOp> view_ops;
std::vector<const lay::Bitmap *> pbitmaps;
std::vector<std::pair <lay::color_t, lay::color_t> > masks;
std::vector<std::pair <tl::color_t, tl::color_t> > masks;
std::vector<uint32_t> non_empty_sls;
view_ops.reserve (n_in);
@ -588,13 +588,13 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
if (masks.size () > 0) {
lay::color_t *pt = (lay::color_t *) pimage->scan_line (height - 1 - y);
tl::color_t *pt = (tl::color_t *) pimage->scan_line (height - 1 - y);
uint32_t *dptr_end = dptr;
unsigned int i = 0;
for (unsigned int x = 0; x < width; x += 32, ++i) {
lay::color_t y[32];
tl::color_t y[32];
if (transparent) {
for (int i = 0; i < 32; ++i) {
y[i] = 0;
@ -605,7 +605,7 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
}
};
lay::color_t z[32] = {
tl::color_t z[32] = {
lay::wordones, lay::wordones, lay::wordones, lay::wordones,
lay::wordones, lay::wordones, lay::wordones, lay::wordones,
lay::wordones, lay::wordones, lay::wordones, lay::wordones,
@ -700,7 +700,7 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
std::vector<lay::ViewOp> view_ops;
std::vector<const lay::Bitmap *> pbitmaps;
std::vector<std::pair <lay::color_t, lay::color_t> > masks;
std::vector<std::pair <tl::color_t, tl::color_t> > masks;
std::vector<uint32_t> non_empty_sls;
view_ops.reserve (n_in);
@ -825,7 +825,7 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
if (masks.size () > 0) {
lay::color_t *pt = (lay::color_t *) pimage->scan_line (height - 1 - y);
tl::color_t *pt = (tl::color_t *) pimage->scan_line (height - 1 - y);
uint32_t *dptr_end = dptr;
unsigned int i = 0;

View File

@ -87,7 +87,7 @@ ColorPalette::ColorPalette ()
// .. nothing yet ..
}
ColorPalette::ColorPalette (const std::vector<lay::color_t> &colors, const std::vector<unsigned int> &luminous_colors)
ColorPalette::ColorPalette (const std::vector<tl::color_t> &colors, const std::vector<unsigned int> &luminous_colors)
: m_colors (colors), m_luminous_color_indices (luminous_colors)
{
// .. nothing yet ..
@ -115,7 +115,7 @@ ColorPalette::operator== (const ColorPalette &d) const
return m_colors == d.m_colors && m_luminous_color_indices == d.m_luminous_color_indices;
}
lay::color_t
tl::color_t
ColorPalette::color_by_index (unsigned int n) const
{
return m_colors [n % colors ()];
@ -140,7 +140,7 @@ ColorPalette::luminous_colors () const
}
void
ColorPalette::set_color (unsigned int n, lay::color_t c)
ColorPalette::set_color (unsigned int n, tl::color_t c)
{
while (m_colors.size () <= n) {
m_colors.push_back (0);
@ -180,7 +180,7 @@ ColorPalette::to_string () const
res += " ";
}
lay::color_t c = m_colors [i];
tl::color_t c = m_colors [i];
res += tl::sprintf ("%d,%d,%d", (c >> 16) & 0xff, (c >> 8) & 0xff, c & 0xff);
for (unsigned int j = 0; j < m_luminous_color_indices.size (); ++j) {
@ -217,7 +217,7 @@ ColorPalette::from_string (const std::string &s, bool simple)
}
x.expect (",").read (g).expect (",").read (b);
m_colors.push_back (0xff000000 | (lay::color_t (r & 0xff) << 16) | (lay::color_t (g & 0xff) << 8) | lay::color_t (b & 0xff));
m_colors.push_back (0xff000000 | (tl::color_t (r & 0xff) << 16) | (tl::color_t (g & 0xff) << 8) | tl::color_t (b & 0xff));
if (x.test ("[")) {
x.read (lc).expect ("]");

View File

@ -51,7 +51,7 @@ public:
* @param color The colors as a vector
* @param luminous_colors The list of indices of luminous colors as a vector
*/
ColorPalette (const std::vector<lay::color_t> &colors, const std::vector<unsigned int> &luminous_colors);
ColorPalette (const std::vector<tl::color_t> &colors, const std::vector<unsigned int> &luminous_colors);
/**
* @brief Copy constructor
@ -79,7 +79,7 @@ public:
/**
* @brief Change a specific color
*/
void set_color (unsigned int n, lay::color_t c);
void set_color (unsigned int n, tl::color_t c);
/**
* @brief Clear the colors list
@ -99,7 +99,7 @@ public:
/**
* @brief Retrieve the color by index
*/
lay::color_t color_by_index (unsigned int n) const;
tl::color_t color_by_index (unsigned int n) const;
/**
* @brief Retrieve the number of colors in the palette
@ -111,7 +111,7 @@ public:
/**
* @brief Retrieve the luminous color by index
*/
lay::color_t
tl::color_t
luminous_color_by_index (unsigned int n) const
{
return color_by_index (luminous_color_index_by_index (n));
@ -157,7 +157,7 @@ public:
static ColorPalette default_palette ();
private:
std::vector <lay::color_t> m_colors;
std::vector <tl::color_t> m_colors;
std::vector <unsigned int> m_luminous_color_indices;
};

View File

@ -44,7 +44,7 @@ ColorConverter::to_string (const QColor &c) const
#endif
std::string
ColorConverter::to_string (const lay::Color &c) const
ColorConverter::to_string (const tl::Color &c) const
{
if (! c.is_valid ()) {
return "auto";
@ -67,13 +67,13 @@ ColorConverter::from_string (const std::string &s, QColor &c) const
#endif
void
ColorConverter::from_string (const std::string &s, lay::Color &c) const
ColorConverter::from_string (const std::string &s, tl::Color &c) const
{
std::string t (tl::trim (s));
if (t == "auto") {
c = lay::Color ();
c = tl::Color ();
} else {
c = lay::Color (t);
c = tl::Color (t);
}
}

View File

@ -25,7 +25,7 @@
#define HDR_layConverters
#include "laybasicCommon.h"
#include "layColor.h"
#include "tlColor.h"
#if defined(HAVE_QT)
# include <QColor>
@ -43,8 +43,8 @@ struct LAYBASIC_PUBLIC ColorConverter
std::string to_string (const QColor &c) const;
void from_string (const std::string &s, QColor &c) const;
#endif
std::string to_string (const lay::Color &c) const;
void from_string (const std::string &s, lay::Color &c) const;
std::string to_string (const tl::Color &c) const;
void from_string (const std::string &s, tl::Color &c) const;
};
}

View File

@ -121,7 +121,7 @@ public:
/**
* @brief Get the current appearance
*/
virtual std::vector <lay::ViewOp> get_view_ops (lay::RedrawThreadCanvas &canvas, lay::Color background, lay::Color foreground, lay::Color active) const = 0;
virtual std::vector <lay::ViewOp> get_view_ops (lay::RedrawThreadCanvas &canvas, tl::Color background, tl::Color foreground, tl::Color active) const = 0;
private:
unsigned int m_num_planes;

View File

@ -63,7 +63,7 @@ public:
uint32_t cursor_color (lay::ViewObjectCanvas &canvas) const
{
lay::Color color;
tl::Color color;
if (mp_service) {
color = mp_service->tracking_cursor_color ();
}
@ -267,7 +267,7 @@ EditorServiceBase::configure (const std::string &name, const std::string &value)
if (name == cfg_tracking_cursor_color) {
lay::Color color;
tl::Color color;
lay::ColorConverter ().from_string (value, color);
if (color != m_cursor_color) {

View File

@ -92,7 +92,7 @@ public:
/**
* @brief Gets the tracking cursor color
*/
lay::Color tracking_cursor_color () const
tl::Color tracking_cursor_color () const
{
return m_cursor_color;
}
@ -133,7 +133,7 @@ protected:
private:
// The marker representing the mouse cursor
std::vector<lay::ViewObject *> m_mouse_cursor_markers;
lay::Color m_cursor_color;
tl::Color m_cursor_color;
bool m_cursor_enabled;
bool m_has_tracking_position;
db::DPoint m_tracking_position;

View File

@ -48,8 +48,8 @@ namespace lay
* All channels are scaled the same way in order not to change the
* color but the brightness alone.
*/
color_t
LayerProperties::brighter (color_t in, int x)
tl::color_t
LayerProperties::brighter (tl::color_t in, int x)
{
// shortcut for no correction
if (x == 0) {
@ -248,25 +248,25 @@ LayerProperties::is_visual () const
return valid (true) && visible (true) && (layer_index () >= 0 || is_cell_box_layer ());
}
color_t
tl::color_t
LayerProperties::eff_frame_color (bool real) const
{
return brighter (frame_color (real) & 0xffffff, frame_brightness (real));
}
color_t
tl::color_t
LayerProperties::eff_fill_color (bool real) const
{
return brighter (fill_color (real) & 0xffffff, fill_brightness (real));
}
color_t
tl::color_t
LayerProperties::eff_frame_color_brighter (bool real, int plus_brightness) const
{
return brighter (frame_color (real) & 0xffffff, frame_brightness (real) + plus_brightness);
}
color_t
tl::color_t
LayerProperties::eff_fill_color_brighter (bool real, int plus_brightness) const
{
return brighter (fill_color (real) & 0xffffff, fill_brightness (real) + plus_brightness);
@ -1645,21 +1645,21 @@ LayerPropertiesList::back () const
struct UIntColorConverter
: private ColorConverter
{
std::string to_string (const color_t &c) const
std::string to_string (const tl::color_t &c) const
{
if (c == 0) {
return "";
} else {
return ColorConverter::to_string (lay::Color (c | 0xff000000));
return ColorConverter::to_string (tl::Color (c | 0xff000000));
}
}
void from_string (const std::string &s, color_t &c) const
void from_string (const std::string &s, tl::color_t &c) const
{
if (s.empty ()) {
c = 0;
} else {
lay::Color qc;
tl::Color qc;
ColorConverter::from_string (s, qc);
c = qc.rgb () | 0xff000000;
}
@ -1767,8 +1767,8 @@ struct LineStyleIndexConverter
static const tl::XMLElementList layer_element = tl::XMLElementList (
// HINT: these make_member calls want to be qualified: otherwise an internal error
// was observed ..
tl::make_member<lay::color_t, LayerPropertiesNode> (&LayerPropertiesNode::frame_color_loc, &LayerPropertiesNode::set_frame_color_code, "frame-color", UIntColorConverter ()) +
tl::make_member<lay::color_t, LayerPropertiesNode> (&LayerPropertiesNode::fill_color_loc, &LayerPropertiesNode::set_fill_color_code, "fill-color", UIntColorConverter ()) +
tl::make_member<tl::color_t, LayerPropertiesNode> (&LayerPropertiesNode::frame_color_loc, &LayerPropertiesNode::set_frame_color_code, "frame-color", UIntColorConverter ()) +
tl::make_member<tl::color_t, LayerPropertiesNode> (&LayerPropertiesNode::fill_color_loc, &LayerPropertiesNode::set_fill_color_code, "fill-color", UIntColorConverter ()) +
tl::make_member<int, LayerPropertiesNode> (&LayerPropertiesNode::frame_brightness_loc, &LayerPropertiesNode::set_frame_brightness, "frame-brightness") +
tl::make_member<int, LayerPropertiesNode> (&LayerPropertiesNode::fill_brightness_loc, &LayerPropertiesNode::set_fill_brightness, "fill-brightness") +
tl::make_member<int, LayerPropertiesNode> (&LayerPropertiesNode::dither_pattern_loc, &LayerPropertiesNode::set_dither_pattern, "dither-pattern", DitherPatternIndexConverter ()) +

View File

@ -137,7 +137,7 @@ public:
/**
* @brief Utility: compute the effective color from a color with brightness correction
*/
static color_t brighter (color_t in, int b);
static tl::color_t brighter (tl::color_t in, int b);
/**
* @brief render the effective frame color
@ -145,7 +145,7 @@ public:
* The effective frame color is computed from the frame color brightness and the
* frame color.
*/
color_t eff_frame_color (bool real) const;
tl::color_t eff_frame_color (bool real) const;
/**
* @brief render the effective fill color
@ -153,7 +153,7 @@ public:
* The effective fill color is computed from the frame color brightness and the
* frame color.
*/
color_t eff_fill_color (bool real) const;
tl::color_t eff_fill_color (bool real) const;
/**
* @brief render the effective frame color plus an additional brightness adjustment
@ -161,7 +161,7 @@ public:
* This method returns the effective frame color with an additional brightness adjustment
* applied.
*/
color_t eff_frame_color_brighter (bool real, int plus_brightness) const;
tl::color_t eff_frame_color_brighter (bool real, int plus_brightness) const;
/**
* @brief render the effective frame color plus an additional brightness adjustment
@ -169,14 +169,14 @@ public:
* This method returns the effective fill color with an additional brightness adjustment
* applied.
*/
color_t eff_fill_color_brighter (bool real, int plus_brightness) const;
tl::color_t eff_fill_color_brighter (bool real, int plus_brightness) const;
/**
* @brief Get the frame color
*
* This method may return an invalid color if the color is not set.
*/
color_t frame_color (bool real) const
tl::color_t frame_color (bool real) const
{
if (real) {
ensure_visual_realized ();
@ -193,7 +193,7 @@ public:
* To clear the frame color, pass 0 to this method. Valid colors have the
* upper 8 bits set.
*/
void set_frame_color_code (color_t c)
void set_frame_color_code (tl::color_t c)
{
refresh ();
if (m_frame_color != c) {
@ -205,7 +205,7 @@ public:
/**
* @brief Set the frame color to the given value
*/
void set_frame_color (color_t c)
void set_frame_color (tl::color_t c)
{
set_frame_color_code (c | 0xff000000);
}
@ -231,7 +231,7 @@ public:
*
* This method may return an invalid color if the color is not set.
*/
color_t fill_color (bool real) const
tl::color_t fill_color (bool real) const
{
if (real) {
ensure_visual_realized ();
@ -248,7 +248,7 @@ public:
* To clear the fill color, pass 0 to this method. Valid colors have the
* upper 8 bits set.
*/
void set_fill_color_code (color_t c)
void set_fill_color_code (tl::color_t c)
{
refresh ();
if (m_fill_color != c) {
@ -260,7 +260,7 @@ public:
/**
* @brief Set the fill color to the given value
*/
void set_fill_color (color_t c)
void set_fill_color (tl::color_t c)
{
set_fill_color_code (c | 0xff000000);
}
@ -844,8 +844,8 @@ public:
/**
* @brief Adaptors required for the XML reader
*/
color_t frame_color_loc () const { return frame_color (false); }
color_t fill_color_loc () const { return fill_color (false); }
tl::color_t frame_color_loc () const { return frame_color (false); }
tl::color_t fill_color_loc () const { return fill_color (false); }
int frame_brightness_loc () const { return frame_brightness (false); }
int fill_brightness_loc () const { return fill_brightness (false); }
int dither_pattern_loc () const { return dither_pattern (false); }
@ -928,10 +928,10 @@ private:
// the generation number
size_t m_gen_id;
// display styles
color_t m_frame_color;
mutable color_t m_frame_color_real;
color_t m_fill_color;
mutable color_t m_fill_color_real;
tl::color_t m_frame_color;
mutable tl::color_t m_frame_color_real;
tl::color_t m_fill_color;
mutable tl::color_t m_fill_color_real;
int m_frame_brightness;
mutable int m_frame_brightness_real;
int m_fill_brightness;

View File

@ -291,7 +291,7 @@ LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view)
m_do_end_of_drawing_dm (this, &LayoutCanvas::do_end_of_drawing),
m_image_cache_size (1)
{
lay::Color bg (0xffffffff), fg (0xff000000), active (0xffc0c0c0);
tl::Color bg (0xffffffff), fg (0xff000000), active (0xffc0c0c0);
#if defined(HAVE_QT)
if (widget ()) {
@ -303,9 +303,9 @@ LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view)
widget ()->setObjectName (QString::fromUtf8 ("canvas"));
widget ()->setBackgroundRole (QPalette::NoRole);
bg = lay::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Window).rgb ());
fg = lay::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Text).rgb ());
active = lay::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Mid).rgb ());
bg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Window).rgb ());
fg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Text).rgb ());
active = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Mid).rgb ());
widget ()->setAttribute (Qt::WA_NoSystemBackground);
@ -393,7 +393,7 @@ LayoutCanvas::set_oversampling (unsigned int os)
}
void
LayoutCanvas::set_colors (lay::Color background, lay::Color foreground, lay::Color active)
LayoutCanvas::set_colors (tl::Color background, tl::Color foreground, tl::Color active)
{
m_background = background.rgb ();
m_foreground = foreground.rgb ();
@ -712,7 +712,7 @@ class DetachedViewObjectCanvas
: public BitmapViewObjectCanvas
{
public:
DetachedViewObjectCanvas (lay::Color bg, lay::Color fg, lay::Color ac, unsigned int width_l, unsigned int height_l, double resolution, lay::PixelBuffer *img)
DetachedViewObjectCanvas (tl::Color bg, tl::Color fg, tl::Color ac, unsigned int width_l, unsigned int height_l, double resolution, lay::PixelBuffer *img)
: BitmapViewObjectCanvas (width_l, height_l, resolution),
m_bg (bg), m_fg (fg), m_ac (ac), mp_image (img)
{
@ -738,17 +738,17 @@ public:
}
}
lay::Color background_color () const
tl::Color background_color () const
{
return m_bg;
}
lay::Color foreground_color () const
tl::Color foreground_color () const
{
return m_fg;
}
lay::Color active_color () const
tl::Color active_color () const
{
return m_ac;
}
@ -780,7 +780,7 @@ public:
}
private:
lay::Color m_bg, m_fg, m_ac;
tl::Color m_bg, m_fg, m_ac;
lay::PixelBuffer *mp_image;
lay::PixelBuffer *mp_image_l;
double m_gamma;
@ -809,17 +809,17 @@ public:
clear_fg_bitmaps ();
}
lay::Color background_color () const
tl::Color background_color () const
{
return m_bg ? 0xffffffff : 0;
}
lay::Color foreground_color () const
tl::Color foreground_color () const
{
return m_fg ? 0xffffffff : 0;
}
lay::Color active_color () const
tl::Color active_color () const
{
return m_ac ? 0xffffffff : 0;
}
@ -831,11 +831,11 @@ private:
lay::PixelBuffer
LayoutCanvas::image (unsigned int width, unsigned int height)
{
return image_with_options (width, height, -1, -1, -1.0, lay::Color (), lay::Color (), lay::Color (), db::DBox ());
return image_with_options (width, height, -1, -1, -1.0, tl::Color (), tl::Color (), tl::Color (), db::DBox ());
}
lay::PixelBuffer
LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box)
LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box)
{
if (oversampling <= 0) {
oversampling = m_oversampling;
@ -911,7 +911,7 @@ LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int l
}
lay::BitmapBuffer
LayoutCanvas::image_with_options_mono (unsigned int width, unsigned int height, int linewidth, lay::Color background_c, lay::Color foreground_c, lay::Color active_c, const db::DBox &target_box)
LayoutCanvas::image_with_options_mono (unsigned int width, unsigned int height, int linewidth, tl::Color background_c, tl::Color foreground_c, tl::Color active_c, const db::DBox &target_box)
{
if (linewidth <= 0) {
linewidth = 1;

View File

@ -31,7 +31,7 @@
#include "layViewOp.h"
#include "layViewObject.h"
#include "layBitmap.h"
#include "layColor.h"
#include "tlColor.h"
#include "layDrawing.h"
#include "layDitherPattern.h"
#include "layLineStyles.h"
@ -143,7 +143,7 @@ public:
LayoutCanvas (lay::LayoutViewBase *view);
~LayoutCanvas ();
void set_colors (lay::Color background, lay::Color foreground, lay::Color active);
void set_colors (tl::Color background, tl::Color foreground, tl::Color active);
/**
* @brief Set the view ops for the layers
@ -166,8 +166,8 @@ public:
lay::PixelBuffer screenshot ();
lay::PixelBuffer image (unsigned int width, unsigned int height);
lay::PixelBuffer image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, lay::Color background, lay::Color foreground, lay::Color active_color, const db::DBox &target_box);
lay::BitmapBuffer image_with_options_mono (unsigned int width, unsigned int height, int linewidth, lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box);
lay::PixelBuffer image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, tl::Color background, tl::Color foreground, tl::Color active_color, const db::DBox &target_box);
lay::BitmapBuffer image_with_options_mono (unsigned int width, unsigned int height, int linewidth, tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box);
void update_image ();
@ -288,25 +288,25 @@ public:
/**
* @brief Reimplementation of ViewObjectCanvas: Background color
*/
lay::Color background_color () const
tl::Color background_color () const
{
return lay::Color (m_background);
return tl::Color (m_background);
}
/**
* @brief Reimplementation of ViewObjectCanvas: Foreground color
*/
lay::Color foreground_color () const
tl::Color foreground_color () const
{
return lay::Color (m_foreground);
return tl::Color (m_foreground);
}
/**
* @brief Reimplementation of ViewObjectCanvas: Active color
*/
lay::Color active_color () const
tl::Color active_color () const
{
return lay::Color (m_active);
return tl::Color (m_active);
}
/**
@ -363,9 +363,9 @@ private:
lay::PixelBuffer *mp_image_fg;
db::DBox m_precious_box;
lay::Viewport m_viewport, m_viewport_l;
lay::color_t m_background;
lay::color_t m_foreground;
lay::color_t m_active;
tl::color_t m_background;
tl::color_t m_foreground;
tl::color_t m_active;
std::vector <lay::ViewOp> m_view_ops;
lay::DitherPattern m_dither_pattern;
lay::LineStyles m_line_styles;

View File

@ -327,7 +327,7 @@ LayoutViewBase::init (db::Manager *mgr)
m_paste_display_mode = 2;
m_guiding_shape_visible = true;
m_guiding_shape_line_width = 1;
m_guiding_shape_color = lay::Color ();
m_guiding_shape_color = tl::Color ();
m_guiding_shape_vertex_size = 5;
m_to_level = 0;
m_ctx_dimming = 50;
@ -713,7 +713,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_background_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
background_color (color);
// do not take - let others receive the background color events as well
@ -758,7 +758,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_ctx_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
ctx_color (color);
return true;
@ -779,7 +779,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_child_ctx_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
child_ctx_color (color);
return true;
@ -863,14 +863,14 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_cell_box_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
cell_box_color (color);
return true;
} else if (name == cfg_text_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
text_color (color);
return true;
@ -989,14 +989,14 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_guiding_shape_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
guiding_shapes_color (color);
return true;
} else if (name == cfg_guiding_shape_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
guiding_shapes_color (color);
return true;
@ -1151,7 +1151,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_sel_color) {
lay::Color color;
tl::Color color;
lay::ColorConverter ().from_string (value, color);
// Change the color
@ -2503,7 +2503,7 @@ LayoutViewBase::init_layer_properties (LayerProperties &p) const
void
LayoutViewBase::init_layer_properties (LayerProperties &p, const LayerPropertiesList &lp_list) const
{
lay::color_t c = 0;
tl::color_t c = 0;
if (m_palette.luminous_colors () > 0) {
c = m_palette.luminous_color_by_index (p.source (true /*real*/).color_index ());
}
@ -2638,7 +2638,7 @@ LayoutViewBase::get_pixels (unsigned int width, unsigned int height)
#if defined(HAVE_QT)
QImage
LayoutViewBase::get_image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution,
lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box, bool monochrome)
tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box, bool monochrome)
{
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Get image")));
@ -2655,7 +2655,7 @@ LayoutViewBase::get_image_with_options (unsigned int width, unsigned int height,
lay::PixelBuffer
LayoutViewBase::get_pixels_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution,
lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box)
tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box)
{
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Get image")));
@ -2667,7 +2667,7 @@ LayoutViewBase::get_pixels_with_options (unsigned int width, unsigned int height
lay::BitmapBuffer
LayoutViewBase::get_pixels_with_options_mono (unsigned int width, unsigned int height, int linewidth,
lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box)
tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box)
{
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Get image")));
@ -2731,7 +2731,7 @@ LayoutViewBase::save_image (const std::string &, unsigned int, unsigned int)
void
LayoutViewBase::save_image_with_options (const std::string &fn,
unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution,
lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box, bool monochrome)
tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box, bool monochrome)
{
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Save image")));
@ -2762,7 +2762,7 @@ LayoutViewBase::save_image_with_options (const std::string &fn,
void
LayoutViewBase::save_image_with_options (const std::string &fn,
unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution,
lay::Color background, lay::Color foreground, lay::Color active, const db::DBox &target_box, bool monochrome)
tl::Color background, tl::Color foreground, tl::Color active, const db::DBox &target_box, bool monochrome)
{
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Save image")));
@ -2793,7 +2793,7 @@ LayoutViewBase::save_image_with_options (const std::string &fn,
void
LayoutViewBase::save_image_with_options (const std::string &,
unsigned int, unsigned int, int, int, double,
lay::Color, lay::Color, lay::Color, const db::DBox &, bool)
tl::Color, tl::Color, tl::Color, const db::DBox &, bool)
{
throw tl::Exception (tl::to_string (tr ("Unable to save image - PNG library not compiled in")));
}
@ -3795,7 +3795,7 @@ LayoutViewBase::set_view_ops ()
std::vector <lay::ViewOp> view_ops;
view_ops.reserve (nlayers * planes_per_layer + special_planes_before + special_planes_after);
lay::Color box_color;
tl::Color box_color;
if (! m_box_color.is_valid ()) {
box_color = mp_canvas->foreground_color ();
} else {
@ -3854,7 +3854,7 @@ LayoutViewBase::set_view_ops ()
// produce the ViewOps for the guiding shapes
color_t gs_color = box_color.rgb ();
tl::color_t gs_color = box_color.rgb ();
if (m_guiding_shape_color.is_valid ()) {
gs_color = m_guiding_shape_color.rgb ();
}
@ -3863,7 +3863,7 @@ LayoutViewBase::set_view_ops ()
lay::ViewOp::Mode mode = lay::ViewOp::Copy;
color_t fill_color, frame_color, text_color;
tl::color_t fill_color, frame_color, text_color;
int dp = 1; // no stipples for guiding shapes
if (ctx == 0) {
@ -3978,7 +3978,7 @@ LayoutViewBase::set_view_ops ()
}
}
color_t fill_color, frame_color, text_color;
tl::color_t fill_color, frame_color, text_color;
int dp = m_no_stipples ? 1 : l->dither_pattern (true /*real*/);
int ls = l->line_style (true /*real*/);
@ -4081,7 +4081,7 @@ LayoutViewBase::guiding_shapes_visible (bool v)
}
void
LayoutViewBase::guiding_shapes_color (lay::Color c)
LayoutViewBase::guiding_shapes_color (tl::Color c)
{
if (c != m_guiding_shape_color) {
m_guiding_shape_color = c;
@ -4144,7 +4144,7 @@ LayoutViewBase::drop_small_cells_cond (drop_small_cells_cond_type t)
}
void
LayoutViewBase::cell_box_color (lay::Color c)
LayoutViewBase::cell_box_color (tl::Color c)
{
if (c != m_box_color) {
m_box_color = c;
@ -4266,7 +4266,7 @@ LayoutViewBase::set_palette (const lay::LineStylePalette &p)
}
void
LayoutViewBase::ctx_color (lay::Color c)
LayoutViewBase::ctx_color (tl::Color c)
{
if (c != m_ctx_color) {
m_ctx_color = c;
@ -4293,7 +4293,7 @@ LayoutViewBase::ctx_hollow (bool h)
}
void
LayoutViewBase::child_ctx_color (lay::Color c)
LayoutViewBase::child_ctx_color (tl::Color c)
{
if (c != m_child_ctx_color) {
m_child_ctx_color = c;
@ -4349,20 +4349,20 @@ LayoutViewBase::abstract_mode_enabled (bool e)
}
}
lay::Color
tl::Color
LayoutViewBase::default_background_color ()
{
return lay::Color (0, 0, 0); // black.
return tl::Color (0, 0, 0); // black.
}
void
LayoutViewBase::do_set_background_color (lay::Color /*color*/, lay::Color /*contrast*/)
LayoutViewBase::do_set_background_color (tl::Color /*color*/, tl::Color /*contrast*/)
{
// .. nothing yet ..
}
void
LayoutViewBase::background_color (lay::Color c)
LayoutViewBase::background_color (tl::Color c)
{
if (c == mp_canvas->background_color ()) {
return;
@ -4373,11 +4373,11 @@ LayoutViewBase::background_color (lay::Color c)
c = default_background_color ();
}
lay::Color contrast;
tl::Color contrast;
if (c.to_mono ()) {
contrast = lay::Color (0, 0, 0);
contrast = tl::Color (0, 0, 0);
} else {
contrast = lay::Color (255, 255, 255);
contrast = tl::Color (255, 255, 255);
}
do_set_background_color (c, contrast);
@ -4987,7 +4987,7 @@ LayoutViewBase::show_markers (bool f)
}
void
LayoutViewBase::text_color (lay::Color c)
LayoutViewBase::text_color (tl::Color c)
{
if (m_text_color != c) {
m_text_color = c;

View File

@ -123,7 +123,7 @@ struct LAYBASIC_PUBLIC LayerDisplayProperties
* The effective frame color is computed from the frame color brightness and the
* frame color.
*/
color_t eff_frame_color () const;
tl::color_t eff_frame_color () const;
/**
* @brief render the effective frame color
@ -131,11 +131,11 @@ struct LAYBASIC_PUBLIC LayerDisplayProperties
* The effective frame color is computed from the frame color brightness and the
* frame color.
*/
color_t eff_fill_color () const;
tl::color_t eff_fill_color () const;
// display styles
color_t frame_color;
color_t fill_color;
tl::color_t frame_color;
tl::color_t fill_color;
int frame_brightness;
int fill_brightness;
unsigned int dither_pattern;
@ -855,13 +855,13 @@ public:
* @param linewidth The width of a line in pixels (usually 1) or 0 for default
* @param oversampling The oversampling factor (1..3) or 0 for default
* @param resolution The resolution (pixel size compared to a screen pixel size, i.e 1/oversampling) or 0 for default
* @param background The background color or lay::Color() for default
* @param foreground The foreground color or lay::Color() for default
* @param active The active color or lay::Color() for default
* @param background The background color or tl::Color() for default
* @param foreground The foreground color or tl::Color() for default
* @param active The active color or tl::Color() for default
* @param target_box The box to draw or db::DBox() for default
* @param monochrome If true, monochrome images will be produced
*/
void save_image_with_options (const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, Color background, Color foreground, Color active_color, const db::DBox &target_box, bool monochrome);
void save_image_with_options (const std::string &fn, unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, tl::Color background, tl::Color foreground, tl::Color active_color, const db::DBox &target_box, bool monochrome);
#if defined(HAVE_QT)
/**
@ -884,13 +884,13 @@ public:
* @param linewidth The width of a line in pixels (usually 1) or 0 for default
* @param oversampling The oversampling factor (1..3) or 0 for default
* @param resolution The resolution (pixel size compared to a screen pixel size, i.e 1/oversampling) or 0 for default
* @param background The background color or lay::Color() for default
* @param foreground The foreground color or lay::Color() for default
* @param active The active color or lay::Color() for default
* @param background The background color or tl::Color() for default
* @param foreground The foreground color or tl::Color() for default
* @param active The active color or tl::Color() for default
* @param target_box The box to draw or db::DBox() for default
* @param monochrome If true, monochrome images will be produced
*/
QImage get_image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, lay::Color background, lay::Color foreground, lay::Color active_color, const db::DBox &target_box, bool monochrome);
QImage get_image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, tl::Color background, tl::Color foreground, tl::Color active_color, const db::DBox &target_box, bool monochrome);
#endif
/**
@ -901,12 +901,12 @@ public:
* @param linewidth The width of a line in pixels (usually 1) or 0 for default
* @param oversampling The oversampling factor (1..3) or 0 for default
* @param resolution The resolution (pixel size compared to a screen pixel size, i.e 1/oversampling) or 0 for default
* @param background The background color or lay::Color() for default
* @param foreground The foreground color or lay::Color() for default
* @param active The active color or lay::Color() for default
* @param background The background color or tl::Color() for default
* @param foreground The foreground color or tl::Color() for default
* @param active The active color or tl::Color() for default
* @param target_box The box to draw or db::DBox() for default
*/
lay::PixelBuffer get_pixels_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, lay::Color background, lay::Color foreground, lay::Color active_color, const db::DBox &target_box);
lay::PixelBuffer get_pixels_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, tl::Color background, tl::Color foreground, tl::Color active_color, const db::DBox &target_box);
/**
* @brief Get the screen content as a monochrome lay::BitmapBuffer object with the given options
@ -916,14 +916,14 @@ public:
* @param linewidth The width of a line in pixels (usually 1) or 0 for default
* @param oversampling The oversampling factor (1..3) or 0 for default
* @param resolution The resolution (pixel size compared to a screen pixel size, i.e 1/oversampling) or 0 for default
* @param background The background color or lay::Color() for default
* @param foreground The foreground color or lay::Color() for default
* @param active The active color or lay::Color() for default
* @param background The background color or tl::Color() for default
* @param foreground The foreground color or tl::Color() for default
* @param active The active color or tl::Color() for default
* @param target_box The box to draw or db::DBox() for default
*
* The colors will are converted to "on" pixels with a green channel value >= 50%.
*/
lay::BitmapBuffer get_pixels_with_options_mono (unsigned int width, unsigned int height, int linewidth, lay::Color background, lay::Color foreground, lay::Color active_color, const db::DBox &target_box);
lay::BitmapBuffer get_pixels_with_options_mono (unsigned int width, unsigned int height, int linewidth, tl::Color background, tl::Color foreground, tl::Color active_color, const db::DBox &target_box);
/**
* @brief Hierarchy level selection setter
@ -980,12 +980,12 @@ public:
/**
* @brief Cell box/label color setter
*/
void cell_box_color (lay::Color c);
void cell_box_color (tl::Color c);
/**
* @brief Cell box/label getter
*/
lay::Color cell_box_color () const
tl::Color cell_box_color () const
{
return m_box_color;
}
@ -1178,12 +1178,12 @@ public:
/**
* @brief Text object color
*/
void text_color (lay::Color c);
void text_color (tl::Color c);
/**
* @brief Text object color
*/
lay::Color text_color () const
tl::Color text_color () const
{
return m_text_color;
}
@ -1697,7 +1697,7 @@ public:
/**
* @brief Background color property
*/
lay::Color background_color () const
tl::Color background_color () const
{
return mp_canvas->background_color ();
}
@ -1705,7 +1705,7 @@ public:
/**
* @brief Foreground color property
*/
lay::Color foreground_color () const
tl::Color foreground_color () const
{
return mp_canvas->foreground_color ();
}
@ -1713,7 +1713,7 @@ public:
/**
* @brief Active color property
*/
lay::Color active_color () const
tl::Color active_color () const
{
return mp_canvas->active_color ();
}
@ -1773,7 +1773,7 @@ public:
/**
* @brief Gets the guiding shapes color
*/
lay::Color guiding_shapes_color () const
tl::Color guiding_shapes_color () const
{
return m_guiding_shape_color;
}
@ -1781,7 +1781,7 @@ public:
/**
* @brief Sets the guiding shapes color
*/
void guiding_shapes_color (lay::Color c);
void guiding_shapes_color (tl::Color c);
/**
* @brief Gets the guiding shapes line width
@ -2205,7 +2205,7 @@ public:
/**
* @brief Get the default color for markers
*/
lay::Color default_marker_color () const
tl::Color default_marker_color () const
{
return m_marker_color;
}
@ -2687,15 +2687,15 @@ private:
int m_paste_display_mode;
int m_wheel_mode;
bool m_guiding_shape_visible;
lay::Color m_guiding_shape_color;
tl::Color m_guiding_shape_color;
int m_guiding_shape_line_width;
int m_guiding_shape_vertex_size;
lay::Color m_ctx_color;
tl::Color m_ctx_color;
int m_ctx_dimming;
bool m_ctx_hollow;
lay::Color m_child_ctx_color;
tl::Color m_child_ctx_color;
int m_child_ctx_dimming;
bool m_child_ctx_hollow;
bool m_child_ctx_enabled;
@ -2703,13 +2703,13 @@ private:
double m_abstract_mode_width;
bool m_abstract_mode_enabled;
lay::Color m_box_color;
tl::Color m_box_color;
bool m_box_text_transform;
unsigned int m_box_font;
int m_min_size_for_label;
bool m_cell_box_visible;
lay::Color m_marker_color;
tl::Color m_marker_color;
int m_marker_line_width;
int m_marker_vertex_size;
int m_marker_dither_pattern;
@ -2727,7 +2727,7 @@ private:
bool m_text_lazy_rendering;
bool m_bitmap_caching;
bool m_show_properties;
lay::Color m_text_color;
tl::Color m_text_color;
bool m_apply_text_trans;
double m_default_text_size;
unsigned int m_text_font;
@ -2797,11 +2797,11 @@ private:
void do_redraw ();
void set_view_ops ();
void background_color (lay::Color c);
void ctx_color (lay::Color c);
void background_color (tl::Color c);
void ctx_color (tl::Color c);
void ctx_dimming (int percent);
void ctx_hollow (bool h);
void child_ctx_color (lay::Color c);
void child_ctx_color (tl::Color c);
void child_ctx_dimming (int percent);
void child_ctx_hollow (bool h);
void child_ctx_enabled (bool e);
@ -2845,8 +2845,8 @@ protected:
void free_resources ();
void shutdown ();
virtual lay::Color default_background_color ();
virtual void do_set_background_color (lay::Color color, lay::Color contrast);
virtual tl::Color default_background_color ();
virtual void do_set_background_color (tl::Color color, tl::Color contrast);
virtual void do_paste ();
virtual void begin_layer_updates ();
virtual void end_layer_updates ();

View File

@ -196,7 +196,7 @@ MarkerBase::MarkerBase (lay::LayoutViewBase *view)
}
void
MarkerBase::set_frame_color (lay::Color color)
MarkerBase::set_frame_color (tl::Color color)
{
if (color != m_frame_color) {
m_frame_color = color;
@ -205,7 +205,7 @@ MarkerBase::set_frame_color (lay::Color color)
}
void
MarkerBase::set_color (lay::Color color)
MarkerBase::set_color (tl::Color color)
{
if (color != m_color) {
m_color = color;
@ -292,7 +292,7 @@ MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay:
int basic_width = int(0.5 + 1.0 / resolution);
// obtain bitmaps
lay::Color color = m_color;
tl::Color color = m_color;
if (! color.is_valid ()) {
color = mp_view->default_marker_color ();
}
@ -300,7 +300,7 @@ MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay:
color = canvas.foreground_color ();
}
lay::Color frame_color = m_frame_color;
tl::Color frame_color = m_frame_color;
if (! frame_color.is_valid ()) {
frame_color = color;
}

View File

@ -66,7 +66,7 @@ public:
*
* If the color is invalid, the marker is drawn with the canvases foreground color.
*/
lay::Color get_color () const
tl::Color get_color () const
{
return m_color;
}
@ -76,14 +76,14 @@ public:
*
* If the color is invalid, the marker is drawn with the canvases foreground color.
*/
void set_color (lay::Color color);
void set_color (tl::Color color);
/**
* @brief Get the color by which the marker's frame is drawn
*
* If the color is invalid, the marker's frame is drawn with the fill color.
*/
lay::Color get_frame_color () const
tl::Color get_frame_color () const
{
return m_frame_color;
}
@ -93,7 +93,7 @@ public:
*
* If the color is invalid, the marker's frame is drawn with the fill color.
*/
void set_frame_color (lay::Color color);
void set_frame_color (tl::Color color);
/**
* @brief Get the line width with which the marker is drawn
@ -226,8 +226,8 @@ public:
protected:
void get_bitmaps (const Viewport &vp, ViewObjectCanvas &canvas, lay::CanvasPlane *&fill, lay::CanvasPlane *&frame, lay::CanvasPlane *&vertex, lay::CanvasPlane *&text);
lay::Color m_color;
lay::Color m_frame_color;
tl::Color m_color;
tl::Color m_frame_color;
char m_line_width, m_vertex_size, m_halo;
bool m_text_enabled;
lay::ViewOp::Shape m_vertex_shape;

View File

@ -38,7 +38,7 @@ NetColorizer::NetColorizer ()
}
void
NetColorizer::configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors)
NetColorizer::configure (const tl::Color &marker_color, const lay::ColorPalette *auto_colors)
{
m_marker_color = marker_color;
if (auto_colors) {
@ -58,7 +58,7 @@ NetColorizer::has_color_for_net (const db::Net *net)
}
void
NetColorizer::set_color_of_net (const db::Net *net, const lay::Color &color)
NetColorizer::set_color_of_net (const db::Net *net, const tl::Color &color)
{
m_custom_color[net] = color;
emit_colors_changed ();
@ -110,14 +110,14 @@ NetColorizer::emit_colors_changed ()
}
}
lay::Color
tl::Color
NetColorizer::color_of_net (const db::Net *net) const
{
if (! net) {
return lay::Color ();
return tl::Color ();
}
std::map<const db::Net *, lay::Color>::const_iterator c = m_custom_color.find (net);
std::map<const db::Net *, tl::Color>::const_iterator c = m_custom_color.find (net);
if (c != m_custom_color.end ()) {
return c->second;
}
@ -146,7 +146,7 @@ NetColorizer::color_of_net (const db::Net *net) const
return m_auto_colors.color_by_index ((unsigned int) index);
} else {
return lay::Color ();
return tl::Color ();
}
}

View File

@ -26,7 +26,7 @@
#include "laybasicCommon.h"
#include "layColorPalette.h"
#include "layColor.h"
#include "tlColor.h"
#include "tlEvents.h"
#include <map>
@ -49,15 +49,15 @@ class LAYBASIC_PUBLIC NetColorizer
public:
NetColorizer ();
void configure (const lay::Color &marker_color, const lay::ColorPalette *auto_colors);
void configure (const tl::Color &marker_color, const lay::ColorPalette *auto_colors);
bool has_color_for_net (const db::Net *net);
void set_color_of_net (const db::Net *net, const lay::Color &color);
void set_color_of_net (const db::Net *net, const tl::Color &color);
void reset_color_of_net (const db::Net *net);
void clear ();
lay::Color color_of_net (const db::Net *net) const;
tl::Color color_of_net (const db::Net *net) const;
const lay::Color &marker_color () const
const tl::Color &marker_color () const
{
return m_marker_color;
}
@ -68,10 +68,10 @@ public:
tl::Event colors_changed;
private:
lay::Color m_marker_color;
tl::Color m_marker_color;
lay::ColorPalette m_auto_colors;
bool m_auto_colors_enabled;
std::map<const db::Net *, lay::Color> m_custom_color;
std::map<const db::Net *, tl::Color> m_custom_color;
bool m_update_needed;
bool m_signals_enabled;
mutable std::map<const db::Net *, size_t> m_net_index_by_object;

View File

@ -113,7 +113,7 @@ static void flush_stream_f (png_structp png_ptr)
// -----------------------------------------------------------------------------------------------------
// PixelBuffer implementation
PixelBuffer::PixelBuffer (unsigned int w, unsigned int h, lay::color_t *data)
PixelBuffer::PixelBuffer (unsigned int w, unsigned int h, tl::color_t *data)
: m_data ()
{
m_width = w;
@ -122,18 +122,18 @@ PixelBuffer::PixelBuffer (unsigned int w, unsigned int h, lay::color_t *data)
m_data.reset (new ImageData (data, w * h));
}
PixelBuffer::PixelBuffer (unsigned int w, unsigned int h, const lay::color_t *data, unsigned int stride)
PixelBuffer::PixelBuffer (unsigned int w, unsigned int h, const tl::color_t *data, unsigned int stride)
: m_data ()
{
m_width = w;
m_height = h;
m_transparent = false;
tl_assert ((stride % sizeof (lay::color_t)) == 0);
stride /= sizeof (lay::color_t);
tl_assert ((stride % sizeof (tl::color_t)) == 0);
stride /= sizeof (tl::color_t);
lay::color_t *d = new lay::color_t [w * h];
lay::color_t *new_data = d;
tl::color_t *d = new tl::color_t [w * h];
tl::color_t *new_data = d;
if (data) {
for (unsigned int i = 0; i < h; ++i) {
@ -181,11 +181,11 @@ PixelBuffer::operator== (const PixelBuffer &other) const
return false;
}
lay::color_t m = transparent () ? 0xffffffff : 0xffffff;
tl::color_t m = transparent () ? 0xffffffff : 0xffffff;
for (unsigned int i = 0; i < other.height (); ++i) {
const lay::color_t *d = scan_line (i);
const lay::color_t *de = d + width ();
const lay::color_t *dd = other.scan_line (i);
const tl::color_t *d = scan_line (i);
const tl::color_t *de = d + width ();
const tl::color_t *dd = other.scan_line (i);
while (d != de) {
if (((*d++ ^ *dd++) & m) != 0) {
return false;
@ -239,13 +239,13 @@ PixelBuffer::swap (PixelBuffer &other)
}
void
PixelBuffer::fill (lay::color_t c)
PixelBuffer::fill (tl::color_t c)
{
if (! transparent ()) {
c |= 0xff000000; // ensures that alpha is properly set
}
color_t *d = data ();
tl::color_t *d = data ();
for (unsigned int i = 0; i < m_height; ++i) {
for (unsigned int j = 0; j < m_width; ++j) {
*d++ = c;
@ -253,27 +253,27 @@ PixelBuffer::fill (lay::color_t c)
}
}
color_t *
tl::color_t *
PixelBuffer::scan_line (unsigned int n)
{
tl_assert (n < m_height);
return m_data->data () + n * m_width;
}
const color_t *
const tl::color_t *
PixelBuffer::scan_line (unsigned int n) const
{
tl_assert (n < m_height);
return m_data->data () + n * m_width;
}
color_t *
tl::color_t *
PixelBuffer::data ()
{
return m_data->data ();
}
const color_t *
const tl::color_t *
PixelBuffer::data () const
{
return m_data->data ();
@ -303,9 +303,9 @@ PixelBuffer::from_image (const QImage &img)
{
if (img.format () != QImage::Format_ARGB32 && img.format () != QImage::Format_RGB32) {
QImage img_argb32 = img.convertToFormat (QImage::Format_ARGB32);
return PixelBuffer (img_argb32.width (), img_argb32.height (), (const lay::color_t *) img_argb32.bits ());
return PixelBuffer (img_argb32.width (), img_argb32.height (), (const tl::color_t *) img_argb32.bits ());
} else {
return PixelBuffer (img.width (), img.height (), (const lay::color_t *) img.bits ());
return PixelBuffer (img.width (), img.height (), (const tl::color_t *) img.bits ());
}
}
#endif
@ -317,11 +317,11 @@ PixelBuffer::patch (const PixelBuffer &other)
tl_assert (height () == other.height ());
tl_assert (other.transparent ());
const color_t *d = other.data ();
color_t *dd = data ();
const tl::color_t *d = other.data ();
tl::color_t *dd = data ();
for (unsigned int i = 0; i < m_height; ++i) {
for (unsigned int j = 0; j < m_width; ++j) {
color_t c = *d++;
tl::color_t c = *d++;
if ((c & 0x80000000) != 0) {
*dd = c;
}
@ -339,9 +339,9 @@ PixelBuffer::diff (const PixelBuffer &other) const
PixelBuffer res (m_width, m_height);
res.set_transparent (true);
const color_t *d2 = other.data ();
const color_t *d1 = data ();
color_t *dd = res.data ();
const tl::color_t *d2 = other.data ();
const tl::color_t *d1 = data ();
tl::color_t *dd = res.data ();
for (unsigned int i = 0; i < m_height; ++i) {
for (unsigned int j = 0; j < m_width; ++j) {
@ -373,7 +373,7 @@ PixelBuffer::read_png (tl::InputStream &input)
tl_assert (info_ptr != NULL);
png_set_read_fn (png_ptr, (void *) &input, &read_from_stream_f);
png_set_bgr (png_ptr); // compatible with lay::color_t
png_set_bgr (png_ptr); // compatible with tl::color_t
png_read_png (png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
@ -384,11 +384,11 @@ PixelBuffer::read_png (tl::InputStream &input)
if (fmt == PNG_COLOR_TYPE_RGBA && bd == 8) {
tl_assert (png_get_rowbytes (png_ptr, info_ptr) == res.width () * sizeof (lay::color_t));
tl_assert (png_get_rowbytes (png_ptr, info_ptr) == res.width () * sizeof (tl::color_t));
png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) {
memcpy ((void *) res.scan_line (i), (void *) row_pointers [i], sizeof (lay::color_t) * res.width ());
memcpy ((void *) res.scan_line (i), (void *) row_pointers [i], sizeof (tl::color_t) * res.width ());
}
res.set_transparent (true);
@ -402,13 +402,13 @@ PixelBuffer::read_png (tl::InputStream &input)
png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) {
lay::color_t *c = res.scan_line (i);
tl::color_t *c = res.scan_line (i);
const uint8_t *d = row_pointers [i];
const uint8_t *dd = d + rb;
while (d < dd) {
lay::color_t b = *d++;
lay::color_t g = *d++;
lay::color_t r = *d++;
tl::color_t b = *d++;
tl::color_t g = *d++;
tl::color_t r = *d++;
*c++ = 0xff000000 | ((r << 8 | g) << 8) | b;
}
}
@ -422,12 +422,12 @@ PixelBuffer::read_png (tl::InputStream &input)
png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) {
lay::color_t *c = res.scan_line (i);
tl::color_t *c = res.scan_line (i);
const uint8_t *d = row_pointers [i];
const uint8_t *dd = d + rb;
while (d < dd) {
lay::color_t g = *d++;
lay::color_t a = *d++;
tl::color_t g = *d++;
tl::color_t a = *d++;
*c++ = (a << 24) | ((g << 8 | g) << 8) | g;
}
}
@ -443,11 +443,11 @@ PixelBuffer::read_png (tl::InputStream &input)
png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) {
lay::color_t *c = res.scan_line (i);
tl::color_t *c = res.scan_line (i);
const uint8_t *d = row_pointers [i];
const uint8_t *dd = d + rb;
while (d < dd) {
lay::color_t g = *d++;
tl::color_t g = *d++;
*c++ = 0xff000000 | ((g << 8 | g) << 8) | g;
}
}
@ -477,7 +477,7 @@ PixelBuffer::write_png (tl::OutputStream &output) const
tl_assert (info_ptr != NULL);
png_set_write_fn (png_ptr, (void *) &output, &write_to_stream_f, &flush_stream_f);
png_set_bgr (png_ptr); // compatible with lay::color_t
png_set_bgr (png_ptr); // compatible with tl::color_t
unsigned int bd = 8; // bit depth
unsigned int fmt = transparent () ? PNG_COLOR_TYPE_RGBA : PNG_COLOR_TYPE_RGB;
@ -507,10 +507,10 @@ PixelBuffer::write_png (tl::OutputStream &output) const
for (unsigned int i = 0; i < height (); ++i) {
uint8_t *d = buffer.get ();
const lay::color_t *s = scan_line (i);
const lay::color_t *se = s + width ();
const tl::color_t *s = scan_line (i);
const tl::color_t *se = s + width ();
while (s != se) {
lay::color_t c = *s++;
tl::color_t c = *s++;
*d++ = c & 0xff;
c >>= 8;
*d++ = c & 0xff;

View File

@ -24,7 +24,7 @@
#define HDR_layPixelBuffer
#include "laybasicCommon.h"
#include "layColor.h"
#include "tlColor.h"
#include "tlCopyOnWrite.h"
#include "tlStream.h"
#include "tlException.h"
@ -65,7 +65,7 @@ public:
* @brief An 32bit RGB/RGBA image class
*
* This class substitutes QImage in Qt-less applications.
* It provides 32bit RGBA pixels with the format used by lay::Color.
* It provides 32bit RGBA pixels with the format used by tl::Color.
*/
class LAYBASIC_PUBLIC PixelBuffer
{
@ -78,7 +78,7 @@ public:
*
* The size of the data block needs to be w*h elements.
*/
PixelBuffer (unsigned int w, unsigned int h, lay::color_t *data);
PixelBuffer (unsigned int w, unsigned int h, tl::color_t *data);
/**
* @brief Creates an image with the given height and width
@ -88,7 +88,7 @@ public:
* "stride" specifies the stride (distance between two rows of data).
* The size of the data block needs to be stride*h elements or w*h if stride is not given.
*/
PixelBuffer (unsigned int w, unsigned int h, const lay::color_t *data = 0, unsigned int stride = 0);
PixelBuffer (unsigned int w, unsigned int h, const tl::color_t *data = 0, unsigned int stride = 0);
/**
* @brief Default constructor
@ -172,33 +172,33 @@ public:
*/
unsigned int stride () const
{
return sizeof (lay::color_t) * m_width;
return sizeof (tl::color_t) * m_width;
}
/**
* @brief Fills the image with the given color
*/
void fill (lay::color_t);
void fill (tl::color_t);
/**
* @brief Gets the scanline for row n
*/
color_t *scan_line (unsigned int n);
tl::color_t *scan_line (unsigned int n);
/**
* @brief Gets the scanline for row n (const version)
*/
const color_t *scan_line (unsigned int n) const;
const tl::color_t *scan_line (unsigned int n) const;
/**
* @brief Gets the data pointer
*/
color_t *data ();
tl::color_t *data ();
/**
* @brief Gets the data pointer (const version)
*/
const color_t *data () const;
const tl::color_t *data () const;
#if defined(HAVE_QT)
/**
@ -287,7 +287,7 @@ private:
// .. nothing yet ..
}
ImageData (lay::color_t *data, size_t length)
ImageData (tl::color_t *data, size_t length)
: mp_data (data), m_length (length)
{
// .. nothing yet ..
@ -296,8 +296,8 @@ private:
ImageData (const ImageData &other)
{
m_length = other.length ();
mp_data = new lay::color_t [other.length ()];
memcpy (mp_data, other.data (), m_length * sizeof (lay::color_t));
mp_data = new tl::color_t [other.length ()];
memcpy (mp_data, other.data (), m_length * sizeof (tl::color_t));
}
~ImageData ()
@ -307,11 +307,11 @@ private:
}
size_t length () const { return m_length; }
lay::color_t *data () { return mp_data; }
const lay::color_t *data () const { return mp_data; }
tl::color_t *data () { return mp_data; }
const tl::color_t *data () const { return mp_data; }
private:
lay::color_t *mp_data;
tl::color_t *mp_data;
size_t m_length;
ImageData &operator= (const ImageData &other);

View File

@ -36,7 +36,7 @@ PixelBufferPainter::PixelBufferPainter (lay::PixelBuffer &img, unsigned int widt
}
void
PixelBufferPainter::set (const db::Point &p, lay::Color c)
PixelBufferPainter::set (const db::Point &p, tl::Color c)
{
if (p.x () >= 0 && p.x () < m_width && p.y () >= 0 && p.y () < m_height) {
((unsigned int *) mp_img->scan_line (p.y ())) [p.x ()] = c.rgb ();
@ -44,7 +44,7 @@ PixelBufferPainter::set (const db::Point &p, lay::Color c)
}
void
PixelBufferPainter::draw_line (const db::Point &p1, const db::Point &p2, lay::Color c)
PixelBufferPainter::draw_line (const db::Point &p1, const db::Point &p2, tl::Color c)
{
if (p1.x () == p2.x ()) {
@ -79,7 +79,7 @@ PixelBufferPainter::draw_line (const db::Point &p1, const db::Point &p2, lay::Co
}
void
PixelBufferPainter::fill_rect (const db::Point &p1, const db::Point &p2, lay::Color c)
PixelBufferPainter::fill_rect (const db::Point &p1, const db::Point &p2, tl::Color c)
{
int y1 = std::min (p1.y (), p2.y ());
int y2 = std::max (p1.y (), p2.y ());
@ -89,7 +89,7 @@ PixelBufferPainter::fill_rect (const db::Point &p1, const db::Point &p2, lay::Co
}
void
PixelBufferPainter::draw_rect (const db::Point &p1, const db::Point &p2, lay::Color c)
PixelBufferPainter::draw_rect (const db::Point &p1, const db::Point &p2, tl::Color c)
{
int y1 = std::min (p1.y (), p2.y ());
int y2 = std::max (p1.y (), p2.y ());
@ -102,7 +102,7 @@ PixelBufferPainter::draw_rect (const db::Point &p1, const db::Point &p2, lay::Co
}
void
PixelBufferPainter::draw_text (const char *t, const db::Point &p, lay::Color c, int halign, int valign)
PixelBufferPainter::draw_text (const char *t, const db::Point &p, tl::Color c, int halign, int valign)
{
const lay::FixedFont &ff = lay::FixedFont::get_font (m_resolution);
int x = p.x (), y = p.y ();

View File

@ -25,7 +25,7 @@
#include "laybasicCommon.h"
#include "layColor.h"
#include "tlColor.h"
#include "dbPoint.h"
namespace lay {
@ -43,11 +43,11 @@ class LAYBASIC_PUBLIC PixelBufferPainter
public:
PixelBufferPainter (lay::PixelBuffer &img, unsigned int width, unsigned int height, double resolution);
void set (const db::Point &p, lay::Color c);
void draw_line (const db::Point &p1, const db::Point &p2, lay::Color c);
void fill_rect (const db::Point &p1, const db::Point &p2, lay::Color c);
void draw_rect (const db::Point &p1, const db::Point &p2, lay::Color c);
void draw_text (const char *t, const db::Point &p, lay::Color c, int halign, int valign);
void set (const db::Point &p, tl::Color c);
void draw_line (const db::Point &p1, const db::Point &p2, tl::Color c);
void fill_rect (const db::Point &p1, const db::Point &p2, tl::Color c);
void draw_rect (const db::Point &p1, const db::Point &p2, tl::Color c);
void draw_text (const char *t, const db::Point &p, tl::Color c, int halign, int valign);
private:
lay::PixelBuffer *mp_img;

View File

@ -392,7 +392,7 @@ BitmapRedrawThreadCanvas::initialize_plane (lay::CanvasPlane *plane, unsigned in
}
void
BitmapRedrawThreadCanvas::to_image (const std::vector <lay::ViewOp> &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, lay::Color background, lay::Color foreground, lay::Color active, const lay::Drawings *drawings, lay::PixelBuffer &img, unsigned int width, unsigned int height)
BitmapRedrawThreadCanvas::to_image (const std::vector <lay::ViewOp> &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, tl::Color background, tl::Color foreground, tl::Color active, const lay::Drawings *drawings, lay::PixelBuffer &img, unsigned int width, unsigned int height)
{
if (width > m_width) {
width = m_width;

View File

@ -319,7 +319,7 @@ public:
/**
* @brief Transfer the content to a PixelBuffer
*/
void to_image (const std::vector <lay::ViewOp> &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, lay::Color background, lay::Color foreground, lay::Color active, const lay::Drawings *drawings, PixelBuffer &img, unsigned int width, unsigned int height);
void to_image (const std::vector <lay::ViewOp> &view_ops, const lay::DitherPattern &dp, const lay::LineStyles &ls, tl::Color background, tl::Color foreground, tl::Color active, const lay::Drawings *drawings, PixelBuffer &img, unsigned int width, unsigned int height);
/**
* @brief Transfer the content to a BitmapBuffer (monochrome)

View File

@ -68,7 +68,7 @@ SelectionService::~SelectionService ()
}
void
SelectionService::set_colors (lay::Color /*background*/, lay::Color color)
SelectionService::set_colors (tl::Color /*background*/, tl::Color color)
{
m_color = color.rgb ();
if (mp_box) {

View File

@ -55,7 +55,7 @@ public:
SelectionService (lay::LayoutViewBase *view);
~SelectionService ();
void set_colors (lay::Color background, lay::Color color);
void set_colors (tl::Color background, tl::Color color);
void begin (const db::DPoint &pos);
bool dragging () const { return mp_box != 0; }

View File

@ -258,7 +258,7 @@ public:
/**
* @brief This method is called to set the background and text (foreground) color
*/
virtual void set_colors (lay::Color /*background*/, lay::Color /*text*/) { }
virtual void set_colors (tl::Color /*background*/, tl::Color /*text*/) { }
/**
* @brief This method is called when a drag operation should be cancelled
@ -1113,17 +1113,17 @@ public:
/**
* @brief Background color property: background color of the canvas
*/
virtual lay::Color background_color () const = 0;
virtual tl::Color background_color () const = 0;
/**
* @brief Foreground color property: foreground color of the canvas (some "contrast" color to background)
*/
virtual lay::Color foreground_color () const = 0;
virtual tl::Color foreground_color () const = 0;
/**
* @brief Active color property: color of active elements on the canvas (some "contrast" color to background and different from foreground)
*/
virtual lay::Color active_color () const = 0;
virtual tl::Color active_color () const = 0;
/**
* @brief Get the resolution

View File

@ -34,7 +34,7 @@ ViewOp::ViewOp ()
init (0, Copy);
}
ViewOp::ViewOp (color_t color, Mode mode, unsigned int line_style_index, unsigned int dither_index, unsigned int dither_offset, Shape shape, int width, int bitmap_index)
ViewOp::ViewOp (tl::color_t color, Mode mode, unsigned int line_style_index, unsigned int dither_index, unsigned int dither_offset, Shape shape, int width, int bitmap_index)
: m_line_style_index (line_style_index),
m_dither_index (dither_index), m_dither_offset (dither_offset),
m_shape (shape),
@ -45,7 +45,7 @@ ViewOp::ViewOp (color_t color, Mode mode, unsigned int line_style_index, unsigne
}
void
ViewOp::init (color_t color, Mode mode)
ViewOp::init (tl::color_t color, Mode mode)
{
m_or = (mode == Copy || mode == Or) ? color : 0;
m_and = (mode == Copy || mode == And) ? color : wordones;

View File

@ -26,7 +26,7 @@
#define HDR_layViewOp
#include "laybasicCommon.h"
#include "layColor.h"
#include "tlColor.h"
#include <stdint.h>
@ -80,12 +80,12 @@ public:
/**
* @brief The constructor given all the parameters to describe the operator
*/
ViewOp (color_t color, Mode mode, unsigned int line_style_index, unsigned int dither_index, unsigned int dither_offset, Shape shape = Rect, int width = 1, int bitmap_index = -1);
ViewOp (tl::color_t color, Mode mode, unsigned int line_style_index, unsigned int dither_index, unsigned int dither_offset, Shape shape = Rect, int width = 1, int bitmap_index = -1);
/**
* @brief Internal: provide the mask for the "or" part of the operation
*/
color_t ormask () const
tl::color_t ormask () const
{
return m_or;
}
@ -93,7 +93,7 @@ public:
/**
* @brief Internal: provide the mask for the "and" part of the operation
*/
color_t andmask () const
tl::color_t andmask () const
{
return m_and;
}
@ -101,7 +101,7 @@ public:
/**
* @brief Internal: provide the mask for the "xor" part of the operation
*/
color_t xormask () const
tl::color_t xormask () const
{
return m_xor;
}
@ -237,16 +237,16 @@ public:
}
private:
color_t m_or;
color_t m_and;
color_t m_xor;
tl::color_t m_or;
tl::color_t m_and;
tl::color_t m_xor;
unsigned int m_line_style_index;
unsigned int m_dither_index, m_dither_offset;
Shape m_shape;
int m_width;
int m_bitmap_index;
void init (color_t color, Mode mode);
void init (tl::color_t color, Mode mode);
};
} // namespace lay

View File

@ -54,7 +54,7 @@ ZoomService::drag_cancel ()
}
void
ZoomService::set_colors (lay::Color /*background*/, lay::Color color)
ZoomService::set_colors (tl::Color /*background*/, tl::Color color)
{
m_color = color.rgb ();
if (mp_box) {

View File

@ -41,7 +41,7 @@ public:
ZoomService (lay::LayoutViewBase *view);
~ZoomService ();
void set_colors (lay::Color background, lay::Color text);
void set_colors (tl::Color background, tl::Color text);
void begin (const db::DPoint &pos);
void begin_pan (const db::DPoint &pos);

View File

@ -44,7 +44,6 @@ SOURCES += \
layBitmapsToImage.cc \
layBookmarkList.cc \
layCellView.cc \
layColor.cc \
layColorPalette.cc \
layConverters.cc \
layDispatcher.cc \
@ -97,7 +96,6 @@ HEADERS += \
layBookmarkList.h \
layCellView.h \
layColorPalette.h \
layColor.h \
layConverters.h \
layDispatcher.h \
layDisplayState.h \

View File

@ -38,7 +38,7 @@ static bool compare_images (const QImage &qimg, const std::string &au)
if (qimg2.width () == (int) qimg.width () && qimg2.height () == (int) qimg.height ()) {
for (int j = 0; j < qimg.height (); ++j) {
for (int i = 0; i < qimg.width (); ++i) {
if (((const lay::color_t *) qimg.scanLine (j))[i] != ((const lay::color_t *) qimg2.scanLine (j))[i]) {
if (((const tl::color_t *) qimg.scanLine (j))[i] != ((const tl::color_t *) qimg2.scanLine (j))[i]) {
return false;
}
}
@ -87,7 +87,7 @@ TEST(1)
lay::PixelBuffer img (15, 25);
EXPECT_EQ (img.width (), 15);
EXPECT_EQ (img.height (), 25);
EXPECT_EQ (img.stride (), 15 * sizeof (lay::color_t));
EXPECT_EQ (img.stride (), 15 * sizeof (tl::color_t));
EXPECT_EQ (img.transparent (), false);
img.set_transparent (true);
@ -159,11 +159,11 @@ TEST(1)
EXPECT_EQ (img4.scan_line (5)[8], 0xff102030);
// other constructors
EXPECT_EQ (compare_images (lay::PixelBuffer (img4.width (), img4.height (), (const lay::color_t *) img4.data ()), img4), true);
EXPECT_EQ (compare_images (lay::PixelBuffer (img4.width (), img4.height (), (const lay::color_t *) img4.data (), img4.stride ()), img4), true);
EXPECT_EQ (compare_images (lay::PixelBuffer (img4.width (), img4.height (), (const tl::color_t *) img4.data ()), img4), true);
EXPECT_EQ (compare_images (lay::PixelBuffer (img4.width (), img4.height (), (const tl::color_t *) img4.data (), img4.stride ()), img4), true);
lay::color_t *dnew = new lay::color_t [ img4.width () * img4.height () * sizeof (lay::color_t) ];
memcpy (dnew, (const lay::color_t *) img4.data (), img4.width () * img4.height () * sizeof (lay::color_t));
tl::color_t *dnew = new tl::color_t [ img4.width () * img4.height () * sizeof (tl::color_t) ];
memcpy (dnew, (const tl::color_t *) img4.data (), img4.width () * img4.height () * sizeof (tl::color_t));
EXPECT_EQ (compare_images (lay::PixelBuffer (img4.width (), img4.height (), dnew), img4), true);
}

View File

@ -10,7 +10,6 @@ SOURCES = \
layAnnotationShapes.cc \
layBitmap.cc \
layBitmapsToImage.cc \
layColorTests.cc \
layLayerProperties.cc \
layParsedLayerSource.cc \
layPixelBufferTests.cc \

View File

@ -135,7 +135,7 @@ BookmarksView::follow_selection (bool f)
}
void
BookmarksView::set_background_color (lay::Color c)
BookmarksView::set_background_color (tl::Color c)
{
QPalette pl (mp_bookmarks->palette ());
pl.setColor (QPalette::Base, QColor (c.rgb ()));
@ -143,7 +143,7 @@ BookmarksView::set_background_color (lay::Color c)
}
void
BookmarksView::set_text_color (lay::Color c)
BookmarksView::set_text_color (tl::Color c)
{
QPalette pl (mp_bookmarks->palette ());
pl.setColor (QPalette::Text, QColor (c.rgb ()));

View File

@ -28,7 +28,7 @@
#include "layuiCommon.h"
#include "layBookmarkList.h"
#include "layColor.h"
#include "tlColor.h"
#include <QFrame>
#include <QListView>
@ -53,8 +53,8 @@ public:
BookmarksView (lay::LayoutViewBase *view, QWidget *parent, const char *name);
~BookmarksView ();
void set_background_color (lay::Color c);
void set_text_color (lay::Color c);
void set_background_color (tl::Color c);
void set_text_color (tl::Color c);
void follow_selection (bool f);
std::set<size_t> selected_bookmarks ();

View File

@ -656,7 +656,7 @@ HierarchyControlPanel::current_cell (int cv_index, HierarchyControlPanel::cell_p
}
void
HierarchyControlPanel::set_background_color (lay::Color c)
HierarchyControlPanel::set_background_color (tl::Color c)
{
m_background_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) {
@ -667,7 +667,7 @@ HierarchyControlPanel::set_background_color (lay::Color c)
}
void
HierarchyControlPanel::set_text_color (lay::Color c)
HierarchyControlPanel::set_text_color (tl::Color c)
{
m_text_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) {

View File

@ -127,12 +127,12 @@ public:
/**
* @brief Changing of the background color
*/
void set_background_color (lay::Color c);
void set_background_color (tl::Color c);
/**
* @brief Changing of the text color
*/
void set_text_color (lay::Color c);
void set_text_color (tl::Color c);
/**
* @brief Select the active cellview
@ -306,8 +306,8 @@ private:
QFrame *mp_search_frame;
QCheckBox *mp_search_close_cb;
QSplitter *mp_splitter;
lay::Color m_background_color;
lay::Color m_text_color;
tl::Color m_background_color;
tl::Color m_text_color;
tl::DeferredMethod<HierarchyControlPanel> m_do_update_content_dm;
tl::DeferredMethod<HierarchyControlPanel> m_do_full_update_content_dm;
std::unique_ptr<QStyle> mp_tree_style;

View File

@ -1614,7 +1614,7 @@ LayerControlPanel::set_no_stipples (bool ns)
}
void
LayerControlPanel::set_background_color (lay::Color c)
LayerControlPanel::set_background_color (tl::Color c)
{
QPalette pl (mp_layer_list->palette ());
pl.setColor (QPalette::Base, QColor (c.rgb ()));
@ -1623,7 +1623,7 @@ LayerControlPanel::set_background_color (lay::Color c)
}
void
LayerControlPanel::set_text_color (lay::Color c)
LayerControlPanel::set_text_color (tl::Color c)
{
QPalette pl (mp_layer_list->palette ());
pl.setColor (QPalette::Text, QColor (c.rgb ()));

View File

@ -168,12 +168,12 @@ public:
/**
* @brief Changing of the background color
*/
void set_background_color (lay::Color c);
void set_background_color (tl::Color c);
/**
* @brief Changing of the text color
*/
void set_text_color (lay::Color c);
void set_text_color (tl::Color c);
/**
* @brief Set the "hide empty layers" flag

View File

@ -643,9 +643,9 @@ LayerTreeModel::icon_for_layer (const lay::LayerPropertiesConstIterator &iter, l
h = std::max ((unsigned int) 16, h);
w = std::max ((unsigned int) 16, w);
lay::color_t def_color = 0x808080;
lay::color_t fill_color = iter->has_fill_color (true) ? iter->eff_fill_color (true) : def_color;
lay::color_t frame_color = iter->has_frame_color (true) ? iter->eff_frame_color (true) : def_color;
tl::color_t def_color = 0x808080;
tl::color_t fill_color = iter->has_fill_color (true) ? iter->eff_fill_color (true) : def_color;
tl::color_t frame_color = iter->has_frame_color (true) ? iter->eff_frame_color (true) : def_color;
lay::PixelBuffer image (w, h);
image.set_transparent (true);

View File

@ -490,7 +490,7 @@ LibrariesView::double_clicked (const QModelIndex & /*index*/)
}
void
LibrariesView::set_background_color (lay::Color c)
LibrariesView::set_background_color (tl::Color c)
{
m_background_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) {
@ -501,7 +501,7 @@ LibrariesView::set_background_color (lay::Color c)
}
void
LibrariesView::set_text_color (lay::Color c)
LibrariesView::set_text_color (tl::Color c)
{
m_text_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) {

View File

@ -124,12 +124,12 @@ public:
/**
* @brief Changing of the background color
*/
void set_background_color (lay::Color c);
void set_background_color (tl::Color c);
/**
* @brief Changing of the text color
*/
void set_text_color (lay::Color c);
void set_text_color (tl::Color c);
/**
* @brief Sets the active library by name
@ -249,8 +249,8 @@ private:
QFrame *mp_search_frame;
QCheckBox *mp_search_close_cb;
QSplitter *mp_splitter;
lay::Color m_background_color;
lay::Color m_text_color;
tl::Color m_background_color;
tl::Color m_text_color;
tl::DeferredMethod<LibrariesView> m_do_update_content_dm;
tl::DeferredMethod<LibrariesView> m_do_full_update_content_dm;
std::unique_ptr<QStyle> mp_tree_style;

View File

@ -558,7 +558,7 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val
} else if (name == cfg_l2ndb_marker_color) {
lay::Color color;
tl::Color color;
if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color);
}

View File

@ -133,7 +133,7 @@ private:
lay::NetlistBrowserConfig::net_window_type m_window;
double m_window_dim;
unsigned int m_max_shape_count;
lay::Color m_marker_color;
tl::Color m_marker_color;
lay::ColorPalette m_auto_colors;
bool m_auto_color_enabled;
int m_marker_line_width;

View File

@ -701,7 +701,7 @@ static QIcon icon_for_subcircuit ()
return icon;
}
static QIcon colored_icon (const lay::Color &color, const QIcon &original_icon)
static QIcon colored_icon (const tl::Color &color, const QIcon &original_icon)
{
if (! color.is_valid ()) {
return icon_for_net ();
@ -735,12 +735,12 @@ static QIcon colored_icon (const lay::Color &color, const QIcon &original_icon)
return colored_icon;
}
static QIcon net_icon_with_color (const lay::Color &color)
static QIcon net_icon_with_color (const tl::Color &color)
{
return colored_icon (color, light_icon_for_net ());
}
static QIcon connection_icon_with_color (const lay::Color &color)
static QIcon connection_icon_with_color (const tl::Color &color)
{
return colored_icon (color, light_icon_for_connection ());
}
@ -2747,10 +2747,10 @@ NetlistBrowserModel::icon_for_nets (const std::pair<const db::Net *, const db::N
if (mp_colorizer && mp_colorizer->has_color_for_net (net)) {
lay::Color color = mp_colorizer->color_of_net (net);
tl::Color color = mp_colorizer->color_of_net (net);
lay::color_t rgb = lay::color_t (color.rgb ());
std::map<lay::color_t, QIcon>::const_iterator c = m_net_icon_per_color.find (rgb);
tl::color_t rgb = tl::color_t (color.rgb ());
std::map<tl::color_t, QIcon>::const_iterator c = m_net_icon_per_color.find (rgb);
if (c == m_net_icon_per_color.end ()) {
c = m_net_icon_per_color.insert (std::make_pair (rgb, net_icon_with_color (color))).first;
}
@ -2769,10 +2769,10 @@ NetlistBrowserModel::icon_for_connection (const std::pair<const db::Net *, const
if (mp_colorizer && mp_colorizer->has_color_for_net (net)) {
lay::Color color = mp_colorizer->color_of_net (net);
tl::Color color = mp_colorizer->color_of_net (net);
lay::color_t rgb = lay::color_t (color.rgb ());
std::map<lay::color_t, QIcon>::const_iterator c = m_connection_icon_per_color.find (rgb);
tl::color_t rgb = tl::color_t (color.rgb ());
std::map<tl::color_t, QIcon>::const_iterator c = m_connection_icon_per_color.find (rgb);
if (c == m_connection_icon_per_color.end ()) {
c = m_connection_icon_per_color.insert (std::make_pair (rgb, connection_icon_with_color (color))).first;
}

View File

@ -26,7 +26,7 @@
#define HDR_layNetlistBrowserModel
#include "layColorPalette.h"
#include "layColor.h"
#include "tlColor.h"
#include "layuiCommon.h"
#include "dbLayoutToNetlist.h"
@ -331,8 +331,8 @@ private:
db::LayoutVsSchematic *mp_lvsdb;
NetColorizer *mp_colorizer;
std::unique_ptr<IndexedNetlistModel> mp_indexer;
mutable std::map<lay::color_t, QIcon> m_net_icon_per_color;
mutable std::map<lay::color_t, QIcon> m_connection_icon_per_color;
mutable std::map<tl::color_t, QIcon> m_net_icon_per_color;
mutable std::map<tl::color_t, QIcon> m_connection_icon_per_color;
int m_object_column;
int m_status_column;
int m_first_column;

View File

@ -230,7 +230,7 @@ NetlistBrowserPage::set_dispatcher (lay::Dispatcher *pr)
}
void
NetlistBrowserPage::set_highlight_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors)
NetlistBrowserPage::set_highlight_style (tl::Color color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors)
{
m_colorizer.configure (color, auto_colors);
m_marker_line_width = line_width;
@ -493,7 +493,7 @@ NetlistBrowserPage::selection_changed ()
}
void
NetlistBrowserPage::set_color_for_selected_nets (const lay::Color &color)
NetlistBrowserPage::set_color_for_selected_nets (const tl::Color &color)
{
std::vector<const db::Net *> nets = selected_nets ();
@ -515,7 +515,7 @@ NetlistBrowserPage::browse_color_for_net ()
{
QColor c = QColorDialog::getColor (QColor (), this);
if (c.isValid ()) {
set_color_for_selected_nets (lay::Color (c.rgb ()));
set_color_for_selected_nets (tl::Color (c.rgb ()));
}
}
@ -524,7 +524,7 @@ NetlistBrowserPage::select_color_for_net ()
{
QAction *action = dynamic_cast<QAction *> (sender ());
if (action) {
set_color_for_selected_nets (lay::Color (action->data ().value<QColor> ().rgb ()));
set_color_for_selected_nets (tl::Color (action->data ().value<QColor> ().rgb ()));
}
}
@ -1096,11 +1096,11 @@ NetlistBrowserPage::adjust_view ()
}
}
lay::Color
NetlistBrowserPage::make_valid_color (const lay::Color &color)
tl::Color
NetlistBrowserPage::make_valid_color (const tl::Color &color)
{
if (! color.is_valid () && mp_view) {
return mp_view->background_color ().to_mono () ? lay::Color (0, 0, 0) : lay::Color (255, 255, 255);
return mp_view->background_color ().to_mono () ? tl::Color (0, 0, 0) : tl::Color (255, 255, 255);
} else {
return color;
}
@ -1111,7 +1111,7 @@ NetlistBrowserPage::produce_highlights_for_device (const db::Device *device, siz
{
const db::Layout *layout = mp_database->internal_layout ();
lay::Color color = make_valid_color (m_colorizer.marker_color ());
tl::Color color = make_valid_color (m_colorizer.marker_color ());
db::Box device_bbox = bbox_for_device_abstract (layout, device->device_abstract (), device->trans ());
if (! device_bbox.empty ()) {
@ -1160,7 +1160,7 @@ NetlistBrowserPage::produce_highlights_for_circuit (const db::Circuit *circuit,
{
const db::Layout *layout = mp_database->internal_layout ();
lay::Color color = make_valid_color (m_colorizer.marker_color ());
tl::Color color = make_valid_color (m_colorizer.marker_color ());
db::Box circuit_bbox = bbox_for_circuit (layout, circuit);
if (circuit_bbox.empty ()) {
return false;
@ -1189,8 +1189,8 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma
db::cell_index_type cell_index = net->circuit ()->cell_index ();
size_t cluster_id = net->cluster_id ();
lay::Color net_color = m_colorizer.color_of_net (net);
lay::Color fallback_color = make_valid_color (m_colorizer.marker_color ());
tl::Color net_color = m_colorizer.color_of_net (net);
tl::Color fallback_color = make_valid_color (m_colorizer.marker_color ());
const db::Connectivity &conn = mp_database->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {

View File

@ -142,7 +142,7 @@ public:
* @param halo The halo flag or -1 for default
* @param dither_pattern The dither pattern index of -1 to take the default
*/
void set_highlight_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors);
void set_highlight_style (tl::Color color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors);
/**
* @brief Gets a value indicating whether all items in the netlist tree are shown (specifically for cross-reference DBs)
@ -254,9 +254,9 @@ private:
std::vector<const db::Device *> selected_devices ();
std::vector<const db::SubCircuit *> selected_subcircuits ();
std::vector<const db::Circuit *> selected_circuits ();
void set_color_for_selected_nets (const lay::Color &color);
void set_color_for_selected_nets (const tl::Color &color);
void layer_list_changed (int);
lay::Color make_valid_color (const lay::Color &color);
tl::Color make_valid_color (const tl::Color &color);
bool produce_highlights_for_net(const db::Net *net, size_t &n_markers, const std::map<db::LayerProperties, lay::LayerPropertiesConstIterator> &display_by_lp, const std::vector<db::DCplxTrans> &tv);
bool produce_highlights_for_device (const db::Device *device, size_t &n_markers, const std::vector<db::DCplxTrans> &tv);
bool produce_highlights_for_circuit (const db::Circuit *circuit, size_t &n_markers, const std::vector<db::DCplxTrans> &tv);

View File

@ -477,7 +477,7 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu
} else if (name == cfg_rdb_marker_color) {
lay::Color color;
tl::Color color;
if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color);
}

View File

@ -27,7 +27,7 @@
#include "layuiCommon.h"
#include "layBrowser.h"
#include "layColor.h"
#include "tlColor.h"
#include "rdbMarkerBrowser.h"
namespace Ui
@ -80,7 +80,7 @@ private:
window_type m_window;
double m_window_dim;
unsigned int m_max_marker_count;
lay::Color m_marker_color;
tl::Color m_marker_color;
int m_marker_line_width;
int m_marker_vertex_size;
int m_marker_halo;

View File

@ -1610,7 +1610,7 @@ MarkerBrowserPage::set_dispatcher (lay::Dispatcher *pr)
}
void
MarkerBrowserPage::set_marker_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern)
MarkerBrowserPage::set_marker_style (tl::Color color, int line_width, int vertex_size, int halo, int dither_pattern)
{
m_marker_color = color;
m_marker_line_width = line_width;

View File

@ -28,7 +28,7 @@
#include "ui_MarkerBrowserPage.h"
#include "rdbMarkerBrowser.h"
#include "tlDeferredExecution.h"
#include "layColor.h"
#include "tlColor.h"
#include "dbBox.h"
#include <QFrame>
@ -138,7 +138,7 @@ public:
* @param halo The halo flag or -1 for default
* @param dither_pattern The dither pattern index of -1 to take the default
*/
void set_marker_style (lay::Color color, int line_width, int vertex_size, int halo, int dither_pattern);
void set_marker_style (tl::Color color, int line_width, int vertex_size, int halo, int dither_pattern);
/**
* @brief Enable or disable updates
@ -197,7 +197,7 @@ private:
rdb::window_type m_window;
double m_window_dim;
size_t m_max_marker_count;
lay::Color m_marker_color;
tl::Color m_marker_color;
int m_marker_line_width;
int m_marker_vertex_size;
int m_marker_halo;

View File

@ -28,7 +28,7 @@
#include "layFixedFont.h"
#include "layPixelBufferPainter.h"
#include "laySnap.h"
#include "layColor.h"
#include "tlColor.h"
#include "dbTrans.h"
#if defined(HAVE_QT)
@ -135,25 +135,25 @@ GridNet::configure (const std::string &name, const std::string &value)
if (name == cfg_grid_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
need_update = test_and_set (m_color, color);
} else if (name == cfg_grid_grid_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
need_update = test_and_set (m_grid_color, color);
} else if (name == cfg_grid_axis_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
need_update = test_and_set (m_axis_color, color);
} else if (name == cfg_grid_ruler_color) {
lay::Color color;
tl::Color color;
ColorConverter ().from_string (value, color);
need_update = test_and_set (m_ruler_color, color);
@ -213,14 +213,14 @@ GridNet::render_bg (const lay::Viewport &vp, ViewObjectCanvas &canvas)
{
if (m_visible) {
lay::Color color;
tl::Color color;
if (m_color.is_valid ()) {
color = m_color;
} else {
color = lay::Color (128, 128, 128); // TODO: this is not a "real" automatic color ..
color = tl::Color (128, 128, 128); // TODO: this is not a "real" automatic color ..
}
lay::Color grid_color = color, axis_color = color, ruler_color = color;
tl::Color grid_color = color, axis_color = color, ruler_color = color;
if (m_grid_color.is_valid ()) {
grid_color = m_grid_color;
}

View File

@ -29,7 +29,7 @@
#if defined(HAVE_QT)
# include "layPluginConfigPage.h"
#endif
#include "layColor.h"
#include "tlColor.h"
#include "dbTypes.h"
#include "dbBox.h"
@ -80,10 +80,10 @@ private:
bool m_visible;
bool m_show_ruler;
double m_grid;
lay::Color m_color;
lay::Color m_grid_color;
lay::Color m_axis_color;
lay::Color m_ruler_color;
tl::Color m_color;
tl::Color m_grid_color;
tl::Color m_axis_color;
tl::Color m_ruler_color;
GridStyle m_style0;
GridStyle m_style1;
GridStyle m_style2;

View File

@ -858,18 +858,18 @@ LayoutView::max_hier_changed (int i)
set_hier_levels (std::make_pair (get_hier_levels ().first, i));
}
lay::Color
tl::Color
LayoutView::default_background_color ()
{
if (! mp_widget) {
return LayoutViewBase::default_background_color ();
} else {
return lay::Color (mp_widget->palette ().color (QPalette::Normal, QPalette::Base).rgb ());
return tl::Color (mp_widget->palette ().color (QPalette::Normal, QPalette::Base).rgb ());
}
}
void
LayoutView::do_set_background_color (lay::Color c, lay::Color contrast)
LayoutView::do_set_background_color (tl::Color c, tl::Color contrast)
{
if (mp_control_panel) {
mp_control_panel->set_background_color (c);

View File

@ -751,8 +751,8 @@ protected:
virtual bool configure (const std::string &name, const std::string &value);
virtual void config_finalize ();
virtual lay::Color default_background_color ();
virtual void do_set_background_color (lay::Color color, lay::Color contrast);
virtual tl::Color default_background_color ();
virtual void do_set_background_color (tl::Color color, tl::Color contrast);
virtual void do_paste ();
virtual void begin_layer_updates ();
virtual void end_layer_updates ();

View File

@ -39,7 +39,7 @@ static bool compare_images (const QImage &qimg, const std::string &au)
if (qimg2.width () == (int) qimg.width () && qimg2.height () == (int) qimg.height ()) {
for (int j = 0; j < qimg.height (); ++j) {
for (int i = 0; i < qimg.width (); ++i) {
if (((const lay::color_t *) qimg.scanLine (j))[i] != ((const lay::color_t *) qimg2.scanLine (j))[i]) {
if (((const tl::color_t *) qimg.scanLine (j))[i] != ((const tl::color_t *) qimg2.scanLine (j))[i]) {
return false;
}
}
@ -86,12 +86,12 @@ static bool compare_images (const lay::BitmapBuffer &img, const lay::BitmapBuffe
TEST(1)
{
lay::LayoutView lv (0, false, 0);
lv.cell_box_color (lay::Color (0, 0, 0));
lv.cell_box_color (tl::Color (0, 0, 0));
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
QImage qimg;
qimg = lv.get_image_with_options (500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox (), false);
qimg = lv.get_image_with_options (500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox (), false);
EXPECT_EQ (qimg.format () == QImage::Format_RGB32, true);
@ -113,7 +113,7 @@ TEST(2)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
QImage qimg;
qimg = lv.get_image_with_options (500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox (), false);
qimg = lv.get_image_with_options (500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox (), false);
EXPECT_EQ (qimg.format () == QImage::Format_RGB32, true);
@ -136,7 +136,7 @@ TEST(3)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
QImage qimg;
qimg = lv.get_image_with_options (500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox (), true);
qimg = lv.get_image_with_options (500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox (), true);
EXPECT_EQ (qimg.format () == QImage::Format_MonoLSB, true);
@ -155,7 +155,7 @@ TEST(4)
{
lay::LayoutView lv (0, false, 0);
lv.set_drawing_workers (2);
lv.cell_box_color (lay::Color (0, 0, 0));
lv.cell_box_color (tl::Color (0, 0, 0));
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
@ -177,12 +177,12 @@ TEST(4)
TEST(11)
{
lay::LayoutView lv (0, false, 0);
lv.cell_box_color (lay::Color (0, 0, 0));
lv.cell_box_color (tl::Color (0, 0, 0));
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
lay::PixelBuffer img;
img = lv.get_pixels_with_options (500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox ());
img = lv.get_pixels_with_options (500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox ());
std::string tmp = tmp_file ("test.png");
{
@ -210,7 +210,7 @@ TEST(12)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
lay::PixelBuffer img;
img = lv.get_pixels_with_options (500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox ());
img = lv.get_pixels_with_options (500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox ());
std::string tmp = tmp_file ("test.png");
{
@ -239,7 +239,7 @@ TEST(13)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
lay::BitmapBuffer img;
img = lv.get_pixels_with_options_mono (500, 500, 1, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox ());
img = lv.get_pixels_with_options_mono (500, 500, 1, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox ());
std::string tmp = tmp_file ("test.png");
{
@ -264,12 +264,12 @@ TEST(13)
TEST(21)
{
lay::LayoutView lv (0, false, 0);
lv.cell_box_color (lay::Color (0, 0, 0));
lv.cell_box_color (tl::Color (0, 0, 0));
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
std::string tmp = tmp_file ("test.png");
lv.save_image_with_options (tmp, 500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox (), false);
lv.save_image_with_options (tmp, 500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox (), false);
lay::PixelBuffer img;
{
@ -297,7 +297,7 @@ TEST(22)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
std::string tmp = tmp_file ("test.png");
lv.save_image_with_options (tmp, 500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox (), false);
lv.save_image_with_options (tmp, 500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox (), false);
lay::PixelBuffer img;
{
@ -326,7 +326,7 @@ TEST(23)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
std::string tmp = tmp_file ("test.png");
lv.save_image_with_options (tmp, 500, 500, 1, 1, 1.0, lay::Color (255, 255, 255), lay::Color (0, 0, 0), lay::Color (128, 128, 128), db::DBox (), true);
lv.save_image_with_options (tmp, 500, 500, 1, 1, 1.0, tl::Color (255, 255, 255), tl::Color (0, 0, 0), tl::Color (128, 128, 128), db::DBox (), true);
lay::BitmapBuffer img;
{

View File

@ -477,7 +477,7 @@ NetTracerDialog::configure (const std::string &name, const std::string &value)
} else if (name == cfg_nt_marker_color) {
lay::Color color;
tl::Color color;
if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color);
}
@ -1093,7 +1093,7 @@ NetTracerDialog::update_list ()
item->setData (Qt::DisplayRole, tl::to_qstring (mp_nets [i]->name ()));
if (lay::Color (mp_nets [i]->color ()).is_valid ()) {
if (tl::Color (mp_nets [i]->color ()).is_valid ()) {
QPixmap pxmp (icon_size);
QPainter pxpainter (&pxmp);
@ -1596,7 +1596,7 @@ NetTracerDialog::update_highlights ()
std::map <unsigned int, unsigned int> llmap;
lay::Color net_color = mp_nets [item_index]->color ();
tl::Color net_color = mp_nets [item_index]->color ();
// Create markers for the shapes
for (db::NetTracerNet::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end () && n_marker < m_max_marker_count; ++net_shape) {

View File

@ -92,7 +92,7 @@ private:
nt_window_type m_window;
double m_window_dim;
unsigned int m_max_marker_count;
lay::Color m_marker_color;
tl::Color m_marker_color;
int m_marker_line_width;
int m_marker_vertex_size;
int m_marker_halo;

View File

@ -196,7 +196,7 @@ D25View::begin (const std::string &generator)
}
void
D25View::open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name)
D25View::open_display (const tl::color_t *frame_color, const tl::color_t *fill_color, const db::LayerProperties *like, const std::string *name)
{
if (! mp_ui->d25_view->has_error ()) {
mp_ui->d25_view->open_display (frame_color, fill_color, like, name);

View File

@ -68,7 +68,7 @@ public:
void close ();
void clear ();
void begin (const std::string &generator);
void open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name);
void open_display (const tl::color_t *frame_color, const tl::color_t *fill_color, const db::LayerProperties *like, const std::string *name);
void close_display ();
void entry (const db::Region &data, double dbu, double zstart, double zstop);
void entry_edge (const db::Edges &data, double dbu, double zstart, double zstop);

View File

@ -531,7 +531,7 @@ D25ViewWidget::clear ()
}
}
static void color_to_gl (color_t color, GLfloat (&gl_color) [4])
static void color_to_gl (tl::color_t color, GLfloat (&gl_color) [4])
{
gl_color[0] = ((color >> 16) & 0xff) / 255.0f;
gl_color[1] = ((color >> 8) & 0xff) / 255.0f;
@ -539,7 +539,7 @@ static void color_to_gl (color_t color, GLfloat (&gl_color) [4])
gl_color[3] = 1.0f;
}
static void color_to_gl (const color_t *color, GLfloat (&gl_color) [4])
static void color_to_gl (const tl::color_t *color, GLfloat (&gl_color) [4])
{
if (! color) {
for (unsigned int i = 0; i < 4; ++i) {
@ -567,7 +567,7 @@ static void lp_to_info (const lay::LayerPropertiesNode &lp, D25ViewWidget::Layer
}
void
D25ViewWidget::open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name)
D25ViewWidget::open_display (const tl::color_t *frame_color, const tl::color_t *fill_color, const db::LayerProperties *like, const std::string *name)
{
m_vertex_chunks.push_back (triangle_chunks_type ());
m_line_chunks.push_back (line_chunks_type ());
@ -648,7 +648,7 @@ D25ViewWidget::enter (const db::RecursiveShapeIterator *iter, double zstart, dou
} else {
// sequential assignment
lay::color_t color = mp_view->get_palette ().luminous_color_by_index (m_layers.size ());
tl::color_t color = mp_view->get_palette ().luminous_color_by_index (m_layers.size ());
color_to_gl (color, info.fill_color);
}
@ -1089,7 +1089,7 @@ D25ViewWidget::paintGL ()
const qreal retina_scale = devicePixelRatio ();
glViewport (0, 0, width () * retina_scale, height () * retina_scale);
lay::Color c = mp_view->background_color ();
tl::Color c = mp_view->background_color ();
float foreground_rgb = (c.to_mono () ? 0.0f : 1.0f);
float ambient = (c.to_mono () ? 0.8f : 0.25f);
float mist_factor = (c.to_mono () ? 0.2f : 0.4f);

View File

@ -159,7 +159,7 @@ public:
void set_material_visible (size_t index, bool visible);
void clear ();
void open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name);
void open_display (const tl::color_t *frame_color, const tl::color_t *fill_color, const db::LayerProperties *like, const std::string *name);
void close_display ();
void entry (const db::Region &data, double dbu, double zstart, double zstop);
void entry (const db::Edges &data, double dbu, double zstart, double zstop);

View File

@ -11,6 +11,7 @@ FORMS =
SOURCES = \
tlAssert.cc \
tlBase64.cc \
tlColor.cc \
tlClassRegistry.cc \
tlCopyOnWrite.cc \
tlDataMapping.cc \
@ -58,6 +59,7 @@ HEADERS = \
tlAlgorithm.h \
tlAssert.h \
tlBase64.h \
tlColor.h \
tlClassRegistry.h \
tlCopyOnWrite.h \
tlDataMapping.h \

View File

@ -21,14 +21,14 @@
*/
#include "layColor.h"
#include "tlColor.h"
#include "tlString.h"
#include "tlMath.h"
#include <ctype.h>
#include <algorithm>
namespace lay
namespace tl
{
Color::Color ()
@ -154,16 +154,16 @@ Color::get_hsv (unsigned int &hue, unsigned int &saturation, unsigned int &value
}
}
static lay::Color color_d (double r, double g, double b)
static tl::Color color_d (double r, double g, double b)
{
return lay::Color (tl::round (r * 255.0, 1), tl::round (g * 255.0, 1), tl::round (b * 255.0, 1));
return tl::Color (tl::round (r * 255.0, 1), tl::round (g * 255.0, 1), tl::round (b * 255.0, 1));
}
lay::Color
tl::Color
Color::from_hsv (unsigned int hue, unsigned int saturation, unsigned int value)
{
if (saturation == 0) {
return lay::Color (value, value, value);
return tl::Color (value, value, value);
}
hue = (hue + 360) % 360;
@ -191,7 +191,7 @@ Color::from_hsv (unsigned int hue, unsigned int saturation, unsigned int value)
case 5:
return color_d (v, p, q);
default:
return lay::Color ();
return tl::Color ();
}
}

View File

@ -20,15 +20,15 @@
*/
#ifndef HDR_layColor
#define HDR_layColor
#ifndef HDR_tlColor
#define HDR_tlColor
#include "laybasicCommon.h"
#include "tlCommon.h"
#include <stdint.h>
#include <string>
namespace lay
namespace tl
{
/**
@ -50,7 +50,7 @@ inline unsigned int blue (color_t c) { return c & 0xff; }
* This class is a replacement for QColor. It offers invalid color values and
* string conversion.
*/
class LAYBASIC_PUBLIC Color
class TL_PUBLIC Color
{
public:
/**
@ -168,7 +168,7 @@ public:
/**
* @brief Creates the color from a HSV color
*/
static lay::Color from_hsv (unsigned int hue, unsigned int saturation, unsigned int value);
static tl::Color from_hsv (unsigned int hue, unsigned int saturation, unsigned int value);
private:
color_t m_color;

View File

@ -20,7 +20,7 @@
*/
#include "layColor.h"
#include "tlColor.h"
#include "tlUnitTest.h"
@ -30,9 +30,9 @@
TEST(1)
{
EXPECT_EQ (lay::Color ().is_valid (), false);
EXPECT_EQ (lay::Color ().to_string (), "");
EXPECT_EQ (lay::Color ().rgb (), 0x00000000);
EXPECT_EQ (tl::Color ().is_valid (), false);
EXPECT_EQ (tl::Color ().to_string (), "");
EXPECT_EQ (tl::Color ().rgb (), 0x00000000);
#if defined(HAVE_QT)
EXPECT_EQ (QColor ().isValid (), false);
@ -43,9 +43,9 @@ TEST(1)
TEST(2)
{
EXPECT_EQ (lay::Color (0x102030).is_valid (), true);
EXPECT_EQ (lay::Color (0x102030).to_string (), "#102030");
EXPECT_EQ (lay::Color (0x102030).rgb (), 0xff102030);
EXPECT_EQ (tl::Color (0x102030).is_valid (), true);
EXPECT_EQ (tl::Color (0x102030).to_string (), "#102030");
EXPECT_EQ (tl::Color (0x102030).rgb (), 0xff102030);
#if defined(HAVE_QT)
EXPECT_EQ (QColor (0x102030).isValid (), true);
@ -56,13 +56,13 @@ TEST(2)
TEST(3)
{
EXPECT_EQ (lay::Color (std::string ()).is_valid (), false);
EXPECT_EQ (lay::Color ("#102030").is_valid (), true);
EXPECT_EQ (lay::Color ("#102030").to_string (), "#102030");
EXPECT_EQ (lay::Color ("#102030").rgb (), 0xff102030);
EXPECT_EQ (lay::Color ("102030").is_valid (), true);
EXPECT_EQ (lay::Color ("102030").to_string (), "#102030");
EXPECT_EQ (lay::Color ("102030").rgb (), 0xff102030);
EXPECT_EQ (tl::Color (std::string ()).is_valid (), false);
EXPECT_EQ (tl::Color ("#102030").is_valid (), true);
EXPECT_EQ (tl::Color ("#102030").to_string (), "#102030");
EXPECT_EQ (tl::Color ("#102030").rgb (), 0xff102030);
EXPECT_EQ (tl::Color ("102030").is_valid (), true);
EXPECT_EQ (tl::Color ("102030").to_string (), "#102030");
EXPECT_EQ (tl::Color ("102030").rgb (), 0xff102030);
#if defined(HAVE_QT)
EXPECT_EQ (QColor (tl::to_qstring ("#102030")).isValid (), true);
@ -73,20 +73,20 @@ TEST(3)
TEST(4)
{
EXPECT_EQ (lay::Color ("#123").is_valid (), true);
EXPECT_EQ (lay::Color ("#123").to_string (), "#112233");
EXPECT_EQ (lay::Color ("#123").rgb (), 0xff112233);
EXPECT_EQ (tl::Color ("#123").is_valid (), true);
EXPECT_EQ (tl::Color ("#123").to_string (), "#112233");
EXPECT_EQ (tl::Color ("#123").rgb (), 0xff112233);
}
TEST(5)
{
EXPECT_EQ (lay::Color ("#80102030").is_valid (), true);
EXPECT_EQ (lay::Color ("#80102030").alpha (), 128);
EXPECT_EQ (lay::Color ("#80102030").red (), 16);
EXPECT_EQ (lay::Color ("#80102030").green (), 32);
EXPECT_EQ (lay::Color ("#80102030").blue (), 48);
EXPECT_EQ (lay::Color ("#80102030").to_string (), "#80102030");
EXPECT_EQ (lay::Color ("#80102030").rgb (), 0x80102030);
EXPECT_EQ (tl::Color ("#80102030").is_valid (), true);
EXPECT_EQ (tl::Color ("#80102030").alpha (), 128);
EXPECT_EQ (tl::Color ("#80102030").red (), 16);
EXPECT_EQ (tl::Color ("#80102030").green (), 32);
EXPECT_EQ (tl::Color ("#80102030").blue (), 48);
EXPECT_EQ (tl::Color ("#80102030").to_string (), "#80102030");
EXPECT_EQ (tl::Color ("#80102030").rgb (), 0x80102030);
#if defined(HAVE_QT) && QT_VERSION >= 0x50000
// no alpha support in Qt
@ -98,16 +98,16 @@ TEST(5)
TEST(6)
{
EXPECT_EQ (lay::Color ("#8123").is_valid (), true);
EXPECT_EQ (lay::Color ("#8123").to_string (), "#88112233");
EXPECT_EQ (lay::Color ("#8123").rgb (), 0x88112233);
EXPECT_EQ (tl::Color ("#8123").is_valid (), true);
EXPECT_EQ (tl::Color ("#8123").to_string (), "#88112233");
EXPECT_EQ (tl::Color ("#8123").rgb (), 0x88112233);
}
TEST(7)
{
EXPECT_EQ (lay::Color (16, 32, 48, 128).is_valid (), true);
EXPECT_EQ (lay::Color (16, 32, 48, 128).to_string (), "#80102030");
EXPECT_EQ (lay::Color (16, 32, 48, 128).rgb (), 0x80102030);
EXPECT_EQ (tl::Color (16, 32, 48, 128).is_valid (), true);
EXPECT_EQ (tl::Color (16, 32, 48, 128).to_string (), "#80102030");
EXPECT_EQ (tl::Color (16, 32, 48, 128).rgb (), 0x80102030);
#if defined(HAVE_QT)
// no alpha support in Qt
@ -121,13 +121,13 @@ TEST(8)
{
unsigned int h, s, v;
int ih, is, iv;
lay::Color c = lay::Color (16, 32, 48);
tl::Color c = tl::Color (16, 32, 48);
c.get_hsv (h, s, v);
EXPECT_EQ (h, 210);
EXPECT_EQ (s, 170);
EXPECT_EQ (v, 48);
EXPECT_EQ (lay::Color::from_hsv (h, s, v).to_string (), "#102030");
EXPECT_EQ (tl::Color::from_hsv (h, s, v).to_string (), "#102030");
#if defined(HAVE_QT)
QColor qc = QColor (16, 32, 48);
@ -137,13 +137,13 @@ TEST(8)
EXPECT_EQ (iv, 48);
#endif
c = lay::Color (32, 16, 48);
c = tl::Color (32, 16, 48);
c.get_hsv (h, s, v);
EXPECT_EQ (h, 270);
EXPECT_EQ (s, 170);
EXPECT_EQ (v, 48);
EXPECT_EQ (lay::Color::from_hsv (h, s, v).to_string (), "#201030");
EXPECT_EQ (tl::Color::from_hsv (h, s, v).to_string (), "#201030");
#if defined(HAVE_QT)
qc = QColor (32, 16, 48);
@ -153,13 +153,13 @@ TEST(8)
EXPECT_EQ (iv, 48);
#endif
c = lay::Color (32, 48, 16);
c = tl::Color (32, 48, 16);
c.get_hsv (h, s, v);
EXPECT_EQ (h, 90);
EXPECT_EQ (s, 170);
EXPECT_EQ (v, 48);
EXPECT_EQ (lay::Color::from_hsv (h, s, v).to_string (), "#203010");
EXPECT_EQ (tl::Color::from_hsv (h, s, v).to_string (), "#203010");
#if defined(HAVE_QT)
qc = QColor (32, 48, 16);
@ -169,13 +169,13 @@ TEST(8)
EXPECT_EQ (iv, 48);
#endif
c = lay::Color (48, 32, 16);
c = tl::Color (48, 32, 16);
c.get_hsv (h, s, v);
EXPECT_EQ (h, 30);
EXPECT_EQ (s, 170);
EXPECT_EQ (v, 48);
EXPECT_EQ (lay::Color::from_hsv (h, s, v).to_string (), "#302010");
EXPECT_EQ (tl::Color::from_hsv (h, s, v).to_string (), "#302010");
#if defined(HAVE_QT)
qc = QColor (48, 32, 16);
@ -185,13 +185,13 @@ TEST(8)
EXPECT_EQ (iv, 48);
#endif
c = lay::Color (48, 16, 32);
c = tl::Color (48, 16, 32);
c.get_hsv (h, s, v);
EXPECT_EQ (h, 330);
EXPECT_EQ (s, 170);
EXPECT_EQ (v, 48);
EXPECT_EQ (lay::Color::from_hsv (h, s, v).to_string (), "#301020");
EXPECT_EQ (tl::Color::from_hsv (h, s, v).to_string (), "#301020");
#if defined(HAVE_QT)
qc = QColor (48, 16, 32);
@ -201,13 +201,13 @@ TEST(8)
EXPECT_EQ (iv, 48);
#endif
c = lay::Color (16, 48, 32);
c = tl::Color (16, 48, 32);
c.get_hsv (h, s, v);
EXPECT_EQ (h, 150);
EXPECT_EQ (s, 170);
EXPECT_EQ (v, 48);
EXPECT_EQ (lay::Color::from_hsv (h, s, v).to_string (), "#103020");
EXPECT_EQ (tl::Color::from_hsv (h, s, v).to_string (), "#103020");
#if defined(HAVE_QT)
qc = QColor (16, 48, 32);

View File

@ -11,6 +11,7 @@ SOURCES = \
tlBase64Tests.cc \
tlClassRegistryTests.cc \
tlCommandLineParserTests.cc \
tlColorTests.cc \
tlCopyOnWriteTests.cc \
tlDataMappingTests.cc \
tlDeferredExecutionTests.cc \