void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { if( DC == NULL ) return; wxPoint seg_start, seg_end; LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; BOARD* brd = GetBoard(); EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) return; GRSetDrawMode( DC, aDrawMode ); if( DisplayOpt.ContrastModeDisplay ) { if( !IsOnLayer( curr_layer ) ) ColorTurnToDarkDarkGray( &color ); } if( aDrawMode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) ); ColorApplyHighlightFlag( &color ); SetAlpha( &color, 150 ); // draw the lines int i_start_contour = 0; std::vector<wxPoint> lines; lines.reserve( (GetNumCorners() * 2) + 2 ); for( int ic = 0; ic < GetNumCorners(); ic++ ) { seg_start = GetCornerPosition( ic ) + offset; if( !m_Poly->m_CornersList.IsEndContour( ic ) && ic < GetNumCorners() - 1 ) { seg_end = GetCornerPosition( ic + 1 ) + offset; } else { seg_end = GetCornerPosition( i_start_contour ) + offset; i_start_contour = ic + 1; } lines.push_back( seg_start ); lines.push_back( seg_end ); } GRLineArray( panel->GetClipBox(), DC, lines, 0, color ); // draw hatches lines.clear(); lines.reserve( (m_Poly->m_HatchLines.size() * 2) + 2 ); for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ ) { seg_start = m_Poly->m_HatchLines[ic].m_Start + offset; seg_end = m_Poly->m_HatchLines[ic].m_End + offset; lines.push_back( seg_start ); lines.push_back( seg_end ); } GRLineArray( panel->GetClipBox(), DC, lines, 0, color ); }
void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { if( !DC ) return; wxPoint seg_start, seg_end; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; BOARD* brd = GetBoard(); COLOR4D color = brd->GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; GRSetDrawMode( DC, aDrawMode ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); if( displ_opts->m_ContrastModeDisplay ) { if( !IsOnLayer( curr_layer ) ) color = COLOR4D( DARKDARKGRAY ); } if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) ) color.SetToLegacyHighlightColor(); color.a = 0.588; // draw the lines int i_start_contour = 0; std::vector<wxPoint> lines; lines.reserve( (GetNumCorners() * 2) + 2 ); for( int ic = 0; ic < GetNumCorners(); ic++ ) { seg_start = GetCornerPosition( ic ) + offset; if( !m_Poly->m_CornersList.IsEndContour( ic ) && ic < GetNumCorners() - 1 ) { seg_end = GetCornerPosition( ic + 1 ) + offset; } else { seg_end = GetCornerPosition( i_start_contour ) + offset; i_start_contour = ic + 1; } lines.push_back( seg_start ); lines.push_back( seg_end ); } GRLineArray( panel->GetClipBox(), DC, lines, 0, color ); // draw hatches lines.clear(); lines.reserve( (m_Poly->m_HatchLines.size() * 2) + 2 ); for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ ) { seg_start = m_Poly->m_HatchLines[ic].m_Start + offset; seg_end = m_Poly->m_HatchLines[ic].m_End + offset; lines.push_back( seg_start ); lines.push_back( seg_end ); } GRLineArray( panel->GetClipBox(), DC, lines, 0, color ); }