您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GRLine函数代码示例

51自学网 2021-06-01 20:55:14
  C++
这篇教程C++ GRLine函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GRLine函数的典型用法代码示例。如果您正苦于以下问题:C++ GRLine函数的具体用法?C++ GRLine怎么用?C++ GRLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GRLine函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GRSetDrawMode

void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC ){    GRSetDrawMode( DC, GR_COPY );    if( GetParent()->IsGridVisible() )        DrawGrid( DC );    // Draw axis    if( GetParent()->GetShowAxis() )    {        COLOR4D axis_color = COLOR4D( BLUE );        wxSize  pageSize = GetParent()->GetPageSizeIU();        // Draw the Y axis        GRLine( &m_ClipBox, DC, 0, -pageSize.y, 0, pageSize.y, 0, axis_color );        // Draw the X axis        GRLine( &m_ClipBox, DC, -pageSize.x, 0, pageSize.x, 0, 0, axis_color );    }    if( GetParent()->GetShowOriginAxis() )        DrawAuxiliaryAxis( DC, GR_COPY );    if( GetParent()->GetShowGridAxis() )        DrawGridAxis( DC, GR_COPY, GetParent()->GetGridOrigin() );}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:26,


示例2: GRSetDrawMode

void BASE_SCREEN::Trace_Curseur(WinEDA_DrawPanel * panel, wxDC * DC)/*******************************************************************//* Trace Le curseur sur la zone PCB , se deplacant sur la grille*/{int color = WHITE;		GRSetDrawMode(DC, GR_XOR);	if( g_CursorShape == 1 )	/* Trace d'un reticule */		{		int dx = panel->m_ClipBox.GetWidth() * GetZoom();		int dy = panel->m_ClipBox.GetHeight() * GetZoom();		GRLine(&panel->m_ClipBox, DC, m_Curseur.x - dx, m_Curseur.y,							m_Curseur.x + dx, m_Curseur.y, color); // axe Y		GRLine(&panel->m_ClipBox, DC, m_Curseur.x, m_Curseur.y - dx,				m_Curseur.x, m_Curseur.y + dy, color);  // axe X		}	else		{		int len = CURSOR_SIZE * GetZoom();		GRLine(&panel->m_ClipBox, DC, m_Curseur.x - len, m_Curseur.y,				m_Curseur.x + len, m_Curseur.y, color);		GRLine(&panel->m_ClipBox, DC, m_Curseur.x, m_Curseur.y - len,				m_Curseur.x, m_Curseur.y + len, color);		}}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:28,


示例3: GetParent

void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin ){    if( !GetParent()->GetShowGridAxis() || ( !aGridOrigin.x && !aGridOrigin.y ) )        return;    COLOR4D color = GetParent()->GetGridColor();    GRSetDrawMode( aDC, aDrawMode );#if DRAW_AXIS_AS_LINES    wxSize      pageSize = GetParent()->GetPageSizeIU();    // Draw the Y axis    GRLine( &m_ClipBox, aDC, aGridOrigin.x, -pageSize.y,            aGridOrigin.x, pageSize.y, 0, color );    // Draw the X axis    GRLine( &m_ClipBox, aDC, -pageSize.x, aGridOrigin.y,            pageSize.x, aGridOrigin.y, 0, color );#else    int radius = aDC->DeviceToLogicalXRel( AXIS_SIZE_IN_PIXELS );    int linewidth = aDC->DeviceToLogicalXRel( 1 );    GRSetColorPen( aDC, GetParent()->GetGridColor(), linewidth );    GRLine( &m_ClipBox, aDC, aGridOrigin.x-radius, aGridOrigin.y-radius,            aGridOrigin.x+radius, aGridOrigin.y+radius, 0, color );    // Draw the X shape    GRLine( &m_ClipBox, aDC, aGridOrigin.x+radius, aGridOrigin.y-radius,            aGridOrigin.x-radius, aGridOrigin.y+radius, 0, color );    GRCircle( &m_ClipBox, aDC, aGridOrigin, radius, linewidth, color );#endif}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:34,


示例4: GetParent

void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor ){    if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )        return;    wxPoint cursor = GetParent()->GetCrossHairPosition();    GRSetDrawMode( aDC, GR_XOR );    if( GetParent()->m_cursorShape != 0 )    // Draws full screen crosshair.    {        wxSize  clientSize = GetClientSize();        // Y axis        wxPoint lineStart( cursor.x, aDC->DeviceToLogicalY( 0 ) );        wxPoint lineEnd(   cursor.x, aDC->DeviceToLogicalY( clientSize.y ) );        GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor );        // X axis        lineStart = wxPoint( aDC->DeviceToLogicalX( 0 ), cursor.y );        lineEnd   = wxPoint( aDC->DeviceToLogicalX( clientSize.x ), cursor.y );        GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor );    }    else    {        int len = aDC->DeviceToLogicalXRel( CURSOR_SIZE );        GRLine( &m_ClipBox, aDC, cursor.x - len, cursor.y,                cursor.x + len, cursor.y, 0, aColor );        GRLine( &m_ClipBox, aDC, cursor.x, cursor.y - len,                cursor.x, cursor.y + len, 0, aColor );    }}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:35,


示例5: GetBoard

/* Draw PCB_TARGET object: 2 segments + 1 circle * The circle radius is half the radius of the target * 2 lines have length the diameter of the target */void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,                       const wxPoint& offset ){    int radius, ox, oy, width;    int dx1, dx2, dy1, dy2;    ox = m_Pos.x + offset.x;    oy = m_Pos.y + offset.y;    BOARD * brd =  GetBoard( );    if( brd->IsLayerVisible( m_Layer ) == false )        return;    auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() );    auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer );    GRSetDrawMode( DC, mode_color );    auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );    bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;    width   = m_Width;    radius = m_Size / 3;    if( GetShape() )   // shape X        radius = m_Size / 2;    if( filled )        GRCircle( panel->GetClipBox(), DC, ox, oy, radius, width, gcolor );    else    {        GRCircle( panel->GetClipBox(), DC, ox, oy, radius + (width / 2), gcolor );        GRCircle( panel->GetClipBox(), DC, ox, oy, radius - (width / 2), gcolor );    }    radius = m_Size / 2;    dx1   = radius;    dy1   = 0;    dx2   = 0;    dy2   = radius;    if( GetShape() )   // shape X    {        dx1 = dy1 = radius;        dx2 = dx1;        dy2 = -dy1;    }    if( filled )    {        GRLine( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );        GRLine( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );    }    else    {        GRCSegm( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );    }}
开发者ID:cpavlina,项目名称:kicad,代码行数:64,


示例6: GRSetDrawMode

void WinEDA_BasePcbFrame::trace_ratsnest_pad(wxDC * DC)/*******************************************************//* affiche le "chevelu" d'un pad lors des trace de segments de piste*/{int * pt_coord;int ii;int refX, refY;	if((m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0) return;	if( nb_local_chevelu == 0 ) return;	if ( local_liste_chevelu == NULL ) return;	pt_coord = (int*) local_liste_chevelu;	refX = *pt_coord; pt_coord++;	refY = *pt_coord; pt_coord++;	GRSetDrawMode(DC, GR_XOR);	for( ii = 0; ii < nb_local_chevelu; ii++)		{		if ( ii >= g_MaxLinksShowed ) break;		GRLine(&DrawPanel->m_ClipBox, DC, refX, refY, *pt_coord, *(pt_coord+1), YELLOW);		pt_coord += 2;		}}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:26,


示例7: GetLayerColor

void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,                          GR_DRAWMODE aDrawMode, COLOR4D aColor ){    COLOR4D color;    EDA_RECT* clipbox = aPanel->GetClipBox();    if( aColor != COLOR4D::UNSPECIFIED )        color = aColor;    else        color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );    GRSetDrawMode( aDC, aDrawMode );    GRLine( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,            m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );    // Draw pin targets if part is being dragged    bool dragging = aPanel->GetScreen()->GetCurItem() == this && aPanel->IsMouseCaptured();    if( m_isDanglingStart || dragging )    {        GRCircle( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,                TARGET_BUSENTRY_RADIUS, 0, color );    }    if( m_isDanglingEnd || dragging )    {        GRCircle( clipbox, aDC, m_End().x + aOffset.x, m_End().y + aOffset.y,                TARGET_BUSENTRY_RADIUS, 0, color );    }}
开发者ID:cpavlina,项目名称:kicad,代码行数:32,


示例8: GetBoard

void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,                    const wxPoint& aOffset ){    DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();    if( displ_opts->m_DisplayZonesMode != 0 )        return;    BOARD * brd = GetBoard( );    EDA_COLOR_T color = brd->GetLayerColor(m_Layer);    if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )        return;#ifdef USE_WX_OVERLAY    // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay    if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))      return;#endif    if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )    {        LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;        if( !IsOnLayer( curr_layer ) )            ColorTurnToDarkDarkGray( &color );    }    if( aDrawMode & GR_HIGHLIGHT )        ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );    ColorApplyHighlightFlag( &color );    SetAlpha( &color, 150 );    GRSetDrawMode( aDC, aDrawMode );    int l_trace = m_Width / 2;    if( aDC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH )    {        GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, 0, color );        return;    }    if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )    {        GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );    }    else    {        GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,                     m_Start.y + aOffset.y,                     m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );    }    // No clearance or netnames for zones}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:58,


示例9: GetBoard

void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,                    const wxPoint& aOffset ){    auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );    if( displ_opts->m_DisplayZonesMode != 0 )        return;    BOARD* brd = GetBoard();    auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );    auto color = frame->Settings().Colors().GetLayerColor( m_Layer );    if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )        return;#ifdef USE_WX_OVERLAY    // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay    if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))      return;#endif    if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )    {        PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;        if( !IsOnLayer( curr_layer ) )            color = COLOR4D( DARKDARKGRAY );    }    if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )        color.SetToLegacyHighlightColor();    color.a = 0.588;    GRSetDrawMode( aDC, aDrawMode );    // Draw track as line if width <= 1pixel:    if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )    {        GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );        return;    }    if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )    {        GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );    }    else    {        GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,                     m_Start.y + aOffset.y,                     m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );    }    // No clearance or netnames for zones}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:57,


示例10: GetWidth

void DrawBlockStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC)/**************************************************************/{    int w = GetWidth()/panel->GetZoom();    int h = GetHeight()/panel->GetZoom();    if (  w == 0 || h == 0 )        GRLine(&panel->m_ClipBox, DC, GetX(), GetY(),               GetRight(), GetBottom(), m_Color);    else        GRRect(&panel->m_ClipBox, DC,  GetX(), GetY(),               GetRight(), GetBottom(), m_Color);}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:12,


示例11: GRSetDrawMode

/** * Function Draw * Draws a line (a ratsnest) from the starting pad to the ending pad */void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,                          wxDC*           DC,                          GR_DRAWMODE     aDrawMode,                          const wxPoint&  aOffset ){    GRSetDrawMode( DC, aDrawMode );    EDA_COLOR_T color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);    GRLine( panel->GetClipBox(), DC,            m_PadStart->GetPosition() - aOffset,            m_PadEnd->GetPosition() - aOffset, 0, color );}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:17,


示例12: GetBoard

void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,                      const wxPoint& offset ){    EDA_COLOR_T gcolor;    BOARD*      brd = GetBoard();    if( brd->IsLayerVisible( m_Layer ) == false )        return;    m_Text.Draw( panel, DC, mode_color, offset );    gcolor = brd->GetLayerColor( m_Layer );    GRSetDrawMode( DC, mode_color );    DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();    bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;    int width   = m_Width;    if( filled )    {        GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,                m_crossBarF + offset, width, gcolor );        GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset,                m_featureLineGF + offset, width, gcolor );        GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,                m_featureLineDF + offset, width, gcolor );        GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,                m_arrowD1F + offset, width, gcolor );        GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,                m_arrowD2F + offset, width, gcolor );        GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,                m_arrowG1F + offset, width, gcolor );        GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,                m_arrowG2F + offset, width, gcolor );    }    else    {        GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,                 m_crossBarF + offset, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset,                 m_featureLineGF + offset, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,                 m_featureLineDF + offset, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,                 m_arrowD1F + offset, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,                 m_arrowD2F + offset, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,                 m_arrowG1F + offset, width, gcolor );        GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,                 m_arrowG2F + offset, width, gcolor );    }}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:53,


示例13: GetDefaultLineThickness

