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


C++ wxColour::GetPixel方法代码示例

本文整理汇总了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;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:55,代码来源:non-kerned-drawing.cpp

示例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
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:14,代码来源:gauge.cpp

示例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
开发者ID:gitrider,项目名称:wxsj2,代码行数:17,代码来源:gauge.cpp

示例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
开发者ID:EdgarTx,项目名称:wx,代码行数:6,代码来源:textctrl.cpp


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