本文整理匯總了C++中GRSetDrawMode函數的典型用法代碼示例。如果您正苦於以下問題:C++ GRSetDrawMode函數的具體用法?C++ GRSetDrawMode怎麽用?C++ GRSetDrawMode使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GRSetDrawMode函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GRSetDrawMode
void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
wxPoint pos = m_pos + aOffset;
if( aColor == COLOR4D::UNSPECIFIED ) // Use normal drawing function
{
// https://bugs.launchpad.net/kicad/+bug/1529163
// "Moving images in eeschema on OS X uses
// wrong position and shows image flipped"
//
// Original fix was to only GRSetDrawMode if aColor >= 0, but this made
// moving SCH_BITMAP work poorly on other platforms.
#ifndef __WXMAC__
GRSetDrawMode( aDC, aDrawMode );
#endif
m_image->DrawBitmap( aPanel, aDC, pos );
}
else // draws bounding box only (used to move items)
{
GRSetDrawMode( aDC, aDrawMode );
// To draw the rect, pos is the upper left corner position
wxSize size = m_image->GetSize();
pos.x -= size.x / 2;
pos.y -= size.y / 2;
GRRect( aPanel->GetClipBox(), aDC, pos.x, pos.y,
pos.x + size.x, pos.y + size.y, 0, aColor );
}
}
示例2: DrawMovingBlockOutlines
static void DrawMovingBlockOutlines(WinEDA_DrawPanel * panel, wxDC * DC,
bool erase )
/************************************************************************/
/* Retrace le contour du block de recherche de structures
L'ensemble du block suit le curseur
*/
{
DrawBlockStruct * PtBlock;
DrawPickedStruct *PickedList;
BASE_SCREEN * screen = panel->m_Parent->GetScreen();
PtBlock = &panel->GetScreen()->BlockLocate;
GRSetDrawMode(DC, g_XorMode);
/* Effacement ancien cadre */
if( erase && PtBlock->m_BlockDrawStruct)
{
PtBlock->Offset(PtBlock->m_MoveVector);
PtBlock->Draw(panel, DC);
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y);
/* Effacement ancien affichage */
if(PtBlock->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE)
{
PickedList = (DrawPickedStruct *) PtBlock->m_BlockDrawStruct;
while (PickedList)
{
DrawStructsInGhost(panel, DC, PickedList->m_PickedStruct, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y);
PickedList = (DrawPickedStruct *)PickedList->Pnext;
}
}
else DrawStructsInGhost(panel, DC, PtBlock->m_BlockDrawStruct, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y);
}
/* Redessin nouvel affichage */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode(DC, g_XorMode);
PtBlock->Offset(PtBlock->m_MoveVector);
PtBlock->Draw(panel, DC);
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y);
if(PtBlock->m_BlockDrawStruct )
{
if(PtBlock->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE)
{
PickedList = (DrawPickedStruct *) PtBlock->m_BlockDrawStruct;
while (PickedList)
{
DrawStructsInGhost(panel, DC, PickedList->m_PickedStruct, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y);
PickedList = (DrawPickedStruct *)PickedList->Pnext;
}
}
else DrawStructsInGhost(panel, DC, PtBlock->m_BlockDrawStruct, PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y);
}
}
示例3: wxT
void WinEDA_LibeditFrame::EditField(wxDC * DC, LibDrawField *Field)
/******************************************************************/
{
wxString Text;
int color;
wxString title = wxT("Text:");
if( Field == NULL) return;
switch (Field->m_FieldId)
{
case REFERENCE:
title = wxT("Reference:");
color = ReturnLayerColor(LAYER_REFERENCEPART);
break;
case VALUE:
title = wxT("Value:");
color = ReturnLayerColor(LAYER_VALUEPART);
break;
default:
color = ReturnLayerColor(LAYER_FIELDS);
break;
}
if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY;
Text = Field->m_Text;
Get_Message(title,Text, this);
Text.Replace( wxT(" ") , wxT("_") );
GRSetDrawMode(DC, g_XorMode);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify);
if( ! Text.IsEmpty() )
{
SaveCopyInUndoList();
Field->m_Text = Text;
}
else DisplayError(this, _("No new text: no change") );
if( Field->m_Flags == 0 ) GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
Field->m_HJustify, Field->m_VJustify);
m_CurrentScreen->SetModify();
if ( Field->m_FieldId == VALUE ) ReCreateHToolbar();
}
示例4: 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 );
}
}
示例5: 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() );
}
示例6: 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 );
}
}
示例7: Polyline_in_Ghost
static void Polyline_in_Ghost(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
/*****************************************************************************/
/* Dessin du du Polyline Fantome lors des deplacements du curseur
*/
{
DrawPolylineStruct * NewPoly =
(DrawPolylineStruct *)panel->m_Parent->GetScreen()->m_CurrentItem;
int color;
wxPoint endpos;
endpos = panel->m_Parent->GetScreen()->m_Curseur;
color = ReturnLayerColor(NewPoly->m_Layer);
GRSetDrawMode(DC, XOR_MODE);
if( g_HVLines )
{
/* Coerce the line to vertical or horizontal one: */
if (ABS(endpos.x - NewPoly->m_Points[NewPoly->m_NumOfPoints * 2 - 2]) <
ABS(endpos.y - NewPoly->m_Points[NewPoly->m_NumOfPoints * 2 - 1]))
endpos.x = NewPoly->m_Points[NewPoly->m_NumOfPoints * 2 - 2];
else
endpos.y = NewPoly->m_Points[NewPoly->m_NumOfPoints * 2 - 1];
}
NewPoly->m_NumOfPoints++;
if( erase )
RedrawOneStruct(panel,DC, NewPoly, XOR_MODE, color);
NewPoly->m_Points[NewPoly->m_NumOfPoints * 2 - 2] = endpos.x;
NewPoly->m_Points[NewPoly->m_NumOfPoints * 2 - 1] = endpos.y;
RedrawOneStruct(panel,DC, NewPoly, XOR_MODE, color);
NewPoly->m_NumOfPoints--;
}
示例8: 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;
}
}
示例9: 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
}
示例10: GetParent
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
{
wxPoint origin = GetParent()->GetAuxOrigin();
if( origin == wxPoint( 0, 0 ) )
return;
EDA_COLOR_T color = DARKRED;
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
origin.x,
-pageSize.y,
origin.x,
pageSize.y,
0, color );
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-pageSize.x,
origin.y,
pageSize.x,
origin.y,
0, color );
}
示例11: GetScreen
void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
PCB_SCREEN* screen = GetScreen();
if( !GetBoard() || !screen )
return;
GRSetDrawMode( DC, GR_COPY );
m_canvas->DrawBackGround( DC );
DrawWorkSheet( DC, screen, 0, IU_PER_MILS, wxEmptyString );
// Redraw the footprints
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
module->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST );
#ifdef USE_WX_OVERLAY
if( IsShown() )
{
m_overlay.Reset();
wxDCOverlay overlaydc( m_overlay, (wxWindowDC*) DC );
overlaydc.Clear();
}
#endif
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
// Redraw the cursor
m_canvas->DrawCrossHair( DC );
}
示例12: GetDefaultLineThickness
void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
EDA_COLOR_T color;
int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 )
color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
wxPoint text_offset = aOffset + GetSchematicTextOffset();
EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
EXCHG( linewidth, m_Thickness ); // set initial value
if( m_isDangling )
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
// Enable these line to draw the bounding box (debug tests purposes only)
#if 0
{
EDA_RECT BoundaryBox = GetBoundingBox();
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN );
}
#endif
}
示例13: 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);
}
}
示例14: DrawAndSizingBlockOutlines
void DrawAndSizingBlockOutlines(WinEDA_DrawPanel * panel, wxDC * DC, bool erase )
/********************************************************************************/
/* Redraw the outlines of the block which shows the search area for block commands
The first point of the rectangle showing the area is initialised
by InitBlockLocateDatas().
The other point of the rectangle is the mouse cursor
*/
{
DrawBlockStruct * PtBlock;
PtBlock = &panel->GetScreen()->BlockLocate;
PtBlock->m_MoveVector = wxPoint(0,0);
GRSetDrawMode(DC, g_XorMode);
/* Effacement ancien cadre */
if( erase ) PtBlock->Draw(panel, DC);
PtBlock->m_BlockLastCursorPosition = panel->GetScreen()->m_Curseur;
PtBlock->SetEnd(panel->GetScreen()->m_Curseur);
PtBlock->Draw(panel, DC);
if ( PtBlock->m_State == STATE_BLOCK_INIT )
{
if ( PtBlock->GetWidth() || PtBlock->GetHeight() )
/* 2ieme point existant: le rectangle n'est pas de surface nulle */
PtBlock->m_State = STATE_BLOCK_END;
}
}
示例15: GetScreen
void WinEDA_PcbFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg)
/****************************************************************/
/* Trace le PCB, et les elements complementaires ( axes, grille .. )
pour l'ecran actif et ses sous ecran
*/
{
PCB_SCREEN * Screen = GetScreen();
if ( ! m_Pcb || ! Screen ) return;
ActiveScreen = GetScreen();
GRSetDrawMode(DC, GR_COPY);
if ( EraseBg ) DrawPanel->EraseScreen(DC);
DrawPanel->DrawBackGround(DC);
Trace_Pcb(DC, GR_OR);
TraceWorkSheet(DC, GetScreen());
Affiche_Status_Box();
/* Reaffichage des curseurs */
for( Screen = GetScreen(); Screen != NULL; Screen = Screen->Next() )
{
if( m_CurrentScreen->ManageCurseur )
m_CurrentScreen->ManageCurseur(DrawPanel, DC, FALSE);
Screen->Trace_Curseur(DrawPanel, DC);
}
}