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 "layPlugin.h"
#include "layConverters.h" #include "layConverters.h"
#include "layDispatcher.h" #include "layDispatcher.h"
#include "layColor.h" #include "tlColor.h"
#if defined(HAVE_QT) #if defined(HAVE_QT)
# include "layConfigurationDialog.h" # include "layConfigurationDialog.h"
# include "layAbstractMenu.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_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_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_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_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))); 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 ()); 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 ()) { if (! c.is_valid ()) {
c = canvas.foreground_color (); c = canvas.foreground_color ();
} }
@ -823,7 +823,7 @@ Service::configure (const std::string &name, const std::string &value)
if (name == cfg_ruler_color) { if (name == cfg_ruler_color) {
lay::Color color; tl::Color color;
lay::ColorConverter ().from_string (value, color); lay::ColorConverter ().from_string (value, color);
// make the color available for the dynamic view objects too. // make the color available for the dynamic view objects too.
@ -914,7 +914,7 @@ Service::annotations_changed ()
} }
std::vector <lay::ViewOp> 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 ()); int basic_width = int(0.5 + 1.0 / canvas.resolution ());

View File

@ -389,7 +389,7 @@ public:
/** /**
* @brief Color accessor * @brief Color accessor
*/ */
lay::Color color () const tl::Color color () const
{ {
return m_color; return m_color;
} }
@ -500,7 +500,7 @@ public:
private: private:
// Ruler display and snapping configuration // Ruler display and snapping configuration
lay::Color m_color; tl::Color m_color;
bool m_halo; bool m_halo;
lay::angle_constraint_type m_snap_mode; lay::angle_constraint_type m_snap_mode;
double m_grid; double m_grid;
@ -601,7 +601,7 @@ private:
/** /**
* @brief implementation of the "Drawing" interface: configuration * @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 * @brief Update m_rulers to reflect the selection

View File

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

View File

@ -288,7 +288,7 @@ public:
/** /**
* @brief Reimplementation of the ViewService interface: set the colors * @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) * @brief Cancel any edit operations (in this case, unselect all & cancel any drag operation)

View File

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

View File

@ -43,14 +43,14 @@ static void clear_colormap (img::DataMapping *dm)
dm->false_color_nodes.clear (); 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) 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 (); 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 ()) { if (i < dm->false_color_nodes.size ()) {
return dm->false_color_nodes [i].second.first.rgb (); 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 ()) { if (i < dm->false_color_nodes.size ()) {
return dm->false_color_nodes [i].second.first.rgb (); 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 ()) { if (i < dm->false_color_nodes.size ()) {
return dm->false_color_nodes [i].second.second.rgb (); return dm->false_color_nodes [i].second.second.rgb ();

View File

@ -346,7 +346,7 @@ public:
ui ()->ungrab_mouse (this); 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 () DataMapping::DataMapping ()
: brightness (0.0), contrast (0.0), gamma (1.0), red_gain (1.0), green_gain (1.0), blue_gain (1.0) : 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 (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 (lay::Color (255, 255, 255), lay::Color (255, 255, 255)))); false_color_nodes.push_back (std::make_pair (1.0, std::make_pair (tl::Color (255, 255, 255), tl::Color (255, 255, 255))));
} }
bool bool
@ -212,7 +212,7 @@ DataMapping::create_data_mapping (bool monochrome, double xmin, double xmax, uns
for (int j = 0; j < n; ++j) { 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; double y = 0.0;
if (channel == 0) { if (channel == 0) {
@ -273,7 +273,7 @@ namespace
struct compare_first_of_node 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; 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) interpolated_color (const DataMapping::false_color_nodes_type &nodes, double x)
{ {
if (nodes.size () < 1) { if (nodes.size () < 1) {
return lay::Color (); return tl::Color ();
} else if (nodes.size () < 2) { } else if (nodes.size () < 2) {
return x < nodes[0].first ? nodes[0].second.first : nodes[0].second.second; return x < nodes[0].first ? nodes[0].second.first : nodes[0].second.second;
} else { } 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 ()) { if (p == nodes.end ()) {
return nodes.back ().second.second; return nodes.back ().second.second;
} else if (p == nodes.begin ()) { } 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 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)); 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; double x = 0.0;
lay::ColorConverter cc; lay::ColorConverter cc;
lay::Color cl, cr; tl::Color cl, cr;
std::string s; std::string s;
m_data_mapping.false_color_nodes.clear (); m_data_mapping.false_color_nodes.clear ();
@ -1637,10 +1637,10 @@ Object::read_file ()
bool is_color = false; bool is_color = false;
for (unsigned int i = 0; i < img.height () && ! is_color; ++i) { for (unsigned int i = 0; i < img.height () && ! is_color; ++i) {
const lay::color_t *d = img.scan_line (i); const tl::color_t *d = img.scan_line (i);
const lay::color_t *dd = d + img.width (); const tl::color_t *dd = d + img.width ();
while (! is_color && d != dd) { while (! is_color && d != dd) {
lay::color_t c = *d++; tl::color_t c = *d++;
is_color = (((c >> 8) ^ c) & 0xffff) != 0; is_color = (((c >> 8) ^ c) & 0xffff) != 0;
} }
} }
@ -1669,10 +1669,10 @@ Object::read_file ()
unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0; unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0;
for (unsigned int y = 0; y < h; ++y) { for (unsigned int y = 0; y < h; ++y) {
const lay::color_t *d = img.scan_line (h - y - 1); const tl::color_t *d = img.scan_line (h - y - 1);
const lay::color_t *dd = d + img.width (); const tl::color_t *dd = d + img.width ();
while (d != dd) { while (d != dd) {
lay::color_t rgb = *d++; tl::color_t rgb = *d++;
*red++ = lay::red (rgb); *red++ = lay::red (rgb);
*green++ = lay::green (rgb); *green++ = lay::green (rgb);
*blue++ = lay::blue (rgb); *blue++ = lay::blue (rgb);
@ -1688,10 +1688,10 @@ Object::read_file ()
unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0; unsigned char *msk = img.transparent () ? mp_data->set_mask () : 0;
for (unsigned int y = 0; y < h; ++y) { for (unsigned int y = 0; y < h; ++y) {
const lay::color_t *d = img.scan_line (h - y - 1); const tl::color_t *d = img.scan_line (h - y - 1);
const lay::color_t *dd = d + img.width (); const tl::color_t *dd = d + img.width ();
while (d != dd) { while (d != dd) {
lay::color_t rgb = *d++; tl::color_t rgb = *d++;
*mono++ = lay::green (rgb); *mono++ = lay::green (rgb);
if (msk) { if (msk) {
*msk++ = lay::alpha (rgb) > 128; *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) { for (unsigned int i = 0; i < data_mapping ().false_color_nodes.size (); ++i) {
os << data_mapping ().false_color_nodes[i].first; os << data_mapping ().false_color_nodes[i].first;
os << ","; 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)); os << tl::to_word_or_quoted_string (cc.to_string (clr.first));
if (clr.first != clr.second) { if (clr.first != clr.second) {
os << ","; os << ",";
@ -2223,7 +2223,7 @@ Object::validate_pixel_data () const
size_t n = data_length (); 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; mp_pixel_data = nc_pixel_data;
double min = 0.0, max = 255.0; double min = 0.0, max = 255.0;
@ -2248,7 +2248,7 @@ Object::validate_pixel_data () const
if (mp_data->is_color ()) { 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 unsigned char *f = mp_data->byte_data (0);
const tl::DataMappingLookupTable *l = &lut[0]; const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) { for (size_t j = 0; j < n; ++j) {
@ -2271,7 +2271,7 @@ Object::validate_pixel_data () const
} else { } 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 unsigned char *f = mp_data->byte_data ();
const tl::DataMappingLookupTable *l = &lut[0]; const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) { for (size_t j = 0; j < n; ++j) {
@ -2298,7 +2298,7 @@ Object::validate_pixel_data () const
if (mp_data->is_color ()) { 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 float *f = mp_data->float_data (0);
const tl::DataMappingLookupTable *l = &lut[0]; const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) { for (size_t j = 0; j < n; ++j) {
@ -2321,7 +2321,7 @@ Object::validate_pixel_data () const
} else { } 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 float *f = mp_data->float_data ();
const tl::DataMappingLookupTable *l = &lut[0]; const tl::DataMappingLookupTable *l = &lut[0];
for (size_t j = 0; j < n; ++j) { for (size_t j = 0; j < n; ++j) {

View File

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

View File

@ -736,9 +736,9 @@ PropertiesPage::blue_spinbox_changed (double value)
void void
PropertiesPage::black_to_white () PropertiesPage::black_to_white ()
{ {
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes; std::vector <std::pair <double, std::pair<tl::Color, tl::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 (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 (lay::Color (255, 255, 255), lay::Color (255, 255, 255)))); 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); false_color_control->set_nodes (nodes);
emit edited (); emit edited ();
} }
@ -746,9 +746,9 @@ PropertiesPage::black_to_white ()
void void
PropertiesPage::white_to_black () PropertiesPage::white_to_black ()
{ {
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes; std::vector <std::pair <double, std::pair<tl::Color, tl::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 (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 (lay::Color (0, 0, 0), lay::Color (0, 0, 0)))); 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); false_color_control->set_nodes (nodes);
emit edited (); emit edited ();
} }
@ -756,9 +756,9 @@ PropertiesPage::white_to_black ()
void void
PropertiesPage::red_to_blue () PropertiesPage::red_to_blue ()
{ {
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes; std::vector <std::pair <double, std::pair<tl::Color, tl::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 (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 (lay::Color (0, 0, 255), lay::Color (0, 0, 255)))); 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); false_color_control->set_nodes (nodes);
emit edited (); emit edited ();
} }
@ -766,9 +766,9 @@ PropertiesPage::red_to_blue ()
void void
PropertiesPage::blue_to_red () PropertiesPage::blue_to_red ()
{ {
std::vector <std::pair <double, std::pair<lay::Color, lay::Color> > > nodes; std::vector <std::pair <double, std::pair<tl::Color, tl::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 (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 (lay::Color (255, 0, 0), lay::Color (255, 0, 0)))); 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); false_color_control->set_nodes (nodes);
emit edited (); emit edited ();
} }
@ -776,7 +776,7 @@ PropertiesPage::blue_to_red ()
void void
PropertiesPage::reverse_color_order () 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) { 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.second, nodes [nodes.size () - 1 - i].second.first);
std::swap (nodes [i].second.first, nodes [nodes.size () - 1 - i].second.second); 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 dpx = (p2.x () - p1.x ()) / double (xstop - xstart);
double dpy = (p2.y () - p1.y ()) / 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; tl::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 *pixel_data = (tl::color_t *) image_object.pixel_data ();
const unsigned char *mask_data = image_object.mask (); const unsigned char *mask_data = image_object.mask ();
for (int x = xstart; x < xstop; ++x) { for (int x = xstart; x < xstop; ++x) {

View File

@ -373,7 +373,7 @@ namespace {
struct ColorMapConverter 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; std::string s;
s = tl::to_string (cm.first); s = tl::to_string (cm.first);
@ -389,7 +389,7 @@ namespace {
return s; 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 ()); 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_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 (&ImageProxy::data_mapping, &ImageProxy::set_data_mapping, "data-mapping",
tl::make_element (&img::DataMapping::false_color_nodes, "color-map", 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::brightness, "brightness") +
tl::make_member (&img::DataMapping::contrast, "contrast") + tl::make_member (&img::DataMapping::contrast, "contrast") +

View File

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

View File

@ -26,7 +26,7 @@
#define HDR_imgWidgets #define HDR_imgWidgets
#include "layWidgets.h" #include "layWidgets.h"
#include "layColor.h" #include "tlColor.h"
#include "imgObject.h" #include "imgObject.h"
#include <QObject> #include <QObject>
@ -111,9 +111,9 @@ public:
return m_selected >= 0; 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; return m_nodes;
} }
@ -132,7 +132,7 @@ signals:
private: private:
bool m_dragging; bool m_dragging;
int m_selected; 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; std::vector <size_t> m_histogram;
}; };

View File

@ -45,9 +45,9 @@ TEST(1_FloatMono)
dm.gamma = 1.5; dm.gamma = 1.5;
dm.brightness = 1.25; dm.brightness = 1.25;
dm.false_color_nodes.clear (); 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.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 (lay::Color (255, 0, 0), lay::Color (0, 255, 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 (lay::Color (255, 255, 255), lay::Color (255, 255, 255)))); 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_data_mapping (dm);
image.set_pixel (0, 0, 0.25); image.set_pixel (0, 0, 0.25);

View File

@ -101,8 +101,8 @@ TEST(1)
dm.red_gain = 1.25; dm.red_gain = 1.25;
dm.green_gain = 0.75; dm.green_gain = 0.75;
dm.blue_gain = 2.5; dm.blue_gain = 2.5;
lay::Color c (128, 255, 64); tl::Color c (128, 255, 64);
lay::Color c2 (64, 32, 192); 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))); 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); image.set_data_mapping (dm);
EXPECT_EQ (copy1.equals (&image), false); EXPECT_EQ (copy1.equals (&image), false);
@ -226,7 +226,7 @@ TEST(2)
dm.red_gain = 1.25; dm.red_gain = 1.25;
dm.green_gain = 0.75; dm.green_gain = 0.75;
dm.blue_gain = 2.5; 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))); 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); image.set_data_mapping (dm);
EXPECT_EQ (copy1.equals (&image), false); EXPECT_EQ (copy1.equals (&image), false);

View File

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

View File

@ -299,22 +299,22 @@ static void clear_lower_hier_level (lay::LayerProperties *n)
n->set_source (s); 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); 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); 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); 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); 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) 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) 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) 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) #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) 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 #endif

View File

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

View File

@ -46,16 +46,16 @@ static void fill_with_qcolor (lay::PixelBuffer *pb, QColor c)
} }
#endif #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 ()) { if (x < pb->width () && y < pb->height ()) {
return pb->scan_line (y)[x]; return pb->scan_line (y)[x];
} else { } 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 ()) { if (! pb->transparent ()) {
c |= 0xff000000; // ensures that alpha is set properly even if not required 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<lay::ViewOp> view_ops;
std::vector<const lay::Bitmap *> pbitmaps; 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; std::vector<uint32_t> non_empty_sls;
view_ops.reserve (n_in); view_ops.reserve (n_in);
@ -588,13 +588,13 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
if (masks.size () > 0) { 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; uint32_t *dptr_end = dptr;
unsigned int i = 0; unsigned int i = 0;
for (unsigned int x = 0; x < width; x += 32, ++i) { for (unsigned int x = 0; x < width; x += 32, ++i) {
lay::color_t y[32]; tl::color_t y[32];
if (transparent) { if (transparent) {
for (int i = 0; i < 32; ++i) { for (int i = 0; i < 32; ++i) {
y[i] = 0; 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, 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<lay::ViewOp> view_ops;
std::vector<const lay::Bitmap *> pbitmaps; 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; std::vector<uint32_t> non_empty_sls;
view_ops.reserve (n_in); view_ops.reserve (n_in);
@ -825,7 +825,7 @@ bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in,
if (masks.size () > 0) { 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; uint32_t *dptr_end = dptr;
unsigned int i = 0; unsigned int i = 0;

View File

@ -87,7 +87,7 @@ ColorPalette::ColorPalette ()
// .. nothing yet .. // .. 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) : m_colors (colors), m_luminous_color_indices (luminous_colors)
{ {
// .. nothing yet .. // .. 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; 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 ColorPalette::color_by_index (unsigned int n) const
{ {
return m_colors [n % colors ()]; return m_colors [n % colors ()];
@ -140,7 +140,7 @@ ColorPalette::luminous_colors () const
} }
void 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) { while (m_colors.size () <= n) {
m_colors.push_back (0); m_colors.push_back (0);
@ -180,7 +180,7 @@ ColorPalette::to_string () const
res += " "; 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); 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) { 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); 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 ("[")) { if (x.test ("[")) {
x.read (lc).expect ("]"); x.read (lc).expect ("]");

View File

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

View File

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

View File

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

View File

@ -63,7 +63,7 @@ public:
uint32_t cursor_color (lay::ViewObjectCanvas &canvas) const uint32_t cursor_color (lay::ViewObjectCanvas &canvas) const
{ {
lay::Color color; tl::Color color;
if (mp_service) { if (mp_service) {
color = mp_service->tracking_cursor_color (); 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) { if (name == cfg_tracking_cursor_color) {
lay::Color color; tl::Color color;
lay::ColorConverter ().from_string (value, color); lay::ColorConverter ().from_string (value, color);
if (color != m_cursor_color) { if (color != m_cursor_color) {

View File

@ -92,7 +92,7 @@ public:
/** /**
* @brief Gets the tracking cursor color * @brief Gets the tracking cursor color
*/ */
lay::Color tracking_cursor_color () const tl::Color tracking_cursor_color () const
{ {
return m_cursor_color; return m_cursor_color;
} }
@ -133,7 +133,7 @@ protected:
private: private:
// The marker representing the mouse cursor // The marker representing the mouse cursor
std::vector<lay::ViewObject *> m_mouse_cursor_markers; std::vector<lay::ViewObject *> m_mouse_cursor_markers;
lay::Color m_cursor_color; tl::Color m_cursor_color;
bool m_cursor_enabled; bool m_cursor_enabled;
bool m_has_tracking_position; bool m_has_tracking_position;
db::DPoint m_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 * All channels are scaled the same way in order not to change the
* color but the brightness alone. * color but the brightness alone.
*/ */
color_t tl::color_t
LayerProperties::brighter (color_t in, int x) LayerProperties::brighter (tl::color_t in, int x)
{ {
// shortcut for no correction // shortcut for no correction
if (x == 0) { if (x == 0) {
@ -248,25 +248,25 @@ LayerProperties::is_visual () const
return valid (true) && visible (true) && (layer_index () >= 0 || is_cell_box_layer ()); return valid (true) && visible (true) && (layer_index () >= 0 || is_cell_box_layer ());
} }
color_t tl::color_t
LayerProperties::eff_frame_color (bool real) const LayerProperties::eff_frame_color (bool real) const
{ {
return brighter (frame_color (real) & 0xffffff, frame_brightness (real)); return brighter (frame_color (real) & 0xffffff, frame_brightness (real));
} }
color_t tl::color_t
LayerProperties::eff_fill_color (bool real) const LayerProperties::eff_fill_color (bool real) const
{ {
return brighter (fill_color (real) & 0xffffff, fill_brightness (real)); 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 LayerProperties::eff_frame_color_brighter (bool real, int plus_brightness) const
{ {
return brighter (frame_color (real) & 0xffffff, frame_brightness (real) + plus_brightness); 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 LayerProperties::eff_fill_color_brighter (bool real, int plus_brightness) const
{ {
return brighter (fill_color (real) & 0xffffff, fill_brightness (real) + plus_brightness); return brighter (fill_color (real) & 0xffffff, fill_brightness (real) + plus_brightness);
@ -1645,21 +1645,21 @@ LayerPropertiesList::back () const
struct UIntColorConverter struct UIntColorConverter
: private ColorConverter : private ColorConverter
{ {
std::string to_string (const color_t &c) const std::string to_string (const tl::color_t &c) const
{ {
if (c == 0) { if (c == 0) {
return ""; return "";
} else { } 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 ()) { if (s.empty ()) {
c = 0; c = 0;
} else { } else {
lay::Color qc; tl::Color qc;
ColorConverter::from_string (s, qc); ColorConverter::from_string (s, qc);
c = qc.rgb () | 0xff000000; c = qc.rgb () | 0xff000000;
} }
@ -1767,8 +1767,8 @@ struct LineStyleIndexConverter
static const tl::XMLElementList layer_element = tl::XMLElementList ( static const tl::XMLElementList layer_element = tl::XMLElementList (
// HINT: these make_member calls want to be qualified: otherwise an internal error // HINT: these make_member calls want to be qualified: otherwise an internal error
// was observed .. // was observed ..
tl::make_member<lay::color_t, LayerPropertiesNode> (&LayerPropertiesNode::frame_color_loc, &LayerPropertiesNode::set_frame_color_code, "frame-color", UIntColorConverter ()) + tl::make_member<tl::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::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::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::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 ()) + 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 * @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 * @brief render the effective frame color
@ -145,7 +145,7 @@ public:
* The effective frame color is computed from the frame color brightness and the * The effective frame color is computed from the frame color brightness and the
* frame color. * 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 * @brief render the effective fill color
@ -153,7 +153,7 @@ public:
* The effective fill color is computed from the frame color brightness and the * The effective fill color is computed from the frame color brightness and the
* frame color. * 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 * @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 * This method returns the effective frame color with an additional brightness adjustment
* applied. * 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 * @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 * This method returns the effective fill color with an additional brightness adjustment
* applied. * 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 * @brief Get the frame color
* *
* This method may return an invalid color if the color is not set. * 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) { if (real) {
ensure_visual_realized (); ensure_visual_realized ();
@ -193,7 +193,7 @@ public:
* To clear the frame color, pass 0 to this method. Valid colors have the * To clear the frame color, pass 0 to this method. Valid colors have the
* upper 8 bits set. * upper 8 bits set.
*/ */
void set_frame_color_code (color_t c) void set_frame_color_code (tl::color_t c)
{ {
refresh (); refresh ();
if (m_frame_color != c) { if (m_frame_color != c) {
@ -205,7 +205,7 @@ public:
/** /**
* @brief Set the frame color to the given value * @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); set_frame_color_code (c | 0xff000000);
} }
@ -231,7 +231,7 @@ public:
* *
* This method may return an invalid color if the color is not set. * 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) { if (real) {
ensure_visual_realized (); ensure_visual_realized ();
@ -248,7 +248,7 @@ public:
* To clear the fill color, pass 0 to this method. Valid colors have the * To clear the fill color, pass 0 to this method. Valid colors have the
* upper 8 bits set. * upper 8 bits set.
*/ */
void set_fill_color_code (color_t c) void set_fill_color_code (tl::color_t c)
{ {
refresh (); refresh ();
if (m_fill_color != c) { if (m_fill_color != c) {
@ -260,7 +260,7 @@ public:
/** /**
* @brief Set the fill color to the given value * @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); set_fill_color_code (c | 0xff000000);
} }
@ -844,8 +844,8 @@ public:
/** /**
* @brief Adaptors required for the XML reader * @brief Adaptors required for the XML reader
*/ */
color_t frame_color_loc () const { return frame_color (false); } tl::color_t frame_color_loc () const { return frame_color (false); }
color_t fill_color_loc () const { return fill_color (false); } tl::color_t fill_color_loc () const { return fill_color (false); }
int frame_brightness_loc () const { return frame_brightness (false); } int frame_brightness_loc () const { return frame_brightness (false); }
int fill_brightness_loc () const { return fill_brightness (false); } int fill_brightness_loc () const { return fill_brightness (false); }
int dither_pattern_loc () const { return dither_pattern (false); } int dither_pattern_loc () const { return dither_pattern (false); }
@ -928,10 +928,10 @@ private:
// the generation number // the generation number
size_t m_gen_id; size_t m_gen_id;
// display styles // display styles
color_t m_frame_color; tl::color_t m_frame_color;
mutable color_t m_frame_color_real; mutable tl::color_t m_frame_color_real;
color_t m_fill_color; tl::color_t m_fill_color;
mutable color_t m_fill_color_real; mutable tl::color_t m_fill_color_real;
int m_frame_brightness; int m_frame_brightness;
mutable int m_frame_brightness_real; mutable int m_frame_brightness_real;
int m_fill_brightness; 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_do_end_of_drawing_dm (this, &LayoutCanvas::do_end_of_drawing),
m_image_cache_size (1) 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 defined(HAVE_QT)
if (widget ()) { if (widget ()) {
@ -303,9 +303,9 @@ LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view)
widget ()->setObjectName (QString::fromUtf8 ("canvas")); widget ()->setObjectName (QString::fromUtf8 ("canvas"));
widget ()->setBackgroundRole (QPalette::NoRole); widget ()->setBackgroundRole (QPalette::NoRole);
bg = lay::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Window).rgb ()); bg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Window).rgb ());
fg = lay::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Text).rgb ()); fg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Text).rgb ());
active = lay::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Mid).rgb ()); active = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Mid).rgb ());
widget ()->setAttribute (Qt::WA_NoSystemBackground); widget ()->setAttribute (Qt::WA_NoSystemBackground);
@ -393,7 +393,7 @@ LayoutCanvas::set_oversampling (unsigned int os)
} }
void 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_background = background.rgb ();
m_foreground = foreground.rgb (); m_foreground = foreground.rgb ();
@ -712,7 +712,7 @@ class DetachedViewObjectCanvas
: public BitmapViewObjectCanvas : public BitmapViewObjectCanvas
{ {
public: 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), : BitmapViewObjectCanvas (width_l, height_l, resolution),
m_bg (bg), m_fg (fg), m_ac (ac), mp_image (img) 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; return m_bg;
} }
lay::Color foreground_color () const tl::Color foreground_color () const
{ {
return m_fg; return m_fg;
} }
lay::Color active_color () const tl::Color active_color () const
{ {
return m_ac; return m_ac;
} }
@ -780,7 +780,7 @@ public:
} }
private: 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;
lay::PixelBuffer *mp_image_l; lay::PixelBuffer *mp_image_l;
double m_gamma; double m_gamma;
@ -809,17 +809,17 @@ public:
clear_fg_bitmaps (); clear_fg_bitmaps ();
} }
lay::Color background_color () const tl::Color background_color () const
{ {
return m_bg ? 0xffffffff : 0; return m_bg ? 0xffffffff : 0;
} }
lay::Color foreground_color () const tl::Color foreground_color () const
{ {
return m_fg ? 0xffffffff : 0; return m_fg ? 0xffffffff : 0;
} }
lay::Color active_color () const tl::Color active_color () const
{ {
return m_ac ? 0xffffffff : 0; return m_ac ? 0xffffffff : 0;
} }
@ -831,11 +831,11 @@ private:
lay::PixelBuffer lay::PixelBuffer
LayoutCanvas::image (unsigned int width, unsigned int height) 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 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) { if (oversampling <= 0) {
oversampling = m_oversampling; oversampling = m_oversampling;
@ -911,7 +911,7 @@ LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int l
} }
lay::BitmapBuffer 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) { if (linewidth <= 0) {
linewidth = 1; linewidth = 1;

View File

@ -31,7 +31,7 @@
#include "layViewOp.h" #include "layViewOp.h"
#include "layViewObject.h" #include "layViewObject.h"
#include "layBitmap.h" #include "layBitmap.h"
#include "layColor.h" #include "tlColor.h"
#include "layDrawing.h" #include "layDrawing.h"
#include "layDitherPattern.h" #include "layDitherPattern.h"
#include "layLineStyles.h" #include "layLineStyles.h"
@ -143,7 +143,7 @@ public:
LayoutCanvas (lay::LayoutViewBase *view); LayoutCanvas (lay::LayoutViewBase *view);
~LayoutCanvas (); ~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 * @brief Set the view ops for the layers
@ -166,8 +166,8 @@ public:
lay::PixelBuffer screenshot (); lay::PixelBuffer screenshot ();
lay::PixelBuffer image (unsigned int width, unsigned int height); 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::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, lay::Color background, lay::Color foreground, lay::Color active, 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 (); void update_image ();
@ -288,25 +288,25 @@ public:
/** /**
* @brief Reimplementation of ViewObjectCanvas: Background color * @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 * @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 * @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; lay::PixelBuffer *mp_image_fg;
db::DBox m_precious_box; db::DBox m_precious_box;
lay::Viewport m_viewport, m_viewport_l; lay::Viewport m_viewport, m_viewport_l;
lay::color_t m_background; tl::color_t m_background;
lay::color_t m_foreground; tl::color_t m_foreground;
lay::color_t m_active; tl::color_t m_active;
std::vector <lay::ViewOp> m_view_ops; std::vector <lay::ViewOp> m_view_ops;
lay::DitherPattern m_dither_pattern; lay::DitherPattern m_dither_pattern;
lay::LineStyles m_line_styles; lay::LineStyles m_line_styles;

View File

@ -327,7 +327,7 @@ LayoutViewBase::init (db::Manager *mgr)
m_paste_display_mode = 2; m_paste_display_mode = 2;
m_guiding_shape_visible = true; m_guiding_shape_visible = true;
m_guiding_shape_line_width = 1; 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_guiding_shape_vertex_size = 5;
m_to_level = 0; m_to_level = 0;
m_ctx_dimming = 50; m_ctx_dimming = 50;
@ -713,7 +713,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_background_color) { } else if (name == cfg_background_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
background_color (color); background_color (color);
// do not take - let others receive the background color events as well // 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) { } else if (name == cfg_ctx_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
ctx_color (color); ctx_color (color);
return true; return true;
@ -779,7 +779,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_child_ctx_color) { } else if (name == cfg_child_ctx_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
child_ctx_color (color); child_ctx_color (color);
return true; return true;
@ -863,14 +863,14 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_cell_box_color) { } else if (name == cfg_cell_box_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
cell_box_color (color); cell_box_color (color);
return true; return true;
} else if (name == cfg_text_color) { } else if (name == cfg_text_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
text_color (color); text_color (color);
return true; return true;
@ -989,14 +989,14 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_guiding_shape_color) { } else if (name == cfg_guiding_shape_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
guiding_shapes_color (color); guiding_shapes_color (color);
return true; return true;
} else if (name == cfg_guiding_shape_color) { } else if (name == cfg_guiding_shape_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
guiding_shapes_color (color); guiding_shapes_color (color);
return true; return true;
@ -1151,7 +1151,7 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
} else if (name == cfg_sel_color) { } else if (name == cfg_sel_color) {
lay::Color color; tl::Color color;
lay::ColorConverter ().from_string (value, color); lay::ColorConverter ().from_string (value, color);
// Change the color // Change the color
@ -2503,7 +2503,7 @@ LayoutViewBase::init_layer_properties (LayerProperties &p) const
void void
LayoutViewBase::init_layer_properties (LayerProperties &p, const LayerPropertiesList &lp_list) const 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) { if (m_palette.luminous_colors () > 0) {
c = m_palette.luminous_color_by_index (p.source (true /*real*/).color_index ()); 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) #if defined(HAVE_QT)
QImage QImage
LayoutViewBase::get_image_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, 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"))); 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 lay::PixelBuffer
LayoutViewBase::get_pixels_with_options (unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, 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"))); 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 lay::BitmapBuffer
LayoutViewBase::get_pixels_with_options_mono (unsigned int width, unsigned int height, int linewidth, 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"))); 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 void
LayoutViewBase::save_image_with_options (const std::string &fn, LayoutViewBase::save_image_with_options (const std::string &fn,
unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, 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"))); 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 void
LayoutViewBase::save_image_with_options (const std::string &fn, LayoutViewBase::save_image_with_options (const std::string &fn,
unsigned int width, unsigned int height, int linewidth, int oversampling, double resolution, 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"))); 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 void
LayoutViewBase::save_image_with_options (const std::string &, LayoutViewBase::save_image_with_options (const std::string &,
unsigned int, unsigned int, int, int, double, 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"))); 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; std::vector <lay::ViewOp> view_ops;
view_ops.reserve (nlayers * planes_per_layer + special_planes_before + special_planes_after); 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 ()) { if (! m_box_color.is_valid ()) {
box_color = mp_canvas->foreground_color (); box_color = mp_canvas->foreground_color ();
} else { } else {
@ -3854,7 +3854,7 @@ LayoutViewBase::set_view_ops ()
// produce the ViewOps for the guiding shapes // 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 ()) { if (m_guiding_shape_color.is_valid ()) {
gs_color = m_guiding_shape_color.rgb (); gs_color = m_guiding_shape_color.rgb ();
} }
@ -3863,7 +3863,7 @@ LayoutViewBase::set_view_ops ()
lay::ViewOp::Mode mode = lay::ViewOp::Copy; 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 int dp = 1; // no stipples for guiding shapes
if (ctx == 0) { 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 dp = m_no_stipples ? 1 : l->dither_pattern (true /*real*/);
int ls = l->line_style (true /*real*/); int ls = l->line_style (true /*real*/);
@ -4081,7 +4081,7 @@ LayoutViewBase::guiding_shapes_visible (bool v)
} }
void void
LayoutViewBase::guiding_shapes_color (lay::Color c) LayoutViewBase::guiding_shapes_color (tl::Color c)
{ {
if (c != m_guiding_shape_color) { if (c != m_guiding_shape_color) {
m_guiding_shape_color = c; m_guiding_shape_color = c;
@ -4144,7 +4144,7 @@ LayoutViewBase::drop_small_cells_cond (drop_small_cells_cond_type t)
} }
void void
LayoutViewBase::cell_box_color (lay::Color c) LayoutViewBase::cell_box_color (tl::Color c)
{ {
if (c != m_box_color) { if (c != m_box_color) {
m_box_color = c; m_box_color = c;
@ -4266,7 +4266,7 @@ LayoutViewBase::set_palette (const lay::LineStylePalette &p)
} }
void void
LayoutViewBase::ctx_color (lay::Color c) LayoutViewBase::ctx_color (tl::Color c)
{ {
if (c != m_ctx_color) { if (c != m_ctx_color) {
m_ctx_color = c; m_ctx_color = c;
@ -4293,7 +4293,7 @@ LayoutViewBase::ctx_hollow (bool h)
} }
void void
LayoutViewBase::child_ctx_color (lay::Color c) LayoutViewBase::child_ctx_color (tl::Color c)
{ {
if (c != m_child_ctx_color) { if (c != m_child_ctx_color) {
m_child_ctx_color = c; m_child_ctx_color = c;
@ -4349,20 +4349,20 @@ LayoutViewBase::abstract_mode_enabled (bool e)
} }
} }
lay::Color tl::Color
LayoutViewBase::default_background_color () LayoutViewBase::default_background_color ()
{ {
return lay::Color (0, 0, 0); // black. return tl::Color (0, 0, 0); // black.
} }
void 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 .. // .. nothing yet ..
} }
void void
LayoutViewBase::background_color (lay::Color c) LayoutViewBase::background_color (tl::Color c)
{ {
if (c == mp_canvas->background_color ()) { if (c == mp_canvas->background_color ()) {
return; return;
@ -4373,11 +4373,11 @@ LayoutViewBase::background_color (lay::Color c)
c = default_background_color (); c = default_background_color ();
} }
lay::Color contrast; tl::Color contrast;
if (c.to_mono ()) { if (c.to_mono ()) {
contrast = lay::Color (0, 0, 0); contrast = tl::Color (0, 0, 0);
} else { } else {
contrast = lay::Color (255, 255, 255); contrast = tl::Color (255, 255, 255);
} }
do_set_background_color (c, contrast); do_set_background_color (c, contrast);
@ -4987,7 +4987,7 @@ LayoutViewBase::show_markers (bool f)
} }
void void
LayoutViewBase::text_color (lay::Color c) LayoutViewBase::text_color (tl::Color c)
{ {
if (m_text_color != c) { if (m_text_color != c) {
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 * The effective frame color is computed from the frame color brightness and the
* frame color. * frame color.
*/ */
color_t eff_frame_color () const; tl::color_t eff_frame_color () const;
/** /**
* @brief render the effective frame color * @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 * The effective frame color is computed from the frame color brightness and the
* frame color. * frame color.
*/ */
color_t eff_fill_color () const; tl::color_t eff_fill_color () const;
// display styles // display styles
color_t frame_color; tl::color_t frame_color;
color_t fill_color; tl::color_t fill_color;
int frame_brightness; int frame_brightness;
int fill_brightness; int fill_brightness;
unsigned int dither_pattern; 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 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 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 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 background The background color or tl::Color() for default
* @param foreground The foreground color or lay::Color() for default * @param foreground The foreground color or tl::Color() for default
* @param active The active color or lay::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 target_box The box to draw or db::DBox() for default
* @param monochrome If true, monochrome images will be produced * @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) #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 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 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 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 background The background color or tl::Color() for default
* @param foreground The foreground color or lay::Color() for default * @param foreground The foreground color or tl::Color() for default
* @param active The active color or lay::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 target_box The box to draw or db::DBox() for default
* @param monochrome If true, monochrome images will be produced * @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 #endif
/** /**
@ -901,12 +901,12 @@ public:
* @param linewidth The width of a line in pixels (usually 1) or 0 for default * @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 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 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 background The background color or tl::Color() for default
* @param foreground The foreground color or lay::Color() for default * @param foreground The foreground color or tl::Color() for default
* @param active The active color or lay::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 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 * @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 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 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 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 background The background color or tl::Color() for default
* @param foreground The foreground color or lay::Color() for default * @param foreground The foreground color or tl::Color() for default
* @param active The active color or lay::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 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%. * 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 * @brief Hierarchy level selection setter
@ -980,12 +980,12 @@ public:
/** /**
* @brief Cell box/label color setter * @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 * @brief Cell box/label getter
*/ */
lay::Color cell_box_color () const tl::Color cell_box_color () const
{ {
return m_box_color; return m_box_color;
} }
@ -1178,12 +1178,12 @@ public:
/** /**
* @brief Text object color * @brief Text object color
*/ */
void text_color (lay::Color c); void text_color (tl::Color c);
/** /**
* @brief Text object color * @brief Text object color
*/ */
lay::Color text_color () const tl::Color text_color () const
{ {
return m_text_color; return m_text_color;
} }
@ -1697,7 +1697,7 @@ public:
/** /**
* @brief Background color property * @brief Background color property
*/ */
lay::Color background_color () const tl::Color background_color () const
{ {
return mp_canvas->background_color (); return mp_canvas->background_color ();
} }
@ -1705,7 +1705,7 @@ public:
/** /**
* @brief Foreground color property * @brief Foreground color property
*/ */
lay::Color foreground_color () const tl::Color foreground_color () const
{ {
return mp_canvas->foreground_color (); return mp_canvas->foreground_color ();
} }
@ -1713,7 +1713,7 @@ public:
/** /**
* @brief Active color property * @brief Active color property
*/ */
lay::Color active_color () const tl::Color active_color () const
{ {
return mp_canvas->active_color (); return mp_canvas->active_color ();
} }
@ -1773,7 +1773,7 @@ public:
/** /**
* @brief Gets the guiding shapes color * @brief Gets the guiding shapes color
*/ */
lay::Color guiding_shapes_color () const tl::Color guiding_shapes_color () const
{ {
return m_guiding_shape_color; return m_guiding_shape_color;
} }
@ -1781,7 +1781,7 @@ public:
/** /**
* @brief Sets the guiding shapes color * @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 * @brief Gets the guiding shapes line width
@ -2205,7 +2205,7 @@ public:
/** /**
* @brief Get the default color for markers * @brief Get the default color for markers
*/ */
lay::Color default_marker_color () const tl::Color default_marker_color () const
{ {
return m_marker_color; return m_marker_color;
} }
@ -2687,15 +2687,15 @@ private:
int m_paste_display_mode; int m_paste_display_mode;
int m_wheel_mode; int m_wheel_mode;
bool m_guiding_shape_visible; 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_line_width;
int m_guiding_shape_vertex_size; int m_guiding_shape_vertex_size;
lay::Color m_ctx_color; tl::Color m_ctx_color;
int m_ctx_dimming; int m_ctx_dimming;
bool m_ctx_hollow; bool m_ctx_hollow;
lay::Color m_child_ctx_color; tl::Color m_child_ctx_color;
int m_child_ctx_dimming; int m_child_ctx_dimming;
bool m_child_ctx_hollow; bool m_child_ctx_hollow;
bool m_child_ctx_enabled; bool m_child_ctx_enabled;
@ -2703,13 +2703,13 @@ private:
double m_abstract_mode_width; double m_abstract_mode_width;
bool m_abstract_mode_enabled; bool m_abstract_mode_enabled;
lay::Color m_box_color; tl::Color m_box_color;
bool m_box_text_transform; bool m_box_text_transform;
unsigned int m_box_font; unsigned int m_box_font;
int m_min_size_for_label; int m_min_size_for_label;
bool m_cell_box_visible; bool m_cell_box_visible;
lay::Color m_marker_color; tl::Color m_marker_color;
int m_marker_line_width; int m_marker_line_width;
int m_marker_vertex_size; int m_marker_vertex_size;
int m_marker_dither_pattern; int m_marker_dither_pattern;
@ -2727,7 +2727,7 @@ private:
bool m_text_lazy_rendering; bool m_text_lazy_rendering;
bool m_bitmap_caching; bool m_bitmap_caching;
bool m_show_properties; bool m_show_properties;
lay::Color m_text_color; tl::Color m_text_color;
bool m_apply_text_trans; bool m_apply_text_trans;
double m_default_text_size; double m_default_text_size;
unsigned int m_text_font; unsigned int m_text_font;
@ -2797,11 +2797,11 @@ private:
void do_redraw (); void do_redraw ();
void set_view_ops (); void set_view_ops ();
void background_color (lay::Color c); void background_color (tl::Color c);
void ctx_color (lay::Color c); void ctx_color (tl::Color c);
void ctx_dimming (int percent); void ctx_dimming (int percent);
void ctx_hollow (bool h); 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_dimming (int percent);
void child_ctx_hollow (bool h); void child_ctx_hollow (bool h);
void child_ctx_enabled (bool e); void child_ctx_enabled (bool e);
@ -2845,8 +2845,8 @@ protected:
void free_resources (); void free_resources ();
void shutdown (); void shutdown ();
virtual lay::Color default_background_color (); virtual tl::Color default_background_color ();
virtual void do_set_background_color (lay::Color color, lay::Color contrast); virtual void do_set_background_color (tl::Color color, tl::Color contrast);
virtual void do_paste (); virtual void do_paste ();
virtual void begin_layer_updates (); virtual void begin_layer_updates ();
virtual void end_layer_updates (); virtual void end_layer_updates ();

View File

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

View File

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

View File

@ -38,7 +38,7 @@ NetColorizer::NetColorizer ()
} }
void 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; m_marker_color = marker_color;
if (auto_colors) { if (auto_colors) {
@ -58,7 +58,7 @@ NetColorizer::has_color_for_net (const db::Net *net)
} }
void 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; m_custom_color[net] = color;
emit_colors_changed (); emit_colors_changed ();
@ -110,14 +110,14 @@ NetColorizer::emit_colors_changed ()
} }
} }
lay::Color tl::Color
NetColorizer::color_of_net (const db::Net *net) const NetColorizer::color_of_net (const db::Net *net) const
{ {
if (! net) { 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 ()) { if (c != m_custom_color.end ()) {
return c->second; 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); return m_auto_colors.color_by_index ((unsigned int) index);
} else { } else {
return lay::Color (); return tl::Color ();
} }
} }

View File

@ -26,7 +26,7 @@
#include "laybasicCommon.h" #include "laybasicCommon.h"
#include "layColorPalette.h" #include "layColorPalette.h"
#include "layColor.h" #include "tlColor.h"
#include "tlEvents.h" #include "tlEvents.h"
#include <map> #include <map>
@ -49,15 +49,15 @@ class LAYBASIC_PUBLIC NetColorizer
public: public:
NetColorizer (); 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); 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 reset_color_of_net (const db::Net *net);
void clear (); 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; return m_marker_color;
} }
@ -68,10 +68,10 @@ public:
tl::Event colors_changed; tl::Event colors_changed;
private: private:
lay::Color m_marker_color; tl::Color m_marker_color;
lay::ColorPalette m_auto_colors; lay::ColorPalette m_auto_colors;
bool m_auto_colors_enabled; 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_update_needed;
bool m_signals_enabled; bool m_signals_enabled;
mutable std::map<const db::Net *, size_t> m_net_index_by_object; 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 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_data ()
{ {
m_width = w; 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)); 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_data ()
{ {
m_width = w; m_width = w;
m_height = h; m_height = h;
m_transparent = false; m_transparent = false;
tl_assert ((stride % sizeof (lay::color_t)) == 0); tl_assert ((stride % sizeof (tl::color_t)) == 0);
stride /= sizeof (lay::color_t); stride /= sizeof (tl::color_t);
lay::color_t *d = new lay::color_t [w * h]; tl::color_t *d = new tl::color_t [w * h];
lay::color_t *new_data = d; tl::color_t *new_data = d;
if (data) { if (data) {
for (unsigned int i = 0; i < h; ++i) { for (unsigned int i = 0; i < h; ++i) {
@ -181,11 +181,11 @@ PixelBuffer::operator== (const PixelBuffer &other) const
return false; 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) { for (unsigned int i = 0; i < other.height (); ++i) {
const lay::color_t *d = scan_line (i); const tl::color_t *d = scan_line (i);
const lay::color_t *de = d + width (); const tl::color_t *de = d + width ();
const lay::color_t *dd = other.scan_line (i); const tl::color_t *dd = other.scan_line (i);
while (d != de) { while (d != de) {
if (((*d++ ^ *dd++) & m) != 0) { if (((*d++ ^ *dd++) & m) != 0) {
return false; return false;
@ -239,13 +239,13 @@ PixelBuffer::swap (PixelBuffer &other)
} }
void void
PixelBuffer::fill (lay::color_t c) PixelBuffer::fill (tl::color_t c)
{ {
if (! transparent ()) { if (! transparent ()) {
c |= 0xff000000; // ensures that alpha is properly set 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 i = 0; i < m_height; ++i) {
for (unsigned int j = 0; j < m_width; ++j) { for (unsigned int j = 0; j < m_width; ++j) {
*d++ = c; *d++ = c;
@ -253,27 +253,27 @@ PixelBuffer::fill (lay::color_t c)
} }
} }
color_t * tl::color_t *
PixelBuffer::scan_line (unsigned int n) PixelBuffer::scan_line (unsigned int n)
{ {
tl_assert (n < m_height); tl_assert (n < m_height);
return m_data->data () + n * m_width; return m_data->data () + n * m_width;
} }
const color_t * const tl::color_t *
PixelBuffer::scan_line (unsigned int n) const PixelBuffer::scan_line (unsigned int n) const
{ {
tl_assert (n < m_height); tl_assert (n < m_height);
return m_data->data () + n * m_width; return m_data->data () + n * m_width;
} }
color_t * tl::color_t *
PixelBuffer::data () PixelBuffer::data ()
{ {
return m_data->data (); return m_data->data ();
} }
const color_t * const tl::color_t *
PixelBuffer::data () const PixelBuffer::data () const
{ {
return m_data->data (); 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) { if (img.format () != QImage::Format_ARGB32 && img.format () != QImage::Format_RGB32) {
QImage img_argb32 = img.convertToFormat (QImage::Format_ARGB32); 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 { } 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 #endif
@ -317,11 +317,11 @@ PixelBuffer::patch (const PixelBuffer &other)
tl_assert (height () == other.height ()); tl_assert (height () == other.height ());
tl_assert (other.transparent ()); tl_assert (other.transparent ());
const color_t *d = other.data (); const tl::color_t *d = other.data ();
color_t *dd = data (); tl::color_t *dd = data ();
for (unsigned int i = 0; i < m_height; ++i) { for (unsigned int i = 0; i < m_height; ++i) {
for (unsigned int j = 0; j < m_width; ++j) { for (unsigned int j = 0; j < m_width; ++j) {
color_t c = *d++; tl::color_t c = *d++;
if ((c & 0x80000000) != 0) { if ((c & 0x80000000) != 0) {
*dd = c; *dd = c;
} }
@ -339,9 +339,9 @@ PixelBuffer::diff (const PixelBuffer &other) const
PixelBuffer res (m_width, m_height); PixelBuffer res (m_width, m_height);
res.set_transparent (true); res.set_transparent (true);
const color_t *d2 = other.data (); const tl::color_t *d2 = other.data ();
const color_t *d1 = data (); const tl::color_t *d1 = data ();
color_t *dd = res.data (); tl::color_t *dd = res.data ();
for (unsigned int i = 0; i < m_height; ++i) { for (unsigned int i = 0; i < m_height; ++i) {
for (unsigned int j = 0; j < m_width; ++j) { for (unsigned int j = 0; j < m_width; ++j) {
@ -373,7 +373,7 @@ PixelBuffer::read_png (tl::InputStream &input)
tl_assert (info_ptr != NULL); tl_assert (info_ptr != NULL);
png_set_read_fn (png_ptr, (void *) &input, &read_from_stream_f); 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); 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) { 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); png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) { 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); 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); png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) { 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 *d = row_pointers [i];
const uint8_t *dd = d + rb; const uint8_t *dd = d + rb;
while (d < dd) { while (d < dd) {
lay::color_t b = *d++; tl::color_t b = *d++;
lay::color_t g = *d++; tl::color_t g = *d++;
lay::color_t r = *d++; tl::color_t r = *d++;
*c++ = 0xff000000 | ((r << 8 | g) << 8) | b; *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); png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) { 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 *d = row_pointers [i];
const uint8_t *dd = d + rb; const uint8_t *dd = d + rb;
while (d < dd) { while (d < dd) {
lay::color_t g = *d++; tl::color_t g = *d++;
lay::color_t a = *d++; tl::color_t a = *d++;
*c++ = (a << 24) | ((g << 8 | g) << 8) | g; *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); png_bytepp row_pointers = png_get_rows (png_ptr, info_ptr);
for (unsigned int i = 0; i < res.height (); ++i) { 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 *d = row_pointers [i];
const uint8_t *dd = d + rb; const uint8_t *dd = d + rb;
while (d < dd) { while (d < dd) {
lay::color_t g = *d++; tl::color_t g = *d++;
*c++ = 0xff000000 | ((g << 8 | g) << 8) | g; *c++ = 0xff000000 | ((g << 8 | g) << 8) | g;
} }
} }
@ -477,7 +477,7 @@ PixelBuffer::write_png (tl::OutputStream &output) const
tl_assert (info_ptr != NULL); tl_assert (info_ptr != NULL);
png_set_write_fn (png_ptr, (void *) &output, &write_to_stream_f, &flush_stream_f); 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 bd = 8; // bit depth
unsigned int fmt = transparent () ? PNG_COLOR_TYPE_RGBA : PNG_COLOR_TYPE_RGB; 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) { for (unsigned int i = 0; i < height (); ++i) {
uint8_t *d = buffer.get (); uint8_t *d = buffer.get ();
const lay::color_t *s = scan_line (i); const tl::color_t *s = scan_line (i);
const lay::color_t *se = s + width (); const tl::color_t *se = s + width ();
while (s != se) { while (s != se) {
lay::color_t c = *s++; tl::color_t c = *s++;
*d++ = c & 0xff; *d++ = c & 0xff;
c >>= 8; c >>= 8;
*d++ = c & 0xff; *d++ = c & 0xff;

View File

@ -24,7 +24,7 @@
#define HDR_layPixelBuffer #define HDR_layPixelBuffer
#include "laybasicCommon.h" #include "laybasicCommon.h"
#include "layColor.h" #include "tlColor.h"
#include "tlCopyOnWrite.h" #include "tlCopyOnWrite.h"
#include "tlStream.h" #include "tlStream.h"
#include "tlException.h" #include "tlException.h"
@ -65,7 +65,7 @@ public:
* @brief An 32bit RGB/RGBA image class * @brief An 32bit RGB/RGBA image class
* *
* This class substitutes QImage in Qt-less applications. * 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 class LAYBASIC_PUBLIC PixelBuffer
{ {
@ -78,7 +78,7 @@ public:
* *
* The size of the data block needs to be w*h elements. * 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 * @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). * "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. * 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 * @brief Default constructor
@ -172,33 +172,33 @@ public:
*/ */
unsigned int stride () const 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 * @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 * @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) * @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 * @brief Gets the data pointer
*/ */
color_t *data (); tl::color_t *data ();
/** /**
* @brief Gets the data pointer (const version) * @brief Gets the data pointer (const version)
*/ */
const color_t *data () const; const tl::color_t *data () const;
#if defined(HAVE_QT) #if defined(HAVE_QT)
/** /**
@ -287,7 +287,7 @@ private:
// .. nothing yet .. // .. nothing yet ..
} }
ImageData (lay::color_t *data, size_t length) ImageData (tl::color_t *data, size_t length)
: mp_data (data), m_length (length) : mp_data (data), m_length (length)
{ {
// .. nothing yet .. // .. nothing yet ..
@ -296,8 +296,8 @@ private:
ImageData (const ImageData &other) ImageData (const ImageData &other)
{ {
m_length = other.length (); m_length = other.length ();
mp_data = new lay::color_t [other.length ()]; mp_data = new tl::color_t [other.length ()];
memcpy (mp_data, other.data (), m_length * sizeof (lay::color_t)); memcpy (mp_data, other.data (), m_length * sizeof (tl::color_t));
} }
~ImageData () ~ImageData ()
@ -307,11 +307,11 @@ private:
} }
size_t length () const { return m_length; } size_t length () const { return m_length; }
lay::color_t *data () { return mp_data; } tl::color_t *data () { return mp_data; }
const lay::color_t *data () const { return mp_data; } const tl::color_t *data () const { return mp_data; }
private: private:
lay::color_t *mp_data; tl::color_t *mp_data;
size_t m_length; size_t m_length;
ImageData &operator= (const ImageData &other); ImageData &operator= (const ImageData &other);

View File

@ -36,7 +36,7 @@ PixelBufferPainter::PixelBufferPainter (lay::PixelBuffer &img, unsigned int widt
} }
void 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) { 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 (); ((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 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 ()) { if (p1.x () == p2.x ()) {
@ -79,7 +79,7 @@ PixelBufferPainter::draw_line (const db::Point &p1, const db::Point &p2, lay::Co
} }
void 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 y1 = std::min (p1.y (), p2.y ());
int y2 = std::max (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 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 y1 = std::min (p1.y (), p2.y ());
int y2 = std::max (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 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); const lay::FixedFont &ff = lay::FixedFont::get_font (m_resolution);
int x = p.x (), y = p.y (); int x = p.x (), y = p.y ();

View File

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

View File

@ -392,7 +392,7 @@ BitmapRedrawThreadCanvas::initialize_plane (lay::CanvasPlane *plane, unsigned in
} }
void 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) { if (width > m_width) {
width = m_width; width = m_width;

View File

@ -319,7 +319,7 @@ public:
/** /**
* @brief Transfer the content to a PixelBuffer * @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) * @brief Transfer the content to a BitmapBuffer (monochrome)

View File

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

View File

@ -55,7 +55,7 @@ public:
SelectionService (lay::LayoutViewBase *view); SelectionService (lay::LayoutViewBase *view);
~SelectionService (); ~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); void begin (const db::DPoint &pos);
bool dragging () const { return mp_box != 0; } 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 * @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 * @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 * @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) * @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) * @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 * @brief Get the resolution

View File

@ -34,7 +34,7 @@ ViewOp::ViewOp ()
init (0, Copy); 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_line_style_index (line_style_index),
m_dither_index (dither_index), m_dither_offset (dither_offset), m_dither_index (dither_index), m_dither_offset (dither_offset),
m_shape (shape), m_shape (shape),
@ -45,7 +45,7 @@ ViewOp::ViewOp (color_t color, Mode mode, unsigned int line_style_index, unsigne
} }
void 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_or = (mode == Copy || mode == Or) ? color : 0;
m_and = (mode == Copy || mode == And) ? color : wordones; m_and = (mode == Copy || mode == And) ? color : wordones;

View File

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

View File

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

View File

@ -41,7 +41,7 @@ public:
ZoomService (lay::LayoutViewBase *view); ZoomService (lay::LayoutViewBase *view);
~ZoomService (); ~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 (const db::DPoint &pos);
void begin_pan (const db::DPoint &pos); void begin_pan (const db::DPoint &pos);

View File

@ -44,7 +44,6 @@ SOURCES += \
layBitmapsToImage.cc \ layBitmapsToImage.cc \
layBookmarkList.cc \ layBookmarkList.cc \
layCellView.cc \ layCellView.cc \
layColor.cc \
layColorPalette.cc \ layColorPalette.cc \
layConverters.cc \ layConverters.cc \
layDispatcher.cc \ layDispatcher.cc \
@ -97,7 +96,6 @@ HEADERS += \
layBookmarkList.h \ layBookmarkList.h \
layCellView.h \ layCellView.h \
layColorPalette.h \ layColorPalette.h \
layColor.h \
layConverters.h \ layConverters.h \
layDispatcher.h \ layDispatcher.h \
layDisplayState.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 ()) { if (qimg2.width () == (int) qimg.width () && qimg2.height () == (int) qimg.height ()) {
for (int j = 0; j < qimg.height (); ++j) { for (int j = 0; j < qimg.height (); ++j) {
for (int i = 0; i < qimg.width (); ++i) { 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; return false;
} }
} }
@ -87,7 +87,7 @@ TEST(1)
lay::PixelBuffer img (15, 25); lay::PixelBuffer img (15, 25);
EXPECT_EQ (img.width (), 15); EXPECT_EQ (img.width (), 15);
EXPECT_EQ (img.height (), 25); 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); EXPECT_EQ (img.transparent (), false);
img.set_transparent (true); img.set_transparent (true);
@ -159,11 +159,11 @@ TEST(1)
EXPECT_EQ (img4.scan_line (5)[8], 0xff102030); EXPECT_EQ (img4.scan_line (5)[8], 0xff102030);
// other constructors // 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 tl::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.stride ()), img4), true);
lay::color_t *dnew = new lay::color_t [ 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 lay::color_t *) img4.data (), img4.width () * img4.height () * sizeof (lay::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); EXPECT_EQ (compare_images (lay::PixelBuffer (img4.width (), img4.height (), dnew), img4), true);
} }

View File

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

View File

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

View File

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

View File

@ -656,7 +656,7 @@ HierarchyControlPanel::current_cell (int cv_index, HierarchyControlPanel::cell_p
} }
void void
HierarchyControlPanel::set_background_color (lay::Color c) HierarchyControlPanel::set_background_color (tl::Color c)
{ {
m_background_color = c; m_background_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { 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 void
HierarchyControlPanel::set_text_color (lay::Color c) HierarchyControlPanel::set_text_color (tl::Color c)
{ {
m_text_color = c; m_text_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { 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 * @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 * @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 * @brief Select the active cellview
@ -306,8 +306,8 @@ private:
QFrame *mp_search_frame; QFrame *mp_search_frame;
QCheckBox *mp_search_close_cb; QCheckBox *mp_search_close_cb;
QSplitter *mp_splitter; QSplitter *mp_splitter;
lay::Color m_background_color; tl::Color m_background_color;
lay::Color m_text_color; tl::Color m_text_color;
tl::DeferredMethod<HierarchyControlPanel> m_do_update_content_dm; tl::DeferredMethod<HierarchyControlPanel> m_do_update_content_dm;
tl::DeferredMethod<HierarchyControlPanel> m_do_full_update_content_dm; tl::DeferredMethod<HierarchyControlPanel> m_do_full_update_content_dm;
std::unique_ptr<QStyle> mp_tree_style; std::unique_ptr<QStyle> mp_tree_style;

View File

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

View File

@ -168,12 +168,12 @@ public:
/** /**
* @brief Changing of the background color * @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 * @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 * @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); h = std::max ((unsigned int) 16, h);
w = std::max ((unsigned int) 16, w); w = std::max ((unsigned int) 16, w);
lay::color_t def_color = 0x808080; tl::color_t def_color = 0x808080;
lay::color_t fill_color = iter->has_fill_color (true) ? iter->eff_fill_color (true) : def_color; tl::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 frame_color = iter->has_frame_color (true) ? iter->eff_frame_color (true) : def_color;
lay::PixelBuffer image (w, h); lay::PixelBuffer image (w, h);
image.set_transparent (true); image.set_transparent (true);

View File

@ -490,7 +490,7 @@ LibrariesView::double_clicked (const QModelIndex & /*index*/)
} }
void void
LibrariesView::set_background_color (lay::Color c) LibrariesView::set_background_color (tl::Color c)
{ {
m_background_color = c; m_background_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { 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 void
LibrariesView::set_text_color (lay::Color c) LibrariesView::set_text_color (tl::Color c)
{ {
m_text_color = c; m_text_color = c;
for (std::vector <QTreeView *>::const_iterator f = mp_cell_lists.begin (); f != mp_cell_lists.end (); ++f) { 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 * @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 * @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 * @brief Sets the active library by name
@ -249,8 +249,8 @@ private:
QFrame *mp_search_frame; QFrame *mp_search_frame;
QCheckBox *mp_search_close_cb; QCheckBox *mp_search_close_cb;
QSplitter *mp_splitter; QSplitter *mp_splitter;
lay::Color m_background_color; tl::Color m_background_color;
lay::Color m_text_color; tl::Color m_text_color;
tl::DeferredMethod<LibrariesView> m_do_update_content_dm; tl::DeferredMethod<LibrariesView> m_do_update_content_dm;
tl::DeferredMethod<LibrariesView> m_do_full_update_content_dm; tl::DeferredMethod<LibrariesView> m_do_full_update_content_dm;
std::unique_ptr<QStyle> mp_tree_style; 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) { } else if (name == cfg_l2ndb_marker_color) {
lay::Color color; tl::Color color;
if (! value.empty ()) { if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color); lay::ColorConverter ().from_string (value, color);
} }

View File

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

View File

@ -701,7 +701,7 @@ static QIcon icon_for_subcircuit ()
return icon; 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 ()) { if (! color.is_valid ()) {
return icon_for_net (); return icon_for_net ();
@ -735,12 +735,12 @@ static QIcon colored_icon (const lay::Color &color, const QIcon &original_icon)
return colored_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 ()); 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 ()); 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)) { 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 ()); tl::color_t rgb = tl::color_t (color.rgb ());
std::map<lay::color_t, QIcon>::const_iterator c = m_net_icon_per_color.find (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 ()) { 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; 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)) { 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 ()); tl::color_t rgb = tl::color_t (color.rgb ());
std::map<lay::color_t, QIcon>::const_iterator c = m_connection_icon_per_color.find (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 ()) { 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; 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 #define HDR_layNetlistBrowserModel
#include "layColorPalette.h" #include "layColorPalette.h"
#include "layColor.h" #include "tlColor.h"
#include "layuiCommon.h" #include "layuiCommon.h"
#include "dbLayoutToNetlist.h" #include "dbLayoutToNetlist.h"
@ -331,8 +331,8 @@ private:
db::LayoutVsSchematic *mp_lvsdb; db::LayoutVsSchematic *mp_lvsdb;
NetColorizer *mp_colorizer; NetColorizer *mp_colorizer;
std::unique_ptr<IndexedNetlistModel> mp_indexer; std::unique_ptr<IndexedNetlistModel> mp_indexer;
mutable std::map<lay::color_t, QIcon> m_net_icon_per_color; mutable std::map<tl::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_connection_icon_per_color;
int m_object_column; int m_object_column;
int m_status_column; int m_status_column;
int m_first_column; int m_first_column;

View File

@ -230,7 +230,7 @@ NetlistBrowserPage::set_dispatcher (lay::Dispatcher *pr)
} }
void 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_colorizer.configure (color, auto_colors);
m_marker_line_width = line_width; m_marker_line_width = line_width;
@ -493,7 +493,7 @@ NetlistBrowserPage::selection_changed ()
} }
void 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 (); std::vector<const db::Net *> nets = selected_nets ();
@ -515,7 +515,7 @@ NetlistBrowserPage::browse_color_for_net ()
{ {
QColor c = QColorDialog::getColor (QColor (), this); QColor c = QColorDialog::getColor (QColor (), this);
if (c.isValid ()) { 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 ()); QAction *action = dynamic_cast<QAction *> (sender ());
if (action) { 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 tl::Color
NetlistBrowserPage::make_valid_color (const lay::Color &color) NetlistBrowserPage::make_valid_color (const tl::Color &color)
{ {
if (! color.is_valid () && mp_view) { 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 { } else {
return color; return color;
} }
@ -1111,7 +1111,7 @@ NetlistBrowserPage::produce_highlights_for_device (const db::Device *device, siz
{ {
const db::Layout *layout = mp_database->internal_layout (); 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 ()); db::Box device_bbox = bbox_for_device_abstract (layout, device->device_abstract (), device->trans ());
if (! device_bbox.empty ()) { 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 (); 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); db::Box circuit_bbox = bbox_for_circuit (layout, circuit);
if (circuit_bbox.empty ()) { if (circuit_bbox.empty ()) {
return false; 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 (); db::cell_index_type cell_index = net->circuit ()->cell_index ();
size_t cluster_id = net->cluster_id (); size_t cluster_id = net->cluster_id ();
lay::Color net_color = m_colorizer.color_of_net (net); tl::Color net_color = m_colorizer.color_of_net (net);
lay::Color fallback_color = make_valid_color (m_colorizer.marker_color ()); tl::Color fallback_color = make_valid_color (m_colorizer.marker_color ());
const db::Connectivity &conn = mp_database->connectivity (); const db::Connectivity &conn = mp_database->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) { 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 halo The halo flag or -1 for default
* @param dither_pattern The dither pattern index of -1 to take the 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) * @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::Device *> selected_devices ();
std::vector<const db::SubCircuit *> selected_subcircuits (); std::vector<const db::SubCircuit *> selected_subcircuits ();
std::vector<const db::Circuit *> selected_circuits (); 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); 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_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_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); 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) { } else if (name == cfg_rdb_marker_color) {
lay::Color color; tl::Color color;
if (! value.empty ()) { if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color); lay::ColorConverter ().from_string (value, color);
} }

View File

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

View File

@ -1610,7 +1610,7 @@ MarkerBrowserPage::set_dispatcher (lay::Dispatcher *pr)
} }
void 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_color = color;
m_marker_line_width = line_width; m_marker_line_width = line_width;

View File

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

View File

@ -28,7 +28,7 @@
#include "layFixedFont.h" #include "layFixedFont.h"
#include "layPixelBufferPainter.h" #include "layPixelBufferPainter.h"
#include "laySnap.h" #include "laySnap.h"
#include "layColor.h" #include "tlColor.h"
#include "dbTrans.h" #include "dbTrans.h"
#if defined(HAVE_QT) #if defined(HAVE_QT)
@ -135,25 +135,25 @@ GridNet::configure (const std::string &name, const std::string &value)
if (name == cfg_grid_color) { if (name == cfg_grid_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
need_update = test_and_set (m_color, color); need_update = test_and_set (m_color, color);
} else if (name == cfg_grid_grid_color) { } else if (name == cfg_grid_grid_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
need_update = test_and_set (m_grid_color, color); need_update = test_and_set (m_grid_color, color);
} else if (name == cfg_grid_axis_color) { } else if (name == cfg_grid_axis_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
need_update = test_and_set (m_axis_color, color); need_update = test_and_set (m_axis_color, color);
} else if (name == cfg_grid_ruler_color) { } else if (name == cfg_grid_ruler_color) {
lay::Color color; tl::Color color;
ColorConverter ().from_string (value, color); ColorConverter ().from_string (value, color);
need_update = test_and_set (m_ruler_color, 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) { if (m_visible) {
lay::Color color; tl::Color color;
if (m_color.is_valid ()) { if (m_color.is_valid ()) {
color = m_color; color = m_color;
} else { } 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 ()) { if (m_grid_color.is_valid ()) {
grid_color = m_grid_color; grid_color = m_grid_color;
} }

View File

@ -29,7 +29,7 @@
#if defined(HAVE_QT) #if defined(HAVE_QT)
# include "layPluginConfigPage.h" # include "layPluginConfigPage.h"
#endif #endif
#include "layColor.h" #include "tlColor.h"
#include "dbTypes.h" #include "dbTypes.h"
#include "dbBox.h" #include "dbBox.h"
@ -80,10 +80,10 @@ private:
bool m_visible; bool m_visible;
bool m_show_ruler; bool m_show_ruler;
double m_grid; double m_grid;
lay::Color m_color; tl::Color m_color;
lay::Color m_grid_color; tl::Color m_grid_color;
lay::Color m_axis_color; tl::Color m_axis_color;
lay::Color m_ruler_color; tl::Color m_ruler_color;
GridStyle m_style0; GridStyle m_style0;
GridStyle m_style1; GridStyle m_style1;
GridStyle m_style2; 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)); set_hier_levels (std::make_pair (get_hier_levels ().first, i));
} }
lay::Color tl::Color
LayoutView::default_background_color () LayoutView::default_background_color ()
{ {
if (! mp_widget) { if (! mp_widget) {
return LayoutViewBase::default_background_color (); return LayoutViewBase::default_background_color ();
} else { } 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 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) { if (mp_control_panel) {
mp_control_panel->set_background_color (c); 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 bool configure (const std::string &name, const std::string &value);
virtual void config_finalize (); virtual void config_finalize ();
virtual lay::Color default_background_color (); virtual tl::Color default_background_color ();
virtual void do_set_background_color (lay::Color color, lay::Color contrast); virtual void do_set_background_color (tl::Color color, tl::Color contrast);
virtual void do_paste (); virtual void do_paste ();
virtual void begin_layer_updates (); virtual void begin_layer_updates ();
virtual void end_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 ()) { if (qimg2.width () == (int) qimg.width () && qimg2.height () == (int) qimg.height ()) {
for (int j = 0; j < qimg.height (); ++j) { for (int j = 0; j < qimg.height (); ++j) {
for (int i = 0; i < qimg.width (); ++i) { 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; return false;
} }
} }
@ -86,12 +86,12 @@ static bool compare_images (const lay::BitmapBuffer &img, const lay::BitmapBuffe
TEST(1) TEST(1)
{ {
lay::LayoutView lv (0, false, 0); 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); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
QImage qimg; 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); EXPECT_EQ (qimg.format () == QImage::Format_RGB32, true);
@ -113,7 +113,7 @@ TEST(2)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
QImage qimg; 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); EXPECT_EQ (qimg.format () == QImage::Format_RGB32, true);
@ -136,7 +136,7 @@ TEST(3)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
QImage qimg; 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); EXPECT_EQ (qimg.format () == QImage::Format_MonoLSB, true);
@ -155,7 +155,7 @@ TEST(4)
{ {
lay::LayoutView lv (0, false, 0); lay::LayoutView lv (0, false, 0);
lv.set_drawing_workers (2); 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); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
@ -177,12 +177,12 @@ TEST(4)
TEST(11) TEST(11)
{ {
lay::LayoutView lv (0, false, 0); 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); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
lay::PixelBuffer img; 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"); std::string tmp = tmp_file ("test.png");
{ {
@ -210,7 +210,7 @@ TEST(12)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
lay::PixelBuffer img; 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"); std::string tmp = tmp_file ("test.png");
{ {
@ -239,7 +239,7 @@ TEST(13)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
lay::BitmapBuffer img; 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"); std::string tmp = tmp_file ("test.png");
{ {
@ -264,12 +264,12 @@ TEST(13)
TEST(21) TEST(21)
{ {
lay::LayoutView lv (0, false, 0); 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); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
std::string tmp = tmp_file ("test.png"); 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; lay::PixelBuffer img;
{ {
@ -297,7 +297,7 @@ TEST(22)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
std::string tmp = tmp_file ("test.png"); 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; lay::PixelBuffer img;
{ {
@ -326,7 +326,7 @@ TEST(23)
lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true); lv.load_layout (tl::testsrc () + "/testdata/gds/t10.gds", true);
std::string tmp = tmp_file ("test.png"); 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; 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) { } else if (name == cfg_nt_marker_color) {
lay::Color color; tl::Color color;
if (! value.empty ()) { if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color); lay::ColorConverter ().from_string (value, color);
} }
@ -1093,7 +1093,7 @@ NetTracerDialog::update_list ()
item->setData (Qt::DisplayRole, tl::to_qstring (mp_nets [i]->name ())); 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); QPixmap pxmp (icon_size);
QPainter pxpainter (&pxmp); QPainter pxpainter (&pxmp);
@ -1596,7 +1596,7 @@ NetTracerDialog::update_highlights ()
std::map <unsigned int, unsigned int> llmap; 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 // 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) { 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; nt_window_type m_window;
double m_window_dim; double m_window_dim;
unsigned int m_max_marker_count; unsigned int m_max_marker_count;
lay::Color m_marker_color; tl::Color m_marker_color;
int m_marker_line_width; int m_marker_line_width;
int m_marker_vertex_size; int m_marker_vertex_size;
int m_marker_halo; int m_marker_halo;

View File

@ -196,7 +196,7 @@ D25View::begin (const std::string &generator)
} }
void 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 ()) { if (! mp_ui->d25_view->has_error ()) {
mp_ui->d25_view->open_display (frame_color, fill_color, like, name); mp_ui->d25_view->open_display (frame_color, fill_color, like, name);

View File

@ -68,7 +68,7 @@ public:
void close (); void close ();
void clear (); void clear ();
void begin (const std::string &generator); 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 close_display ();
void entry (const db::Region &data, double dbu, double zstart, double zstop); 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); 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[0] = ((color >> 16) & 0xff) / 255.0f;
gl_color[1] = ((color >> 8) & 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; 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) { if (! color) {
for (unsigned int i = 0; i < 4; ++i) { for (unsigned int i = 0; i < 4; ++i) {
@ -567,7 +567,7 @@ static void lp_to_info (const lay::LayerPropertiesNode &lp, D25ViewWidget::Layer
} }
void 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_vertex_chunks.push_back (triangle_chunks_type ());
m_line_chunks.push_back (line_chunks_type ()); m_line_chunks.push_back (line_chunks_type ());
@ -648,7 +648,7 @@ D25ViewWidget::enter (const db::RecursiveShapeIterator *iter, double zstart, dou
} else { } else {
// sequential assignment // 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); color_to_gl (color, info.fill_color);
} }
@ -1089,7 +1089,7 @@ D25ViewWidget::paintGL ()
const qreal retina_scale = devicePixelRatio (); const qreal retina_scale = devicePixelRatio ();
glViewport (0, 0, width () * retina_scale, height () * retina_scale); 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 foreground_rgb = (c.to_mono () ? 0.0f : 1.0f);
float ambient = (c.to_mono () ? 0.8f : 0.25f); float ambient = (c.to_mono () ? 0.8f : 0.25f);
float mist_factor = (c.to_mono () ? 0.2f : 0.4f); 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 set_material_visible (size_t index, bool visible);
void clear (); 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 close_display ();
void entry (const db::Region &data, double dbu, double zstart, double zstop); void entry (const db::Region &data, double dbu, double zstart, double zstop);
void entry (const db::Edges &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 = \ SOURCES = \
tlAssert.cc \ tlAssert.cc \
tlBase64.cc \ tlBase64.cc \
tlColor.cc \
tlClassRegistry.cc \ tlClassRegistry.cc \
tlCopyOnWrite.cc \ tlCopyOnWrite.cc \
tlDataMapping.cc \ tlDataMapping.cc \
@ -58,6 +59,7 @@ HEADERS = \
tlAlgorithm.h \ tlAlgorithm.h \
tlAssert.h \ tlAssert.h \
tlBase64.h \ tlBase64.h \
tlColor.h \
tlClassRegistry.h \ tlClassRegistry.h \
tlCopyOnWrite.h \ tlCopyOnWrite.h \
tlDataMapping.h \ tlDataMapping.h \

View File

@ -21,14 +21,14 @@
*/ */
#include "layColor.h" #include "tlColor.h"
#include "tlString.h" #include "tlString.h"
#include "tlMath.h" #include "tlMath.h"
#include <ctype.h> #include <ctype.h>
#include <algorithm> #include <algorithm>
namespace lay namespace tl
{ {
Color::Color () 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) Color::from_hsv (unsigned int hue, unsigned int saturation, unsigned int value)
{ {
if (saturation == 0) { if (saturation == 0) {
return lay::Color (value, value, value); return tl::Color (value, value, value);
} }
hue = (hue + 360) % 360; hue = (hue + 360) % 360;
@ -191,7 +191,7 @@ Color::from_hsv (unsigned int hue, unsigned int saturation, unsigned int value)
case 5: case 5:
return color_d (v, p, q); return color_d (v, p, q);
default: default:
return lay::Color (); return tl::Color ();
} }
} }

View File

@ -20,15 +20,15 @@
*/ */
#ifndef HDR_layColor #ifndef HDR_tlColor
#define HDR_layColor #define HDR_tlColor
#include "laybasicCommon.h" #include "tlCommon.h"
#include <stdint.h> #include <stdint.h>
#include <string> #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 * This class is a replacement for QColor. It offers invalid color values and
* string conversion. * string conversion.
*/ */
class LAYBASIC_PUBLIC Color class TL_PUBLIC Color
{ {
public: public:
/** /**
@ -168,7 +168,7 @@ public:
/** /**
* @brief Creates the color from a HSV color * @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: private:
color_t m_color; color_t m_color;

View File

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

View File

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