本文整理汇总了C++中wxBrush类的典型用法代码示例。如果您正苦于以下问题:C++ wxBrush类的具体用法?C++ wxBrush怎么用?C++ wxBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxBrush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SetBrush
void wxQtDCImpl::SetBrush(const wxBrush& brush)
{
m_brush = brush;
if (brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE)
{
// Use a monochrome mask: use foreground color for the mask
QBrush b(brush.GetHandle());
b.setColor(m_textForegroundColour.GetHandle());
b.setTexture(b.texture().mask());
m_qtPainter->setBrush(b);
}
else if (brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{
//Don't use the mask
QBrush b(brush.GetHandle());
QPixmap p = b.texture();
p.setMask(QBitmap());
b.setTexture(p);
m_qtPainter->setBrush(b);
}
else
{
m_qtPainter->setBrush(brush.GetHandle());
}
ApplyRasterColourOp();
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:30,代码来源:dc.cpp
示例2: SetBrush
void wxGraphicsContext::SetBrush( const wxBrush& brush )
{
if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT )
SetBrush( wxNullGraphicsBrush );
else
SetBrush( CreateBrush( brush ) );
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:7,代码来源:graphcmn.cpp
示例3: setBrush
/*****************************************************
**
** PdfPainter --- setBrush
**
******************************************************/
void PdfPainter::setBrush( const wxBrush &b )
{
// TODO howto scale width und height
if ( b.GetStyle() == wxSTIPPLE )
{
wxImage image;
wxBitmap *bitmap = b.GetStipple();
if ( bitmap && bitmap->IsOk())
{
image = bitmap->ConvertToImage();
double width = image.GetWidth() / 3;
double height = image.GetHeight() / 3;
// setup a hash value for the image
wxString s = createImageHash( &image );
pdf->AddPattern( s, image, width, height );
drawmode = wxPDF_STYLE_FILL;
pdf->SetFillPattern( s );
pdf->SetDrawPattern( s );
}
}
else if ( b.GetStyle() != wxTRANSPARENT && b.GetColour().IsOk() ) setBrushColor( b.GetColour() );
else
{
drawmode = wxPDF_STYLE_DRAW;
}
}
开发者ID:akshaykinhikar,项目名称:maitreya7,代码行数:34,代码来源:PdfPainter.cpp
示例4: MakeColourGrey
wxBrush &GetGreyBrush(wxBrush &brush)
{
static wxBrush b;
wxColour c;
b = brush;
c = MakeColourGrey(brush.GetColour());
b.SetColour(c);
return b;
}
开发者ID:goretkin,项目名称:kwc-ros-pkg,代码行数:9,代码来源:pseudodc.cpp
示例5: Set
void wxGenericBrush::Set( const wxBrush &brush )
{
wxCHECK_RET(Ok() && brush.Ok(), wxT("Invalid generic brush"));
SetColour(brush.GetColour());
M_GBRUSHDATA->m_style = brush.GetStyle();
wxBitmap* stipple = brush.GetStipple();
if (stipple && stipple->Ok())
M_GBRUSHDATA->m_stipple = *stipple;
}
开发者ID:Jarlene,项目名称:mrpt,代码行数:9,代码来源:genergdi.cpp
示例6: SetBackground
void wxQtDCImpl::SetBackground(const wxBrush& brush)
{
m_backgroundBrush = brush;
if (m_qtPainter->isActive())
m_qtPainter->setBackground(brush.GetHandle());
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:7,代码来源:dc.cpp
示例7: IsSameAs
bool wxGenericBrush::IsSameAs(const wxBrush& brush) const
{
wxCHECK_MSG(Ok() && brush.Ok(), 1, wxT("Invalid generic brush"));
wxGenericBrush gB(brush);
gB.GetGenericColour().SetAlpha(M_GBRUSHDATA->m_colour.GetAlpha());
return IsSameAs(gB);
}
开发者ID:Jarlene,项目名称:mrpt,代码行数:7,代码来源:genergdi.cpp
示例8: SetBackground
void wxDC::SetBackground(const wxBrush& brush)
{
wxCHECK_RET( Ok(), wxT("invalid dc") );
if (!brush.Ok()) return;
m_backgroundBrush = brush;
}
开发者ID:hgwells,项目名称:tive,代码行数:8,代码来源:dc.cpp
示例9: SetBackground
void ocpnDC::SetBackground( const wxBrush &brush )
{
if( dc )
dc->SetBackground( brush );
else {
#ifdef ocpnUSE_GL
glcanvas->SetBackgroundColour( brush.GetColour() );
#endif
}
}
开发者ID:libai245,项目名称:wht1,代码行数:10,代码来源:ocpndc.cpp
示例10: switch
void StateEvaluationTreePanel::drawIndicatorAtArea(wxDC &DC,
IndicatorStyle const &Style,
wxCoord X, wxCoord Y,
wxCoord W, wxCoord H)
{
auto const Kind = Style.GetKind();
auto const FG = Style.GetForeground();
wxPen const PrevPen = DC.GetPen();
wxBrush const PrevBrush = DC.GetBrush();
switch (Kind) {
case IndicatorStyle::EKind::Plain:
DC.SetPen(wxPen{FG, Settings.PenWidth});
DC.DrawLine(X, Y+H, X+W, Y+H);
break;
case IndicatorStyle::EKind::Box:
DC.SetPen(wxPen{FG, Settings.PenWidth});
DC.DrawRectangle(X, Y, W, H);
break;
case IndicatorStyle::EKind::StraightBox:
// Many DCs don't support alpha at all, so manually calculate an alpha
// against the background colour.
auto const BG = PrevBrush.GetColour();
double const Alpha = (double)Style.GetAlpha() / 255;
double const OutlineAlpha = (double)Style.GetOutlineAlpha() / 255;
DC.SetPen(wxPen{
wxColour(wxColour::AlphaBlend(FG.Red(), BG.Red(), OutlineAlpha),
wxColour::AlphaBlend(FG.Green(), BG.Green(), OutlineAlpha),
wxColour::AlphaBlend(FG.Blue(), BG.Blue(), OutlineAlpha)),
Settings.PenWidth});
DC.SetBrush(wxBrush{
wxColour(wxColour::AlphaBlend(FG.Red(), BG.Red(), Alpha),
wxColour::AlphaBlend(FG.Green(), BG.Green(), Alpha),
wxColour::AlphaBlend(FG.Blue(), BG.Blue(), Alpha))});
DC.DrawRectangle(X, Y, W, H);
break;
}
DC.SetPen(PrevPen);
DC.SetBrush(PrevBrush);
}
开发者ID:mheinsen,项目名称:seec,代码行数:42,代码来源:StateEvaluationTree.cpp
示例11: DrawPaperBar
//---------------------------------------------------------------------------
void wxPagedWindow::DrawPaperBar( twTabInfo& tab, int x, int y,
wxBrush& brush, wxPen& pen, wxDC& dc )
{
wxPoint poly[4];
// draw organizer-style paper outlet
poly[0].x = x - mTabTrianGap;
poly[0].y = y;
poly[1].x = x + mTabTrianGap;
poly[1].y = y + tab.mDims.y-1;
poly[2].x = x + tab.mDims.x - mTabTrianGap;
poly[2].y = y + tab.mDims.y-1;
poly[3].x = x + tab.mDims.x + mTabTrianGap;
poly[3].y = y;
dc.SetPen( pen );
dc.SetBrush( brush );
dc.DrawPolygon( 4, poly );
long w,h;
// set select default font of the window into it's device context
//dc.SetFont( GetLabelingFont() );
dc.SetTextBackground( brush.GetColour() );
dc.GetTextExtent(tab.mText, &w, &h );
if ( tab.HasImg() )
{
wxMemoryDC tmpDc;
tmpDc.SelectObject( tab.GetImg() );
dc.Blit( x + mTitleHorizGap,
y + ( tab.mDims.y - tab.ImgHeight() ) / 2,
tab.ImgWidth(),
tab.ImgHeight(),
&tmpDc, 0, 0, wxCOPY
);
}
if ( tab.HasText() )
{
int tx = x + mTitleHorizGap +
tab.ImgWidth() + tab.ImageToTxtGap(mImageTextGap);
dc.DrawText( tab.GetText(), tx, y + ( tab.mDims.y - h ) / 2 );
}
} // wxPagedWindow::DrawPaperBar()
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:55,代码来源:tabpgwin.cpp
示例12: Draw
bool SjOscStar::Draw(wxDC& dc, const wxSize& clientSize, double rot, wxPen& pen, wxBrush& brush)
{
double xfloat, yfloat;
int x, y, hh, vv;
int d, intensity;
m_z -= 2;
if( m_z < -63 )
{
m_z = STAR_DEPTH;
m_doDraw = !m_exitRequest;
}
hh = (m_x*64)/(64+m_z);
vv = (m_y*64)/(64+m_z);
// check position
x = hh + 500;
y = vv + 500;
if( x < -300 || x > 1300 || y < -300 || y > 1300 )
{
m_z = STAR_DEPTH;
m_doDraw = !m_exitRequest;
hh = (m_x*64)/(64+m_z);
vv = (m_y*64)/(64+m_z);
}
// calculate position
xfloat = (hh*cos(rot))-(vv*sin(rot));
yfloat = (hh*sin(rot))+(vv*cos(rot));
x = (int)xfloat + 500;
y = (int)yfloat + 500;
// use star?
if( !m_doDraw )
{
if( m_exitRequest || x < 450 || x > 550 || y < 450 || y > 550 )
{
return FALSE;
}
else
{
m_doDraw = TRUE;
}
}
// map star position to client size, keep aspect ratio
d = clientSize.x;
if( clientSize.y > d )
{
d = clientSize.y;
}
if( d == 0 )
{
d = 10;
}
x = (x * d) / 1000 - (d-clientSize.x)/2;
y = (y * d) / 1000 - (d-clientSize.y)/2;
// calculate size
d = (STAR_DEPTH-m_z) / (38400/d);
if( d == 0 ) d = 1;
// calculate light intensity
intensity = STAR_DEPTH-m_z;
intensity = 55 + ((intensity * 200) / STAR_DEPTH);
//if( intensity < light ) intensity = light + 10;
if( intensity < 0 ) intensity = 0;
if( intensity > 255 ) intensity = 255;
// draw star
if( d==1 )
{
pen.SetColour(intensity, intensity, intensity);
dc.SetPen(pen);
dc.DrawPoint(x, y);
}
else
{
dc.SetPen(*wxTRANSPARENT_PEN);
brush.SetColour(intensity, intensity, intensity);
dc.SetBrush(brush);
dc.DrawRectangle(x, y, d, d);
}
return TRUE;
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:93,代码来源:vis_oscilloscope.cpp
示例13: SetBrushColour
void ThemeBase::SetBrushColour( wxBrush & Brush, int iIndex )
{
wxASSERT( iIndex >= 0 );
Brush.SetColour( Colour( iIndex ));
}
开发者ID:andreipaga,项目名称:audacity,代码行数:5,代码来源:Theme.cpp
示例14: SetBackground
void ocpnDC::SetBackground( const wxBrush &brush )
{
if( dc ) dc->SetBackground( brush );
else
glcanvas->SetBackgroundColour( brush.GetColour() );
}
开发者ID:JesperWe,项目名称:OpenCPN,代码行数:6,代码来源:ocpndc.cpp
示例15: ToString
wxString xsBrushPropIO::ToString(wxBrush value)
{
return wxString::Format(wxT("%s %d"), xsColourPropIO::ToString(value.GetColour()).c_str(), value.GetStyle());
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:4,代码来源:PropertyIO.cpp
示例16: SetColor
static void SetColor(unsigned char color[4], const wxBrush &brush)
{
const wxColour &c = brush.GetColour();
color[0] = c.Red(), color[1] = c.Green(), color[2] = c.Blue(), color[3] = 255;
}
开发者ID:,项目名称:,代码行数:5,代码来源:
示例17: SetBrush
virtual void SetBrush(const wxBrush& brush) override {
wxBrush newbrush = brush;
newbrush.SetColour(PivotColour(brush.GetColour()));
wxMirrorDC::SetBrush(newbrush);
}
开发者ID:,项目名称:,代码行数:5,代码来源:
示例18: wxImageFloodFill
static void LINKAGEMODE
wxImageFloodFill(wxImage *image,
wxCoord x, wxCoord y, const wxBrush & fillBrush,
const wxColour& testColour, int style)
{
/* A diamond flood-fill using a circular queue system.
Each pixel surrounding the current pixel is added to
the queue if it meets the criteria, then is retrieved in
its turn. Code originally based on http://www.drawit.co.nz/Developers.htm,
with explicit permission to use this for wxWidgets granted by Andrew Empson
(no copyright claimed)
*/
int width = image->GetWidth();
int height = image->GetHeight();
//Draw using a pen made from the current brush colour
//Potentially allows us to use patterned flood fills in future code
wxColour fillColour = fillBrush.GetColour();
unsigned char r = fillColour.Red();
unsigned char g = fillColour.Green();
unsigned char b = fillColour.Blue();
//initial test :
if (style == wxFLOOD_SURFACE)
{
//if wxFLOOD_SURFACE, if fill colour is same as required, we don't do anything
if ( image->GetRed(x,y) != r
|| image->GetGreen(x,y) != g
|| image->GetBlue (x,y) != b )
{
//prepare memory for queue
//queue save, start, read
size_t *qs, *qst, *qr;
//queue size (physical)
long qSz= height * width * 2;
qst = new size_t [qSz];
//temporary x and y locations
int xt, yt;
for (int i=0; i < qSz; i++)
qst[i] = 0;
// start queue
qs=qr=qst;
*qs=xt=x;
qs++;
*qs=yt=y;
qs++;
image->SetRGB(xt,yt,r,g,b);
//Main queue loop
while(qr!=qs)
{
//Add new members to queue
//Above current pixel
if(MatchPixel(image,xt,yt-1,width,height,testColour))
{
*qs=xt;
qs++;
*qs=yt-1;
qs++;
image->SetRGB(xt,yt-1,r,g,b);
//Loop back to beginning of queue
if(qs>=(qst+qSz)) qs=qst;
}
//Below current pixel
if(MatchPixel(image,xt,yt+1,width,height,testColour))
{
*qs=xt;
qs++;
*qs=yt+1;
qs++;
image->SetRGB(xt,yt+1,r,g,b);
if(qs>=(qst+qSz)) qs=qst;
}
//Left of current pixel
if(MatchPixel(image,xt-1,yt,width,height,testColour))
{
*qs=xt-1;
qs++;
*qs=yt;
qs++;
image->SetRGB(xt-1,yt,r,g,b);
if(qs>=(qst+qSz)) qs=qst;
}
//Right of current pixel
if(MatchPixel(image,xt+1,yt,width,height,testColour))
{
*qs=xt+1;
qs++;
*qs=yt;
qs++;
//.........这里部分代码省略.........
开发者ID:chromylei,项目名称:third_party,代码行数:101,代码来源:imagfill.cpp
示例19: SetBrush
void wxDC::SetBrush(const wxBrush& brush)
{
m_brush = brush.Ok() ? brush : DEFAULT_BRUSH;
}
开发者ID:hgwells,项目名称:tive,代码行数:4,代码来源:dc.cpp
示例20: OnTimer
void SjOscWindow::OnTimer(wxTimerEvent&)
{
SJ_FORCE_IN_HERE_ONLY_ONCE;
if( m_oscModule )
{
// volume stuff
long volume, maxVolume = 1;
bool volumeBeat;
// other objects
long i;
bool titleChanged, forceOscAnim, forceSpectrAnim;
wxString newTitle;
// get data
g_mainFrame->m_player.GetVisData(m_bufferStart, m_sampleCount*SJ_WW_CH*SJ_WW_BYTERES, 0);
// get window client size, correct offscreen DC if needed
wxSize clientSize = m_oscModule->m_oscWindow->GetClientSize();
if( clientSize.x != m_offscreenBitmap.GetWidth() || clientSize.y != m_offscreenBitmap.GetHeight() )
{
m_offscreenBitmap.Create(clientSize.x, clientSize.y);
m_offscreenDc.SelectObject(m_offscreenBitmap);
}
// calculate the points for the lines, collect volume
m_oscilloscope->Calc(clientSize, m_bufferStart, volume);
if( m_oscModule->m_showFlags&SJ_OSC_SHOW_SPECTRUM )
{
m_spectrum->Calc(clientSize, m_bufferStart);
}
// get data that are shared between the threads
{
titleChanged = m_oscModule->m_titleChanged;
m_oscModule->m_titleChanged = FALSE;
if( titleChanged )
{
newTitle = m_oscModule->m_trackName;
if( newTitle.IsEmpty() )
{
newTitle = SJ_PROGRAM_NAME;
}
else if( !m_oscModule->m_leadArtistName.IsEmpty() )
{
newTitle.Prepend(m_oscModule->m_leadArtistName + wxT(" - "));
}
}
forceOscAnim = m_oscModule->m_forceOscAnim;
m_oscModule->m_forceOscAnim = FALSE;
forceSpectrAnim = m_oscModule->m_forceSpectrAnim;
m_oscModule->m_forceSpectrAnim = FALSE;
}
// calculate volume, volume is theoretically max. 255, normally lesser
if( titleChanged ) { maxVolume = 1; }
if( volume > maxVolume ) { maxVolume = volume; }
volumeBeat = (volume > maxVolume/2);
// erase screen
m_offscreenDc.SetPen(*wxTRANSPARENT_PEN);
{
// blue gradient background
#define BG_STEPS 88
int rowH = (clientSize.y/BG_STEPS)+1;
for( i = 0; i < BG_STEPS; i++ )
{
m_bgBrush.SetColour(0, 0, i);
m_offscreenDc.SetBrush(m_bgBrush);
m_offscreenDc.DrawRectangle(0, i*rowH, clientSize.x, rowH);
}
}
// draw text (very background)
{
m_offscreenDc.SetBackgroundMode(wxTRANSPARENT);
m_offscreenDc.SetTextForeground(m_textColour);
m_title->Draw(m_offscreenDc, clientSize, titleChanged, newTitle);
}
// draw figures (they lay in backgroud)
if( m_oscModule->m_showFlags&SJ_OSC_SHOW_FIGURES )
{
long bgLight = 100;
// draw hands (optional)
m_hands->Draw(m_offscreenDc, clientSize, volume, bgLight, titleChanged);
// draw rotor (optional)
m_rotor->Draw(m_offscreenDc, clientSize, m_starfield->IsRunning(), titleChanged, volume, bgLight);
// draw firework (optional)
m_firework->Draw(m_offscreenDc, clientSize, titleChanged, m_starfield->IsRunning(), volumeBeat, bgLight);
}
// draw starfield (optional)
//.........这里部分代码省略.........
开发者ID:antonivich,项目名称:Silverjuke,代码行数:101,代码来源:vis_oscilloscope.cpp
注:本文中的wxBrush类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论