Shuffle color4d into kicommon since its used many places

This commit is contained in:
Marek Roszko 2023-09-14 21:08:05 -04:00
parent 9fc45eb08c
commit 2b90607dcd
3 changed files with 14 additions and 11 deletions

View File

@ -67,6 +67,8 @@ add_library( singletop STATIC EXCLUDE_FROM_ALL
# Functions and data all need to use the #include <import_export.h> and be declared
# as APIEXPORT
set( KICOMMON_SRCS
gal/color4d.cpp
asset_archive.cpp
array_axis.cpp
array_options.cpp

View File

@ -5,7 +5,6 @@ set( GAL_SRCS
../gl_context_mgr.cpp
../newstroke_font.cpp
painter.cpp
color4d.cpp
cursors.cpp
dpi_scaling.cpp
gal_display_options.cpp
@ -49,6 +48,7 @@ if( WIN32 )
endif()
target_link_libraries( gal
kicommon
common
kimath
kiplatform

View File

@ -27,6 +27,7 @@
#ifndef COLOR4D_H_
#define COLOR4D_H_
#include <kicommon.h>
#include <wx/debug.h>
#include <wx/colour.h>
#include <wx/string.h>
@ -80,7 +81,7 @@ enum EDA_COLOR_T
MASKCOLOR = 31 ///< mask for color index into colorRefs()[]
};
struct StructColors
struct KICOMMON_API StructColors
{
unsigned char m_Blue;
unsigned char m_Green;
@ -91,7 +92,7 @@ struct StructColors
};
/// Global list of legacy color names, still used all over the place for constructing COLOR4D's
const StructColors* colorRefs();
KICOMMON_API const StructColors* colorRefs();
namespace KIGFX
@ -99,7 +100,7 @@ namespace KIGFX
/**
* A color representation with 4 components: red, green, blue, alpha.
*/
class COLOR4D
class KICOMMON_API COLOR4D
{
public:
// Constructor (creates the Color 0,0,0,0)
@ -387,26 +388,26 @@ public:
};
/// @brief Equality operator, are two colors equal
bool operator==( const COLOR4D& lhs, const COLOR4D& rhs );
KICOMMON_API bool operator==( const COLOR4D& lhs, const COLOR4D& rhs );
/// @brief Not equality operator, are two colors not equal
bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
KICOMMON_API bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
bool operator<( const COLOR4D& lhs, const COLOR4D& rhs );
KICOMMON_API bool operator<( const COLOR4D& lhs, const COLOR4D& rhs );
/// Syntactic sugar for outputting colors to strings
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor );
KICOMMON_API std::ostream& operator<<( std::ostream& aStream, COLOR4D const& aColor );
// to allow json( COLOR4D )
void to_json( nlohmann::json& aJson, const COLOR4D& aColor );
KICOMMON_API void to_json( nlohmann::json& aJson, const COLOR4D& aColor );
// To allow json::get<COLOR4D>()
void from_json( const nlohmann::json& aJson, COLOR4D& aColor );
KICOMMON_API void from_json( const nlohmann::json& aJson, COLOR4D& aColor );
} // namespace KIGFX
template<>
struct std::hash<KIGFX::COLOR4D>
struct KICOMMON_API std::hash<KIGFX::COLOR4D>
{
std::size_t operator()( const KIGFX::COLOR4D& aColor ) const
{