当前位置: 首页>>代码示例>>C++>>正文


C++ GRLine函数代码示例

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


在下文中一共展示了GRLine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:eda_draw_panel.cpp

示例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,代码来源:base_screen.cpp

示例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,代码来源:eda_draw_panel.cpp

示例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,代码来源:draw_panel.cpp

示例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,代码来源:class_pcb_target.cpp

示例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,代码来源:ratsnest.cpp

示例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,代码来源:sch_bus_entry.cpp

示例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,代码来源:class_track.cpp

示例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,代码来源:class_track.cpp

示例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,代码来源:block_commande.cpp

示例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,代码来源:class_netinfo_item.cpp

示例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,代码来源:class_dimension.cpp

示例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,代码来源:sch_no_connect.cpp

示例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,代码来源:class_text_mod.cpp

示例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,代码来源:sch_bus_entry.cpp


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