本文整理汇总了C++中EXCHG函数的典型用法代码示例。如果您正苦于以下问题:C++ EXCHG函数的具体用法?C++ EXCHG怎么用?C++ EXCHG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXCHG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: wxASSERT
void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
int radius, FILL_T fill, int width )
{
wxASSERT( outputFile );
if( radius <= 0 )
return;
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
SetCurrentLineWidth( width );
// Calculate start point.
DPOINT centre_dev = userToDeviceCoordinates( centre );
double radius_dev = userToDeviceSize( radius );
if( m_plotMirror )
{
if( m_mirrorIsHorizontal )
{
StAngle = 1800.0 -StAngle;
EndAngle = 1800.0 -EndAngle;
EXCHG( StAngle, EndAngle );
}
else
{
StAngle = -StAngle;
EndAngle = -EndAngle;
}
}
fprintf( outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
radius_dev, StAngle / 10.0, EndAngle / 10.0, fill );
}
示例3: EXCHG
void PCB_TARGET::Exchg( PCB_TARGET* source )
{
EXCHG( m_Pos, source->m_Pos );
EXCHG( m_Width, source->m_Width );
EXCHG( m_Size, source->m_Size );
EXCHG( m_Shape, source->m_Shape );
}
示例4: wxCHECK_RET
void SCH_BUS_ENTRY::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_BUS_ENTRY_T),
wxT( "Cannot swap bus entry data with invalid item." ) );
SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*)aItem;
EXCHG( m_pos, item->m_pos );
EXCHG( m_size, item->m_size );
EXCHG( m_width, item->m_width );
}
示例5: wxASSERT
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
int x0, y0, x1, y1, delta;
wxSize size( aSize );
/* Plot a flashed shape. */
if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
&& trace_mode == FILLED )
{
if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
EXCHG( size.x, size.y );
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Oval );
emitDcode( pos_dev, 3 );
}
else /* Plot pad as a segment. */
{
if( size.x > size.y )
{
EXCHG( size.x, size.y );
if( orient < 2700 )
orient += 900;
else
orient -= 2700;
}
if( trace_mode == FILLED )
{
/* XXX to do: use an aperture macro to declare the rotated pad */
/* The pad is reduced to an oval with dy > dx */
delta = size.y - size.x;
x0 = 0;
y0 = -delta / 2;
x1 = 0;
y1 = delta / 2;
RotatePoint( &x0, &y0, orient );
RotatePoint( &x1, &y1, orient );
ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
wxPoint( pos.x + x1, pos.y + y1 ),
size.x, trace_mode );
}
else
{
sketchOval( pos, size, orient, -1 );
}
}
}
示例6: increment
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxPoint start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
SetCurrentLineWidth( width );
/* Please NOTE the different sign due to Y-axis flip */
start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) );
start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) );
MoveTo( start );
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
{
end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) );
end.y = centre.y + KiROUND( sindecideg( radius, -ii ) );
LineTo( end );
}
end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) );
end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) );
FinishTo( end );
}
示例7: EXCHG
wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
{
/* Note: RS274Xrevd_e is obscure about the order of transforms:
* For instance: Rotation must be made after or before mirroring ?
* Note: if something is changed here, GetYXPosition must reflect changes
*/
wxPoint abPos = aXYPosition + m_imageParams->m_ImageJustifyOffset;
if( m_swapAxis )
EXCHG( abPos.x, abPos.y );
abPos += m_layerOffset + m_imageParams->m_ImageOffset;
abPos.x = KiROUND( abPos.x * m_drawScale.x );
abPos.y = KiROUND( abPos.y * m_drawScale.y );
double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
if( rotation )
RotatePoint( &abPos, -rotation );
// Negate A axis if mirrored
if( m_mirrorA )
NEGATE( abPos.x );
// abPos.y must be negated when no mirror, because draw axis is top to bottom
if( !m_mirrorB )
NEGATE( abPos.y );
return abPos;
}
示例8: EXCHG
void DIALOG_EESCHEMA_CONFIG::OnButtonDownClick( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListLibr->GetSelections(selections);
if ( selections.GetCount() <= 0 ) // No selection.
return;
// The last lib is selected. cannot move down it
if( selections.Last() == (int)(m_ListLibr->GetCount()-1) )
return;
wxArrayString libnames = m_ListLibr->GetStrings();
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
int jj = selections[ii];
EXCHG( libnames[jj], libnames[jj+1]);
}
m_ListLibr->Set( libnames );
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListLibr->SetSelection(jj+1);
}
m_LibListChanged = true;
}
示例9: wxASSERT
/* Plot oval pad.
*/
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
int deltaxy, cx, cy;
wxSize size( aSize );
/* The pad is reduced to an oval with size.y > size.x
* (Oval vertical orientation 0)
*/
if( size.x > size.y )
{
EXCHG( size.x, size.y );
orient = AddAngles( orient, 900 );
}
deltaxy = size.y - size.x; // distance between centers of the oval
if( trace_mode == FILLED )
{
FlashPadRect( pos, wxSize( size.x, deltaxy + KiROUND( penDiameter ) ),
orient, trace_mode );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode );
cx = 0; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode );
}
else // Plot in SKETCH mode.
{
sketchOval( pos, size, orient, KiROUND( penDiameter ) );
}
}
示例10: NEGATE
wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
{
// do the inverse transform made by GetABPosition
wxPoint xyPos = aABPosition;
if( m_mirrorA )
NEGATE( xyPos.x );
if( !m_mirrorB )
NEGATE( xyPos.y );
double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
if( rotation )
RotatePoint( &xyPos, rotation );
xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
xyPos -= m_layerOffset + m_imageParams->m_ImageOffset;
if( m_swapAxis )
EXCHG( xyPos.x, xyPos.y );
return xyPos - m_imageParams->m_ImageJustifyOffset;
}
示例11: IsBusLabel
int IsBusLabel( const char * LabelDrawList )
/**************************************************/
/* Routine qui verifie si le Label a une notation de type Bus
Retourne 0 si non
nombre de membres si oui
met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
*/
{
char * Num;
char BufLine[1024];
if ( strchr(LabelDrawList,'[') == NULL ) /* 1er [ trouve : c'est une notation de Bus */
return(0);
strcpy(BufLine, LabelDrawList);
Num = strtok(BufLine,"[");
RootBusNameLength = strlen(Num);
Num = strtok(NULL,".");
FirstNumWireBus = atoi(Num);
Num = strtok(NULL,".]");
LastNumWireBus = atoi(Num);
if( FirstNumWireBus < 0 ) FirstNumWireBus = 0;
if( LastNumWireBus < 0 ) LastNumWireBus = 0;
if( FirstNumWireBus > LastNumWireBus )
{
EXCHG( FirstNumWireBus, LastNumWireBus);
}
return(LastNumWireBus - FirstNumWireBus + 1 );
}
示例12: gr_vline
int gr_vline(int y1, int y2, int x)
{
int i;
if (y1 > y2) EXCHG(y1,y2);
for (i=y1; i<=y2; i++ )
gr_upixel( x, i );
return 0;
}
示例13: gr_vline
int gr_vline(int y1, int y2, int x) {
int i;
if (y1 > y2) EXCHG(y1, y2);
for (i = y1; i <= y2; i++)
// gr_upixel( x, i );
DATA[ROWSIZE*i + x] = COLOR;
return 0;
}
示例14: gr_hline
int gr_hline(int x1, int x2, int y)
{
int i;
if (x1 > x2) EXCHG(x1,x2);
for (i=x1; i<=x2; i++ )
gr_upixel( i, y );
return 0;
}
示例15: gr_hline
int gr_hline(int x1, int x2, int y) {
int i;
int t;
if (x1 > x2) EXCHG(x1, x2);
t = ROWSIZE * y;
for (i = x1; i <= x2; i++) {
// gr_upixel( i, y );
DATA[t + i] = COLOR;
}
return 0;
}