本文整理汇总了C++中wxDC::SetLogicalFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::SetLogicalFunction方法的具体用法?C++ wxDC::SetLogicalFunction怎么用?C++ wxDC::SetLogicalFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::SetLogicalFunction方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawFocus
//
// Draws a focus rectangle (Taken directly from wxWidgets source)
//
void AColor::DrawFocus(wxDC & dc, wxRect & rect)
{
// draw the pixels manually: note that to behave in the same manner as
// DrawRect(), we must exclude the bottom and right borders from the
// rectangle
wxCoord x1 = rect.GetLeft(),
y1 = rect.GetTop(),
x2 = rect.GetRight(),
y2 = rect.GetBottom();
dc.SetPen(wxPen(wxT("MEDIUM GREY"), 0, wxSOLID));
// this seems to be closer than what Windows does than wxINVERT although
// I'm still not sure if it's correct
dc.SetLogicalFunction(wxAND_REVERSE);
wxCoord z;
for ( z = x1 + 1; z < x2; z += 2 )
dc.DrawPoint(z, y1);
wxCoord shift = z == x2 ? 0 : 1;
for ( z = y1 + shift; z < y2; z += 2 )
dc.DrawPoint(x2, z);
shift = z == y2 ? 0 : 1;
for ( z = x2 - shift; z > x1; z -= 2 )
dc.DrawPoint(z, y2);
shift = z == x1 ? 0 : 1;
for ( z = y2 - shift; z > y1; z -= 2 )
dc.DrawPoint(x1, z);
dc.SetLogicalFunction(wxCOPY);
}
示例2: Draw
bool RedHatchDrawlet::Draw(wxDC &dc)
{
#if wxCHECK_VERSION(2, 9, 0)
wxRasterOperationMode old_lf = dc.GetLogicalFunction();
#else
int old_lf = dc.GetLogicalFunction();
#endif
dc.SetLogicalFunction(wxXOR);
wxPen old_pen = dc.GetPen();
wxBrush old_brush = dc.GetBrush();
wxColor red = wxColor( ~wxRED->Red(), ~wxRED->Green(), ~wxRED->Blue());
#if wxCHECK_VERSION(2,9,0)
wxBrush brush = wxBrush(red, wxHATCHSTYLE_CROSSDIAG );
#else
wxBrush brush = wxBrush(red, wxCROSSDIAG_HATCH );
#endif
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(brush);
dc.DrawRectangle(m_rect);
dc.SetLogicalFunction(old_lf);
dc.SetPen(old_pen);
dc.SetBrush(old_brush);
return true;
}
示例3: wxMSWDrawFocusRect
// Draws non-XP GUI dotted line around the focus area
static void wxMSWDrawFocusRect( wxDC& dc, const wxRect& rect )
{
/*
RECT mswRect;
mswRect.left = rect.x;
mswRect.top = rect.y;
mswRect.right = rect.x + rect.width;
mswRect.bottom = rect.y + rect.height;
HDC hdc = (HDC) dc.GetHDC();
SetMapMode(hdc,MM_TEXT); // Just in case...
DrawFocusRect(hdc,&mswRect);
*/
// FIXME: Use DrawFocusRect code above (currently it draws solid line
// for caption focus but works ok for other stuff).
// Also, this code below may not work in future wx versions, since
// it employs wxCAP_BUTT hack to have line of width 1.
dc.SetLogicalFunction(wxINVERT);
wxPen pen(*wxBLACK, 1, wxPENSTYLE_DOT);
pen.SetCap(wxCAP_BUTT);
dc.SetPen(pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect);
dc.SetLogicalFunction(wxCOPY);
}
示例4: DrawSelection
void wxBitmapComboPopupChild::DrawSelection( int n, wxDC& dc )
{
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(*wxBLACK_PEN);
dc.SetLogicalFunction(wxINVERT);
int height = m_bmpCombo->GetItemSize().y;
dc.DrawRectangle(0, wxMax(0,height*n-1), GetClientSize().x, height+2);
dc.SetLogicalFunction(wxCOPY);
}
示例5: cursPos
/* virtual */ void EditPanel::Render(wxDC& dc)
{
if (!IsOk())
{
return;
}
DrawPanel::Render( dc );
if (mDrawGrid)
{
DrawGrid( dc );
}
dc.SetBrush( *wxTRANSPARENT_BRUSH );
if (mDrawCursor)
{
dc.SetLogicalFunction(wxXOR);
dc.SetPen( wxPen( *wxWHITE, 3, wxPENSTYLE_SOLID ) );
wxPoint cursPos( mCursor );
cursPos.x *= mRealScale;
cursPos.y *= mRealScale;
dc.DrawRectangle( cursPos, wxSize( mRealScale, mRealScale ) );
}
}
示例6: _Distance_Draw
//---------------------------------------------------------
void CVIEW_Map_Control::_Distance_Draw(wxDC &dc)
{
int n = m_Distance_Pts.Get_Count();
if( m_Mode == MAP_MODE_DISTANCE && n > 0 )
{
int i;
wxPoint A, B;
dc.SetPen(wxPen(*wxWHITE, 4));
for(i=1, A=_Get_World2Client(m_Distance_Pts[0]); i<n; i++)
{
B = A;
A = _Get_World2Client(m_Distance_Pts[i]);
dc.DrawLine(A.x, A.y, B.x, B.y);
}
dc.SetPen(wxPen(*wxBLACK, 2));
for(i=1, A=_Get_World2Client(m_Distance_Pts[0]); i<n; i++)
{
B = A;
A = _Get_World2Client(m_Distance_Pts[i]);
dc.DrawLine(A.x, A.y, B.x, B.y);
}
dc.SetPen(wxNullPen);
dc.SetLogicalFunction(wxINVERT);
A = _Get_World2Client(m_Distance_Pts[n - 1]);
dc.DrawLine(A.x, A.y, m_Mouse_Move.x, m_Mouse_Move.y);
}
}
示例7: size
/* virtual */ void PalettePanel::Render(wxDC& dc)
{
EditPanel::Render( dc );
wxSize size( mRealScale + 2, mRealScale + 2);
dc.SetBrush( *wxTRANSPARENT_BRUSH );
dc.SetLogicalFunction( wxCOPY );
wxPen pen( *wxGREEN, 3, wxPENSTYLE_LONG_DASH );
for (int i = 0; i < 2; ++i)
{
wxPoint pos = i == 0 ? mLeftPos : mRightPos;
wxPoint from( (pos.x * mRealScale) - 1, (pos.y * mRealScale) - 1 );
if ( i > 0 )
{
pen.SetColour( *wxRED );
if (mLeftPos == mRightPos)
{
from.x -= 2;
from.y -= 2;
size += wxSize(4, 4);
}
}
dc.SetPen( pen );
dc.DrawRectangle( from, size );
}
}
示例8: WXUNUSED
void
wxStdRenderer::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
{
// draw the pixels manually because the "dots" in wxPen with wxDOT style
// may be short traits and not really dots
//
// note that to behave in the same manner as DrawRect(), we must exclude
// the bottom and right borders from the rectangle
wxCoord x1 = rect.GetLeft(),
y1 = rect.GetTop(),
x2 = rect.GetRight(),
y2 = rect.GetBottom();
dc.SetPen(m_penBlack);
// this seems to be closer than what Windows does than wxINVERT although
// I'm still not sure if it's correct
dc.SetLogicalFunction(wxAND_REVERSE);
wxCoord z;
for ( z = x1 + 1; z < x2; z += 2 )
dc.DrawPoint(z, rect.GetTop());
wxCoord shift = z == x2 ? 0 : 1;
for ( z = y1 + shift; z < y2; z += 2 )
dc.DrawPoint(x2, z);
shift = z == y2 ? 0 : 1;
for ( z = x2 - shift; z > x1; z -= 2 )
dc.DrawPoint(z, y2);
shift = z == x1 ? 0 : 1;
for ( z = y2 - shift; z > y1; z -= 2 )
dc.DrawPoint(x1, z);
dc.SetLogicalFunction(wxCOPY);
}
示例9: DrawGrid
void EditPanel::DrawGrid( wxDC& dc )
{
if (mPointsNumber == 0)
{
return;
}
dc.SetPen( mGridPen );
dc.SetLogicalFunction( (wxRasterOperationMode) mGridLogic );
wxPoint view = this->GetViewStart();
float horFloat = (float) view.x / mRealScale;
float vertFloat = (float) view.y / mRealScale;
int horizCorr = ( ceil(horFloat) * mRealScale );
int vertCorr = ( ceil(vertFloat) * mRealScale );
wxPoint corrPoint( horizCorr, vertCorr );
for (int i = 0; i < mPointsNumber; )
{
wxPoint& first = mGridPoints[i++];
wxPoint& second = mGridPoints[i++];
dc.DrawLine( first + corrPoint, second + corrPoint);
}
}
示例10: PaintItems
void wxSwitcherItems::PaintItems(wxDC& dc, wxWindow* win)
{
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
wxColour standardTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour selectionColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
wxColour selectionOutlineColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour selectionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
wxFont standardFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
wxFont groupFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
groupFont.SetWeight(wxFONTWEIGHT_BOLD);
if (GetBackgroundColour().Ok())
backgroundColour = GetBackgroundColour();
if (GetTextColour().Ok())
standardTextColour = GetTextColour();
if (GetSelectionColour().Ok())
selectionColour = GetSelectionColour();
if (GetSelectionOutlineColour().Ok())
selectionOutlineColour = GetSelectionOutlineColour();
if (GetSelectionTextColour().Ok())
selectionTextColour = GetSelectionTextColour();
if (GetItemFont().Ok())
{
standardFont = GetItemFont();
groupFont = wxFont(standardFont.GetPointSize(), standardFont.GetFamily(), standardFont.GetStyle(),
wxFONTWEIGHT_BOLD, standardFont.GetUnderlined(), standardFont.GetFaceName());
}
int textMarginX = wxSWITCHER_TEXT_MARGIN_X;
dc.SetLogicalFunction(wxCOPY);
dc.SetBrush(wxBrush(backgroundColour));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(win->GetClientRect());
dc.SetBackgroundMode(wxTRANSPARENT);
size_t i;
for (i = 0; i < m_items.GetCount(); i++)
{
wxSwitcherItem& item = m_items[i];
bool selected = ((int) i == m_selection);
if (selected)
{
dc.SetPen(wxPen(selectionOutlineColour));
dc.SetBrush(wxBrush(selectionColour));
dc.DrawRectangle(item.GetRect());
}
wxRect clippingRect(item.GetRect());
clippingRect.Deflate(1, 1);
dc.SetClippingRegion(clippingRect);
if (selected)
dc.SetTextForeground(selectionTextColour);
else if (item.GetTextColour().Ok())
dc.SetTextForeground(item.GetTextColour());
else
dc.SetTextForeground(standardTextColour);
if (item.GetFont().Ok())
dc.SetFont(item.GetFont());
else
{
if (item.GetIsGroup())
dc.SetFont(groupFont);
else
dc.SetFont(standardFont);
}
int w, h;
dc.GetTextExtent(item.GetTitle(), & w, & h);
int x = item.GetRect().x;
x += textMarginX;
if (!item.GetIsGroup())
{
if (item.GetBitmap().Ok() && item.GetBitmap().GetWidth() <= 16 && item.GetBitmap().GetHeight() <= 16)
{
dc.DrawBitmap(item.GetBitmap(), x, item.GetRect().y + (item.GetRect().height - item.GetBitmap().GetHeight()) / 2, true);
}
x += 16;
x += textMarginX;
}
int y = item.GetRect().y + (item.GetRect().height - h)/2;
dc.DrawText(item.GetTitle(), x, y);
dc.DestroyClippingRegion();
}
//.........这里部分代码省略.........
示例11: DrawForPrintingHelper
void DrawForPrintingHelper(wxDC& dc, const CalChartConfiguration& config, const CalChartDoc& show, const CC_sheet& sheet, unsigned ref, bool landscape)
{
// set up everything to be restored after we print
SaveAndRestore_DeviceOrigin orig_dev(dc);
SaveAndRestore_UserScale orig_scale(dc);
SaveAndRestore_Font orig_font(dc);
// get the page dimensions
int pageW, pageH;
dc.GetSize(&pageW, &pageH);
dc.Clear();
dc.SetLogicalFunction(wxCOPY);
// Print the field:
// create a field for drawing:
const auto pts = sheet.GetPoints();
auto boundingBox = GetMarcherBoundingBox(pts);
auto mode = CreateFieldForPrinting(Coord2Int(boundingBox.first.x), Coord2Int(boundingBox.second.x), landscape);
// set the origin and scaling for drawing the field
dc.SetDeviceOrigin(kFieldBorderOffset*pageW, kFieldTop*pageH);
auto scale = (pageW-2*kFieldBorderOffset*pageW)/(double)mode->Size().x;
dc.SetUserScale(scale, scale);
// draw the field.
DrawMode(dc, config, *mode, ShowMode_kPrinting);
wxFont *pointLabelFont = wxTheFontList->FindOrCreateFont((int)Float2Coord(config.Get_DotRatio() * config.Get_NumRatio()), wxSWISS, wxNORMAL, wxNORMAL);
dc.SetFont(*pointLabelFont);
for (auto i = 0u; i < pts.size(); i++)
{
const auto point = pts.at(i);
const auto pos = point.GetPos(ref) + mode->Offset();
dc.SetBrush(*wxBLACK_BRUSH);
DrawPointHelper(dc, config, pos, point, show.GetPointLabel(i));
}
// now reset everything to draw the rest of the text
dc.SetDeviceOrigin(Int2Coord(0), Int2Coord(0));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
// set the page for drawing:
dc.GetSize(&pageW, &pageH);
if (landscape)
{
dc.SetUserScale(pageW/kSizeXLandscape, pageH/kSizeYLandscape);
pageW = kSizeXLandscape;
pageH = kSizeYLandscape;
}
else
{
dc.SetUserScale(pageW/kSizeX, pageH/kSizeY);
pageW = kSizeX;
pageH = kSizeY;
}
// draw the header
dc.SetFont(*wxTheFontList->FindOrCreateFont(16, wxROMAN, wxNORMAL, wxBOLD));
dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxSOLID));
DrawCenteredText(dc, kHeader, wxPoint(pageW*kHeaderLocation[landscape][0], pageH*kHeaderLocation[landscape][1]));
DrawCenteredText(dc, sheet.GetNumber(), wxPoint(pageW*kUpperNumberPosition[landscape][0], pageH*kUpperNumberPosition[landscape][1]));
DrawCenteredText(dc, sheet.GetNumber(), wxPoint(pageW*kLowerNumberPosition[landscape][0], pageH*kLowerNumberPosition[landscape][1]));
dc.DrawRectangle(pageW*kLowerNumberBox[landscape][0], pageH*kLowerNumberBox[landscape][1], pageW*kLowerNumberBox[landscape][2], pageH*kLowerNumberBox[landscape][3]);
dc.SetFont(*wxTheFontList->FindOrCreateFont(8, wxSWISS, wxNORMAL, wxNORMAL));
DrawLineOverText(dc, kMusicLabel, wxPoint(pageW*kMusicLabelPosition[landscape][0], pageH*kMusicLabelPosition[landscape][1]), pageW*kMusicLabelPosition[landscape][2]);
DrawLineOverText(dc, kFormationLabel, wxPoint(pageW*kFormationLabelPosition[landscape][0], pageH*kFormationLabelPosition[landscape][1]), pageW*kFormationLabelPosition[landscape][2]);
DrawLineOverText(dc, kGameLabel, wxPoint(pageW*kGameLabelPosition[landscape][0], pageH*kGameLabelPosition[landscape][1]), pageW*kGameLabelPosition[landscape][2]);
DrawLineOverText(dc, kPageLabel, wxPoint(pageW*kPageLabelPosition[landscape][0], pageH*kPageLabelPosition[landscape][1]), pageW*kPageLabelPosition[landscape][2]);
DrawCenteredText(dc, kSideLabel, wxPoint(pageW*kSideLabelPosition[landscape][0], pageH*kSideLabelPosition[landscape][1]));
// draw arrows
DrawCenteredText(dc, kUpperSouthLabel, wxPoint(pageW*kUpperSouthPosition[landscape][0], pageH*kUpperSouthPosition[landscape][1]));
DrawArrow(dc, wxPoint(pageW*kUpperSouthArrow[landscape][0], pageH*kUpperSouthArrow[landscape][1]), pageW*kUpperSouthArrow[landscape][2], false);
DrawCenteredText(dc, kUpperNorthLabel, wxPoint(pageW*kUpperNorthPosition[landscape][0], pageH*kUpperNorthPosition[landscape][1]));
DrawArrow(dc, wxPoint(pageW*kUpperNorthArrow[landscape][0], pageH*kUpperNorthArrow[landscape][1]), pageW*kUpperNorthArrow[landscape][2], true);
DrawCenteredText(dc, kLowerSouthLabel, wxPoint(pageW*kLowerSouthPosition[landscape][0], pageH*kLowerSouthPosition[landscape][1]));
DrawArrow(dc, wxPoint(pageW*kLowerSouthArrow[landscape][0], pageH*kLowerSouthArrow[landscape][1]), pageW*kLowerSouthArrow[landscape][2], false);
DrawCenteredText(dc, kLowerNorthLabel, wxPoint(pageW*kLowerNorthPosition[landscape][0], pageH*kLowerNorthPosition[landscape][1]));
DrawArrow(dc, wxPoint(pageW*kLowerNorthArrow[landscape][0], pageH*kLowerNorthArrow[landscape][1]), pageW*kLowerNorthArrow[landscape][2], true);
DrawCont(dc, sheet.GetPrintableContinuity(), wxRect(wxPoint(10, pageH*kContinuityStart[landscape]), wxSize(pageW-20, pageH-pageH*kContinuityStart[landscape])), landscape);
}