mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 21:23:25 +00:00
Fix --background option in kicad-cli pcb render.
This commit is contained in:
parent
074e6df3bc
commit
1be6ecd972
common/jobs
kicad/cli
pcbnew
@ -55,9 +55,9 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_RENDER::SIDE,
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_RENDER::BG_STYLE,
|
||||
{
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_DEFAULT, "default" },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_OPAQUE, "opaque" },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_TRANSPARENT, "transparent" }
|
||||
{ JOB_PCB_RENDER::BG_STYLE::DEFAULT, "default" },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::OPAQUE, "opaque" },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::TRANSPARENT, "transparent" }
|
||||
} )
|
||||
|
||||
JOB_PCB_RENDER::JOB_PCB_RENDER() :
|
||||
|
@ -28,6 +28,15 @@
|
||||
#include <optional>
|
||||
#include <math/vector3.h>
|
||||
|
||||
// Defined in wingdi.h
|
||||
#ifdef TRANSPARENT
|
||||
#undef TRANSPARENT
|
||||
#endif
|
||||
|
||||
#ifdef OPAQUE
|
||||
#undef OPAQUE
|
||||
#endif
|
||||
|
||||
class KICOMMON_API JOB_PCB_RENDER : public JOB
|
||||
{
|
||||
public:
|
||||
@ -46,6 +55,7 @@ public:
|
||||
|
||||
wxString m_filename;
|
||||
|
||||
// Do not rename enum values as they are used for CLI args
|
||||
enum class QUALITY
|
||||
{
|
||||
BASIC,
|
||||
@ -55,9 +65,9 @@ public:
|
||||
|
||||
enum class BG_STYLE
|
||||
{
|
||||
BG_DEFAULT,
|
||||
BG_TRANSPARENT,
|
||||
BG_OPAQUE
|
||||
DEFAULT,
|
||||
TRANSPARENT,
|
||||
OPAQUE
|
||||
};
|
||||
|
||||
enum class SIDE
|
||||
@ -73,6 +83,7 @@ public:
|
||||
FORMAT m_format = FORMAT::PNG;
|
||||
QUALITY m_quality = QUALITY::BASIC;
|
||||
BG_STYLE m_bgStyle = BG_STYLE::BG_DEFAULT;
|
||||
BG_STYLE m_bgStyle = BG_STYLE::DEFAULT;
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
std::string m_colorPreset;
|
||||
|
@ -187,8 +187,9 @@ CLI::PCB_RENDER_COMMAND::PCB_RENDER_COMMAND() : COMMAND( "render" )
|
||||
|
||||
m_argParser.add_argument( ARG_BACKGROUND )
|
||||
.default_value( std::string( "" ) )
|
||||
.help( UTF8STDSTR( _( "Image background. Options: transparent, opaque. Default: "
|
||||
"transparent for PNG, opaque for JPEG" ) ) )
|
||||
.help( UTF8STDSTR( wxString::Format( _( "Image background. Options: %s. Default: "
|
||||
"transparent for PNG, opaque for JPEG" ),
|
||||
enumString<JOB_PCB_RENDER::BG_STYLE>() ) ) )
|
||||
.metavar( "BG" );
|
||||
|
||||
m_argParser.add_argument( ARG_QUALITY )
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include <wx/display.h>
|
||||
|
||||
static std::map<JOB_PCB_RENDER::BG_STYLE, wxString> bgStyleMap = {
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_DEFAULT, _HKI( "Default" ) },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_OPAQUE, _HKI( "Opaque" ) },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_TRANSPARENT, _HKI( "Transparent" ) }
|
||||
{ JOB_PCB_RENDER::BG_STYLE::DEFAULT, _HKI( "Default" ) },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::OPAQUE, _HKI( "Opaque" ) },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::TRANSPARENT, _HKI( "Transparent" ) }
|
||||
};
|
||||
|
||||
static std::map<JOB_PCB_RENDER::QUALITY, wxString> qualityMap = {
|
||||
|
@ -538,8 +538,8 @@ int PCBNEW_JOBS_HANDLER::JobExportRender( JOB* aJob )
|
||||
cfg->m_CurrentPreset = aRenderJob->m_colorPreset;
|
||||
boardAdapter.m_Cfg = cfg;
|
||||
|
||||
if( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::BG_TRANSPARENT
|
||||
|| ( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::BG_DEFAULT
|
||||
if( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::TRANSPARENT
|
||||
|| ( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::DEFAULT
|
||||
&& aRenderJob->m_format == JOB_PCB_RENDER::FORMAT::PNG ) )
|
||||
{
|
||||
boardAdapter.m_ColorOverrides[LAYER_3D_BACKGROUND_TOP] = COLOR4D( 1.0, 1.0, 1.0, 0.0 );
|
||||
|
Loading…
Reference in New Issue
Block a user