void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,                           GR_DRAWMODE aDrawMode, COLOR4D aColor ){    int pX, pY;    int delta = m_size.x / 2;    int width = GetDefaultLineThickness();    pX = m_pos.x + aOffset.x;    pY = m_pos.y + aOffset.y;    COLOR4D color;    if( aColor != COLOR4D::UNSPECIFIED )        color = aColor;    else        color = GetLayerColor( LAYER_NOCONNECT );    GRSetDrawMode( aDC, aDrawMode );    GRLine( aPanel->GetClipBox(), aDC, pX - delta, pY - delta, pX + delta, pY + delta,            width, color );    GRLine( aPanel->GetClipBox(), aDC, pX + delta, pY - delta, pX - delta, pY + delta,            width, color );}
开发者ID:cpavlina,项目名称:kicad,代码行数:24,


示例14: GetParent

/* Draws a line from the TEXTE_MODULE origin to parent MODULE origin.*/void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,                                  wxDC*           aDC,                                  GR_DRAWMODE     aDrawMode,                                  const wxPoint&  aOffset ){    MODULE* parent = (MODULE*) GetParent();    if( !parent )        return;    GRSetDrawMode( aDC, GR_XOR );    GRLine( aPanel->GetClipBox(), aDC,            parent->GetPosition(), GetTextPosition() + aOffset,            0, UMBILICAL_COLOR);}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:17,


示例15: ReturnLayerColor

void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,                          GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor ){    EDA_COLOR_T color;    if( aColor >= 0 )        color = aColor;    else        color = ReturnLayerColor( m_Layer );    GRSetDrawMode( aDC, aDrawMode );    GRLine( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,            m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:15,


示例16: GetWidth

void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,                           GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor ){    int w = GetWidth();    int h = GetHeight();    GRSetDrawMode( aDC, aDrawMode );    if(  w == 0 || h == 0 )        GRLine( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y,                GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );    else        GRRect( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y,                GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:16,


示例17: GRSetDrawMode

void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC ){    if( aDC == NULL )        return;    if( s_TargetsLocations.size() == 0 )        return;    GRSetDrawMode( aDC, GR_XOR );    for( int ii = 0; ii < (int) s_TargetsLocations.size(); ii++ )    {        if( ii >= g_MaxLinksShowed )            break;        GRLine( m_canvas->GetClipBox(), aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW );    }}
开发者ID:jerkey,项目名称:kicad,代码行数:18,


示例18: dc

void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ){    wxPaintDC    dc( m_panelShowPad );    PAD_DRAWINFO drawInfo;    EDA_COLOR_T color = BLACK;    if( m_dummyPad->GetLayerSet()[F_Cu] )    {        color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE );    }    if( m_dummyPad->GetLayerSet()[B_Cu] )    {        color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );    }    // What could happen: the pad color is *actually* black, or no    // copper was selected    if( color == BLACK )        color = LIGHTGRAY;    drawInfo.m_Color     = color;    drawInfo.m_HoleColor = DARKGRAY;    drawInfo.m_Offset    = m_dummyPad->GetPosition();    drawInfo.m_Display_padnum  = true;    drawInfo.m_Display_netname = true;    if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )        drawInfo.m_ShowNotPlatedHole = true;    // Shows the local pad clearance    drawInfo.m_PadClearance = m_dummyPad->GetLocalClearance();    wxSize dc_size = dc.GetSize();    dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );    // Calculate a suitable scale to fit the available draw area    int dim = m_dummyPad->GetSize().x + std::abs( m_dummyPad->GetDelta().y);    if( m_dummyPad->GetLocalClearance() > 0 )        dim += m_dummyPad->GetLocalClearance() * 2;    double scale = (double) dc_size.x / dim;    dim = m_dummyPad->GetSize().y + std::abs( m_dummyPad->GetDelta().x);    if( m_dummyPad->GetLocalClearance() > 0 )        dim += m_dummyPad->GetLocalClearance() * 2;    double altscale = (double) dc_size.y / dim;    scale = std::min( scale, altscale );    // Give a margin    scale *= 0.7;    dc.SetUserScale( scale, scale );    GRResetPenAndBrush( &dc );    m_dummyPad->DrawShape( NULL, &dc, drawInfo );    // Draw X and Y axis.    // this is particularly useful to show the reference position of pads    // with offset and no hole    GRLine( NULL, &dc, -dim, 0, dim, 0, 0, BLUE );   // X axis    GRLine( NULL, &dc, 0, -dim, 0, dim, 0, BLUE );   // Y axis    event.Skip();}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:67,


