Commit 9e8fb761 authored by Dick Hollenbeck's avatar Dick Hollenbeck

touch ups mostly to Marco's draw_gerber_screen patch

parent adb4ad1a
......@@ -103,45 +103,84 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, const wxPo
{
// Because Images can be negative (i.e with background filled in color) items are drawn
// graphic layer per graphic layer, after the background is filled
int bitmapWidth, bitmapHeight;
aPanel->GetClientSize( &bitmapWidth, &bitmapHeight );
wxBitmap layerBitmap( bitmapWidth, bitmapHeight );
wxMemoryDC memoryDC;
memoryDC.SelectObject( layerBitmap );
wxColour bgColor = MakeColour( g_DrawBgColor );
wxBrush bgBrush( bgColor, wxSOLID );
for( int layer = 0; layer < 32; layer++ )
{
if( !GetBoard()->IsLayerVisible( layer ) )
continue;
GERBER_IMAGE* gerber = g_GERBER_List[layer];
if( gerber == NULL ) // Graphic layer not yet used
continue;
/* Draw background negative (i.e. in graphic layer color) for negative images:
* Background is drawn here in GR_OR mode because in COPY mode
* all previous graphics will be erased
* Note: items in background color ("Erased" items) are always drawn in COPY mode
* Some artifacts can happen when more than one gerber file is loaded
*/
// Draw each layer into a bitmap first. Negative Gerber
// layers are drawn in background color.
memoryDC.SetBackground( bgBrush );
memoryDC.Clear();
if( gerber->m_ImageNegative )
{
int color = GetBoard()->GetLayerColor( layer );
GRSetDrawMode( aDC, GR_OR );
// Draw background negative (i.e. in graphic layer color) for negative images.
int color = GetBoard()->GetLayerColor( layer );
GRSetDrawMode( (wxDC*)&memoryDC, GR_COPY ); // GR_COPY is faster than GR_OR
EDA_Rect* cbox = &aPanel->m_ClipBox;
GRSFilledRect( cbox, aDC, cbox->GetX(), cbox->GetY(),
GRSFilledRect( cbox, (wxDC*)&memoryDC, cbox->GetX(), cbox->GetY(),
cbox->GetRight(), cbox->GetBottom(),
0, color, color );
GRSetDrawMode( aDC, aDrawMode );
GRSetDrawMode( (wxDC*)&memoryDC, aDrawMode );
}
int dcode_hightlight = 0;
int dcode_highlight = 0;
if( layer == m_PcbFrame->GetScreen()->m_Active_Layer )
dcode_hightlight = gerber->m_Selected_Tool;
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
dcode_highlight = gerber->m_Selected_Tool;
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer()!= layer )
if( gerb_item->GetLayer() != layer )
continue;
int drawMode = aDrawMode;
if( dcode_hightlight == gerb_item->m_DCode )
if( dcode_highlight == gerb_item->m_DCode )
drawMode |= GR_SURBRILL;
gerb_item->Draw( aPanel, aDC, drawMode );
gerb_item->Draw( aPanel, (wxDC*)&memoryDC, drawMode );
}
#if 0
// Use the layer bitmap itself as a mask when blitting.
// The bitmap cannot be referenced by a device context
// when setting the mask.
memoryDC.SelectObject( wxNullBitmap );
layerBitmap.SetMask( new wxMask( layerBitmap, bgColor ) );
memoryDC.SelectObject( layerBitmap );
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight,
(wxDC*)&memoryDC, 0, 0, wxCOPY, true );
#else // Dick: seems a little faster, crisper
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight,
(wxDC*)&memoryDC, 0, 0, wxOR, false );
#endif
}
m_PcbFrame->GetScreen()->ClrRefreshReq();
......
This diff is collapsed.
......@@ -57,7 +57,8 @@ D_PAD::~D_PAD()
*/
int D_PAD::GetMaxRadius() const
{
int x, y, radius;
int x, y;
int radius;
switch( m_PadShape & 0x7F )
{
......@@ -79,6 +80,9 @@ int D_PAD::GetMaxRadius() const
y = m_Size.y + ABS( m_DeltaSize.x ); // Remember: m_DeltaSize.x is the m_Size.y change
radius = 1 + (int) ( sqrt( (double) y * y + (double) x * x ) / 2 );
break;
default:
radius = 0; // quiet compiler
}
return radius;
......
......@@ -43,23 +43,26 @@ public:
int PlotPSColorOpt; // True for color Postscript output
bool Plot_PS_Negative; // True to create a negative board ps plot
/* Flags to enable or disable ploting of various PCB elements. */
/// Flags to enable or disable ploting of various PCB elements.
bool Sel_Texte_Reference;
bool Sel_Texte_Valeur;
bool Sel_Texte_Divers;
bool Sel_Texte_Invisible;
bool PlotPadsOnSilkLayer; /* allows pads on silkscreen */
bool PlotPadsOnSilkLayer; ///< allows pads on silkscreen
bool m_SubtractMaskFromSilk;
/* id for plot format (see enum PlotFormat in plot_common.h) */
int PlotFormat;
int PlotOrient;
int PlotScaleOpt;
enum DrillShapeOptT {
/// id for plot format (see enum PlotFormat in plot_common.h)
int PlotFormat;
int PlotOrient;
int PlotScaleOpt;
enum DrillShapeOptT
{
NO_DRILL_SHAPE = 0,
SMALL_DRILL_SHAPE = 1,
FULL_DRILL_SHAPE = 2
};
DrillShapeOptT DrillShapeOpt;
double Scale;
double ScaleAdjX;
......@@ -70,10 +73,10 @@ private:
public:
PCB_Plot_Options();
void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; };
wxString GetOutputDirectory() { return outputDirectory; };
void SetSubtractMaskFromSilk( bool aSubtract ) { m_SubtractMaskFromSilk = aSubtract; };
bool GetSubtractMaskFromSilk() { return m_SubtractMaskFromSilk; };
void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; };
wxString GetOutputDirectory() { return outputDirectory; };
void SetSubtractMaskFromSilk( bool aSubtract ) { m_SubtractMaskFromSilk = aSubtract; };
bool GetSubtractMaskFromSilk() { return m_SubtractMaskFromSilk; };
};
extern PCB_Plot_Options g_pcb_plot_options;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment