本文整理汇总了C++中wxColour::GetPixel方法的典型用法代码示例。如果您正苦于以下问题:C++ wxColour::GetPixel方法的具体用法?C++ wxColour::GetPixel怎么用?C++ wxColour::GetPixel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxColour
的用法示例。
在下文中一共展示了wxColour::GetPixel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTextWithSpacing
void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point)
{
#if USE(WXGC)
wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext());
#else
wxDC* dc = graphicsContext->platformContext();
#endif
// get the native HDC handle to draw using native APIs
HDC hdc = 0;
#if USE(WXGC)
wxGraphicsContext* gc = dc->GetGraphicsContext();
Gdiplus::Graphics* g;
if (gc) {
g = (Gdiplus::Graphics*)gc->GetNativeContext();
hdc = g->GetHDC();
}
#else
hdc = static_cast<HDC>(dc->GetHDC());
#endif
// ExtTextOut wants the offsets as an array of ints, so extract them
// from the glyph buffer
const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
const GlyphBufferAdvance* advances = glyphBuffer.advances(from);
float y = point.y() - font->ascent();
float x = point.x();
int* spacing = new int[numGlyphs - from];
for (unsigned i = 0; i < numGlyphs; ++i)
spacing[i] = advances[i].width();
wxFont* wxfont = font->getWxFont();
if (wxfont && wxfont->IsOk())
::SelectObject(hdc, GetHfontOf(*wxfont));
if (color.Ok())
::SetTextColor(hdc, color.GetPixel());
// do not draw background behind characters
::SetBkMode(hdc, TRANSPARENT);
// draw text with optional character widths array
wxString string = wxString((wxChar*)(&glyphs[from]), numGlyphs);
::ExtTextOut(hdc, x, y, 0, NULL, string.c_str(), string.length(), spacing);
::SetBkMode(hdc, TRANSPARENT);
#if USE(WXGC)
g->ReleaseHDC(hdc);
#endif
delete [] spacing;
}
示例2: SetBackgroundColour
bool wxGauge::SetBackgroundColour( const wxColour& rColour )
{
if (!wxControl::SetBackgroundColour(rColour))
return false;
LONG lColor = (LONG)rColour.GetPixel();
::WinSetPresParam( GetHwnd()
,PP_BACKGROUNDCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
return true;
} // end of wxGauge::SetBackgroundColour
示例3: SetForegroundColour
bool wxGauge::SetForegroundColour(
const wxColour& rColour
)
{
if (!wxControl::SetForegroundColour(rColour))
return FALSE;
LONG lColor = (LONG)rColour.GetPixel();
::WinSetPresParam( GetHwnd()
,PP_FOREGROUNDCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
return TRUE;
} // end of wxGauge::SetForegroundColour
示例4: SetForegroundColour
bool wxTextCtrl::SetForegroundColour( const wxColour& rColour )
{
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETTEXTCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
return true;
} // end of wxTextCtrl::SetForegroundColour