示例19: GetPenSizeForBold

void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,                      const wxPoint& offset, GR_DRAWMODE DrawMode, EDA_COLOR_T Color ){    int            orient;    EDA_COLOR_T    color;    wxPoint        textpos;    SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;    int            LineWidth = m_Thickness;    if( LineWidth == 0 )   // Use default values for pen size    {        if( m_Bold  )            LineWidth = GetPenSizeForBold( m_Size.x );        else            LineWidth = GetDefaultLineThickness();    }    // Clip pen size for small texts:    LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold );    if( ((m_Attributs & TEXT_NO_VISIBLE) && !m_forceVisible) || IsVoid() )        return;    GRSetDrawMode( DC, DrawMode );    // Calculate the text orientation according to the component orientation.    orient = m_Orient;    if( parentComponent->GetTransform().y1 )  // Rotate component 90 degrees.    {        if( orient == TEXT_ORIENT_HORIZ )            orient = TEXT_ORIENT_VERT;        else            orient = TEXT_ORIENT_HORIZ;    }    /* Calculate the text justification, according to the component     * orientation/mirror this is a bit complicated due to cumulative     * calculations:     * - numerous cases (mirrored or not, rotation)     * - the DrawGraphicText function recalculate also H and H justifications     *      according to the text orientation.     * - When a component is mirrored, the text is not mirrored and     *   justifications are complicated to calculate     * so the more easily way is to use no justifications ( Centered text )     * and use GetBoundaryBox to know the text coordinate considered as centered     */    EDA_RECT boundaryBox = GetBoundingBox();    textpos = boundaryBox.Centre();    if( m_forceVisible )    {        color = DARKGRAY;    }    else    {        if( m_id == REFERENCE )            color = ReturnLayerColor( LAYER_REFERENCEPART );        else if( m_id == VALUE )            color = ReturnLayerColor( LAYER_VALUEPART );        else            color = ReturnLayerColor( LAYER_FIELDS );    }    DrawGraphicText( panel, DC, textpos, color, GetText(), orient, m_Size,                     GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,                     LineWidth, m_Italic, m_Bold );    /* Enable this to draw the bounding box around the text field to validate     * the bounding box calculations.     */#if 0    // Draw boundary box:    GRRect( panel->GetClipBox(), DC, boundaryBox, 0, BROWN );    // Draw the text anchor point    /* Calculate the text position, according to the component     * orientation/mirror */    textpos  = m_Pos - parentComponent->GetPosition();    textpos  = parentComponent->GetScreenCoord( textpos );    textpos += parentComponent->GetPosition();    const int len = 10;    GRLine( panel->GetClipBox(), DC,            textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE );    GRLine( panel->GetClipBox(), DC,            textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE );#endif}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:91,


示例20: SymbolDisplayDraw

static void SymbolDisplayDraw(WinEDA_DrawPanel * panel, wxDC * DC, bool erase){int DrawMode = g_XorMode;int * ptpoly;int dx, dy;BASE_SCREEN * Screen = panel->m_Parent->m_CurrentScreen;int mx = Screen->m_Curseur.x,	my = Screen->m_Curseur.y;	GRSetDrawMode(DC, DrawMode);	if( erase )		{ 		if( StateDrawArc == 1 )			{			int Color = ReturnLayerColor(LAYER_DEVICE);			GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color);			}		else			{			DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, 0 , 0,						CurrentDrawItem, CurrentUnit, DrawMode);			if(CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE)				{				int Color = ReturnLayerColor(LAYER_DEVICE);				GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY,						((LibDrawArc*)CurrentDrawItem)->m_Pos.x,						- ((LibDrawArc*)CurrentDrawItem)->m_Pos.y,						Color);				GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY,						((LibDrawArc*)CurrentDrawItem)->m_Pos.x,						- ((LibDrawArc*)CurrentDrawItem)->m_Pos.y,						Color);				}			}		}	switch ( CurrentDrawItem->m_StructType )		{		case COMPONENT_ARC_DRAW_TYPE:			if( StateDrawArc == 1)				{				ArcEndX = mx; ArcEndY = - my;				}			if( StateDrawArc == 2)				{				ComputeArc((LibDrawArc*)CurrentDrawItem, Screen->m_Curseur);				}			((LibDrawArc*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;			break;		case COMPONENT_CIRCLE_DRAW_TYPE:			dx = ((LibDrawCircle*)CurrentDrawItem)->m_Pos.x - mx;			dy = ((LibDrawCircle*)CurrentDrawItem)->m_Pos.y + my;			((LibDrawCircle*)CurrentDrawItem)->m_Rayon = (int)sqrt( (dx*dx) + (dy*dy) );			((LibDrawCircle*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;			break;		case COMPONENT_RECT_DRAW_TYPE:			((LibDrawSquare*)CurrentDrawItem)->m_End.x = mx;			((LibDrawSquare*)CurrentDrawItem)->m_End.y = - my;			((LibDrawSquare*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;			break;		case COMPONENT_POLYLINE_DRAW_TYPE:			ptpoly = ((LibDrawPolyline*)CurrentDrawItem)->PolyList;			ptpoly += 2 * (((LibDrawPolyline*)CurrentDrawItem)->n - 1);			ptpoly[0] = mx;			ptpoly[1] = - my;			((LibDrawPolyline*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;			break;		case COMPONENT_LINE_DRAW_TYPE:			((LibDrawSegment*)CurrentDrawItem)->m_End.x = mx;			((LibDrawSegment*)CurrentDrawItem)->m_End.y = - my;			break;		case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:	/* Traite par des routines specifiques */			break;		}	if( StateDrawArc == 1 )		{		int Color = ReturnLayerColor(LAYER_DEVICE);		GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color);		}	else		{		DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, 0 , 0,						CurrentDrawItem, CurrentUnit, DrawMode);		if(CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE)			{			int Color = ReturnLayerColor(LAYER_DEVICE);			GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY,					((LibDrawArc*)CurrentDrawItem)->m_Pos.x,					- ((LibDrawArc*)CurrentDrawItem)->m_Pos.y,					Color);			GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY,					((LibDrawArc*)CurrentDrawItem)->m_Pos.x,//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例21: trace

void EDGE_MODULE::Draw(WinEDA_DrawPanel * panel, wxDC * DC,						const wxPoint & offset, int draw_mode)/********************************************************************************//* Affichage d'un segment contour de module :	Entree : ox, oy = offset de trace	draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)		Les contours sont de differents type:		- Segment		- Cercles		- Arcs*/{int ux0, uy0, dx, dy,rayon, StAngle, EndAngle;int color , type_trace;int zoom;int typeaff;PCB_SCREEN * screen;WinEDA_BasePcbFrame * frame;MODULE * Module = NULL;	if ( m_Parent && (m_Parent->m_StructType == TYPEMODULE) )		Module = (MODULE*) m_Parent;	GRSetDrawMode(DC, draw_mode);	color = g_DesignSettings.m_LayerColor[m_Layer];	if ( panel ) screen = (PCB_SCREEN *) panel->m_Parent->m_CurrentScreen;	else screen = ActiveScreen;	frame = screen->GetParentPcbFrame();	zoom = screen->GetZoom();	type_trace = m_Shape;	ux0 = m_Start.x - offset.x; uy0 = m_Start.y - offset.y;	dx = m_End.x - offset.x ;	dy = m_End.y - offset.y ;	typeaff = frame->m_DisplayModEdge;	if( m_Layer <= CMP_N )		typeaff = frame->m_DisplayPcbTrackFill;	if( (m_Width /zoom) < L_MIN_DESSIN ) typeaff = FILAIRE;	switch (type_trace )	{		case S_SEGMENT:			if( typeaff == FILAIRE)				GRLine(&panel->m_ClipBox, DC,  ux0, uy0, dx, dy, color);			else Affiche_1_Segment(panel, DC, ux0,uy0,dx,dy,m_Width,									typeaff,color);			break ;		case S_CIRCLE:			rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );			if( typeaff == FILAIRE)			{				GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, color) ;			}			else			{				if(typeaff == FILLED )				{					GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color);				}				else				{					GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon + (m_Width/2), color) ;					GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon - (m_Width/2), color) ;				}			}			break;		case S_ARC:			rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );			StAngle = (int)ArcTangente( dy-uy0, dx-ux0 );			EndAngle = StAngle + m_Angle;			if ( StAngle > EndAngle) EXCHG (StAngle, EndAngle);			if( typeaff == FILAIRE)			{				GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color) ;			}			else if(typeaff == FILLED )				{					GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon,								m_Width, color);				}			else			{				GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,						rayon + (m_Width/2), color) ;				GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,						rayon - (m_Width/2), color) ;			}			break;		case S_POLYGON:		{			// We must compute true coordinates from m_PolyList			// which are relative to module position, orientation 0//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例22: dc

void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ){    wxPaintDC    dc( m_panelShowPad );    PAD_DRAWINFO drawInfo;    EDA_COLOR_T color = BLACK;    if( m_dummyPad->GetLayerSet()[F_Cu] )    {        color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE );    }    if( m_dummyPad->GetLayerSet()[B_Cu] )    {        color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );    }    // What could happen: the pad color is *actually* black, or no    // copper was selected    if( color == BLACK )        color = LIGHTGRAY;    drawInfo.m_Color     = color;    drawInfo.m_HoleColor = DARKGRAY;    drawInfo.m_Offset    = m_dummyPad->GetPosition();    drawInfo.m_Display_padnum  = true;    drawInfo.m_Display_netname = true;    if( m_dummyPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )        drawInfo.m_ShowNotPlatedHole = true;    // Shows the local pad clearance    drawInfo.m_PadClearance = m_dummyPad->GetLocalClearance();    wxSize dc_size = dc.GetSize();    dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );    // Calculate a suitable scale to fit the available draw area    int dim = m_dummyPad->GetBoundingRadius() *2;    // Invalid x size. User could enter zero, or have deleted all text prior to    // entering a new value; this is also treated as zero. If dim is left at    // zero, the drawing scale is zero and we get a crash.    if( dim == 0 )    {        // If drill size has been set, use that. Otherwise default to 1mm.        dim = m_dummyPad->GetDrillSize().x;        if( dim == 0 )            dim = Millimeter2iu( 1.0 );    }    if( m_dummyPad->GetLocalClearance() > 0 )        dim += m_dummyPad->GetLocalClearance() * 2;    double scale = (double) dc_size.x / dim;    // If the pad is a circle, use the x size here instead.    int ysize;    if( m_dummyPad->GetShape() == PAD_SHAPE_CIRCLE )        ysize = m_dummyPad->GetSize().x;    else        ysize = m_dummyPad->GetSize().y;    dim = ysize + std::abs( m_dummyPad->GetDelta().x );    // Invalid y size. See note about x size above.    if( dim == 0 )    {        dim = m_dummyPad->GetDrillSize().y;        if( dim == 0 )            dim = Millimeter2iu( 0.1 );    }    if( m_dummyPad->GetLocalClearance() > 0 )        dim += m_dummyPad->GetLocalClearance() * 2;    double altscale = (double) dc_size.y / dim;    scale = std::min( scale, altscale );    // Give a margin    scale *= 0.7;    dc.SetUserScale( scale, scale );    GRResetPenAndBrush( &dc );    m_dummyPad->DrawShape( NULL, &dc, drawInfo );    // Draw X and Y axis. Hhis is particularly useful to show the    // reference position of pads with offset and no hole, or custom pad shapes    const int linethickness = 0;    GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0,            linethickness, LIGHTBLUE );   // X axis    GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ),            linethickness, LIGHTBLUE );   // Y axis    event.Skip();}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:96,


示例23: GetBoard

void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,                                             GR_DRAWMODE draw_mode ){    GR_DRAWMODE current_gr_mode  = draw_mode;    bool    is_close_segment = false;    wxPoint seg_start, seg_end;    if( DC == NULL )        return;    LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;    BOARD* brd   = GetBoard();    EDA_COLOR_T color = brd->GetLayerColor( m_Layer );    if( DisplayOpt.ContrastModeDisplay )    {        if( !IsOnLayer( curr_layer ) )            ColorTurnToDarkDarkGray( &color );    }    // draw the lines    wxPoint start_contour_pos = GetCornerPosition( 0 );    int     icmax = GetNumCorners() - 1;    for( int ic = 0; ic <= icmax; ic++ )    {        int xi = GetCornerPosition( ic ).x;        int yi = GetCornerPosition( ic ).y;        int xf, yf;        if( !m_Poly->m_CornersList.IsEndContour( ic ) && ic < icmax )        {            is_close_segment = false;            xf = GetCornerPosition( ic + 1 ).x;            yf = GetCornerPosition( ic + 1 ).y;            if( m_Poly->m_CornersList.IsEndContour( ic + 1 ) || (ic == icmax - 1) )                current_gr_mode = GR_XOR;            else                current_gr_mode = draw_mode;        }        else    // Draw the line from last corner to the first corner of the current contour        {            is_close_segment = true;            current_gr_mode  = GR_XOR;            xf = start_contour_pos.x;            yf = start_contour_pos.y;            // Prepare the next contour for drawing, if exists            if( ic < icmax )                start_contour_pos = GetCornerPosition( ic + 1 );        }        GRSetDrawMode( DC, current_gr_mode );        if( is_close_segment )            GRLine( panel->GetClipBox(), DC, xi, yi, xf, yf, 0, WHITE );        else            GRLine( panel->GetClipBox(), DC, xi, yi, xf, yf, 0, color );    }}
开发者ID:ianohara,项目名称:kicad-source-mirror,代码行数:61,


示例24: dummyD_CODE

void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,                             const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aDrawOptions ){    // used when a D_CODE is not found. default D_CODE to draw a flashed item    static D_CODE dummyD_CODE( 0 );    bool          isFilled;    int           radius;    int           halfPenWidth;    static bool   show_err;    D_CODE*       d_codeDescr = GetDcodeDescr();    if( d_codeDescr == NULL )        d_codeDescr = &dummyD_CODE;    COLOR4D color = m_GerberImageFile->GetPositiveDrawColor();    if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )        color.SetToLegacyHighlightColor();    /* isDark is true if flash is positive and should use a drawing     *   color other than the background color, else use the background color     *   when drawing so that an erasure happens.     */    bool isDark = !(m_LayerNegative ^ m_GerberImageFile->m_ImageNegative);    if( !isDark )    {        // draw in background color ("negative" color)        color = aDrawOptions->m_NegativeDrawColor;    }    GRSetDrawMode( aDC, aDrawMode );    isFilled = aDrawOptions->m_DisplayLinesFill;    switch( m_Shape )    {    case GBR_POLYGON:        isFilled = aDrawOptions->m_DisplayPolygonsFill;        if( !isDark )            isFilled = true;        DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );        break;    case GBR_CIRCLE:        radius = KiROUND( GetLineLength( m_Start, m_End ) );        halfPenWidth = m_Size.x >> 1;        if( !isFilled )        {            // draw the border of the pen's path using two circles, each as narrow as possible            GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),                      radius - halfPenWidth, 0, color );            GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),                      radius + halfPenWidth, 0, color );        }        else    // Filled mode        {            GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),                      radius, m_Size.x, color );        }        break;    case GBR_ARC:        // Currently, arcs plotted with a rectangular aperture are not supported.        // a round pen only is expected.#if 0   // for arc debug only        GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),                GetABPosition( m_ArcCentre ), 0, color );        GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_End ),                GetABPosition( m_ArcCentre ), 0, color );#endif        if( !isFilled )        {            GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),                    GetABPosition( m_End ), GetABPosition( m_ArcCentre ),                    0, color );        }        else        {            GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),                    GetABPosition( m_End ), GetABPosition( m_ArcCentre ),                    m_Size.x, color );        }        break;    case GBR_SPOT_CIRCLE:    case GBR_SPOT_RECT:    case GBR_SPOT_OVAL:    case GBR_SPOT_POLY:    case GBR_SPOT_MACRO:        isFilled = aDrawOptions->m_DisplayFlashedItemsFill;        d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color,                                       m_Start, isFilled );//.........这里部分代码省略.........
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:101,



注:本文中的GRLine函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GRN_API_RETURN函数代码示例
C++ GRL_DEBUG函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。