本文整理汇总了C++中ocpnDC::DrawBitmap方法的典型用法代码示例。如果您正苦于以下问题:C++ ocpnDC::DrawBitmap方法的具体用法?C++ ocpnDC::DrawBitmap怎么用?C++ ocpnDC::DrawBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocpnDC
的用法示例。
在下文中一共展示了ocpnDC::DrawBitmap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
void ocpnCompass::Paint( ocpnDC& dc )
{
if(m_shown && m_StatBmp.IsOk()){
# if defined(ocpnUSE_GLES) || defined(ocpnUSE_GL) // GLES does not do ocpnDC::DrawBitmap(), so use texture
if(g_bopengl && texobj){
glBindTexture( GL_TEXTURE_2D, texobj );
glEnable( GL_TEXTURE_2D );
glBegin( GL_QUADS );
glTexCoord2f( 0, 0 ); glVertex2i( m_rect.x, m_rect.y );
glTexCoord2f( 1, 0 ); glVertex2i( m_rect.x + m_rect.width, m_rect.y );
glTexCoord2f( 1, 1 ); glVertex2i( m_rect.x + m_rect.width, m_rect.y + m_rect.height );
glTexCoord2f( 0, 1 ); glVertex2i( m_rect.x, m_rect.y + m_rect.height );
glEnd();
glDisable( GL_TEXTURE_2D );
}
else {
dc.DrawBitmap( m_StatBmp, m_rect.x, m_rect.y, true );
}
#else
dc.DrawBitmap( m_StatBmp, m_rect.x, m_rect.y, true );
#endif
}
}
示例2: Draw
void RolloverWin::Draw(ocpnDC &dc)
{
if(!IsActive())
return;
#ifdef ocpnUSE_GL
if(g_bopengl && m_texture) {
glBindTexture( g_texture_rectangle_format, m_texture );
glEnable(g_texture_rectangle_format);
glEnable(GL_BLEND);
int x0 = m_position.x, x1 = x0 + m_size.x;
int y0 = m_position.y, y1 = y0 + m_size.y;
float tx, ty;
if( GL_TEXTURE_RECTANGLE_ARB == g_texture_rectangle_format )
tx = m_size.x, ty = m_size.y;
else
tx = ty = 1;
glColor3f(1, 1, 1);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2i(x0, y0);
glTexCoord2f(tx, 0); glVertex2i(x1, y0);
glTexCoord2f(tx, ty); glVertex2i(x1, y1);
glTexCoord2f(0, ty); glVertex2i(x0, y1);
glEnd();
glDisable(g_texture_rectangle_format);
glDisable(GL_BLEND);
} else
#endif
dc.DrawBitmap( *m_pbm, m_position.x, m_position.y, false );
}
示例3: Draw
void RoutePoint::Draw( ocpnDC& dc, wxPoint *rpn )
{
wxPoint r;
wxRect hilitebox;
cc1->GetCanvasPointPix( m_lat, m_lon, &r );
// return the home point in this dc to allow "connect the dots"
if( NULL != rpn ) *rpn = r;
if( !m_bIsVisible ) // pjotrc 2010.02.13, 2011.02.24
return;
// Optimization, especially apparent on tracks in normal cases
if( m_IconName == _T("empty") && !m_bShowName && !m_bPtIsSelected ) return;
wxPen *pen;
if( m_bBlink )
pen = g_pRouteMan->GetActiveRoutePointPen();
else
pen = g_pRouteMan->GetRoutePointPen();
// Substitue icon?
wxBitmap *pbm;
if( ( m_bIsActive ) && ( m_IconName != _T("mob") ) )
pbm = pWayPointMan->GetIconBitmap( _T ( "activepoint" ) );
else
pbm = m_pbmIcon;
wxBitmap *pbms = NULL;
if( g_ChartScaleFactorExp > 1.0){
if(m_IconScaleFactor != g_ChartScaleFactorExp){
wxImage scaled_image = pbm->ConvertToImage();
int new_width = pbm->GetWidth() * g_ChartScaleFactorExp;
int new_height = pbm->GetHeight() * g_ChartScaleFactorExp;
m_ScaledBMP = wxBitmap(scaled_image.Scale(new_width, new_height, wxIMAGE_QUALITY_HIGH));
m_IconScaleFactor = g_ChartScaleFactorExp;
}
if( m_ScaledBMP.IsOk() )
pbm = &m_ScaledBMP;
}
int sx2 = pbm->GetWidth() / 2;
int sy2 = pbm->GetHeight() / 2;
// Calculate the mark drawing extents
wxRect r1( r.x - sx2, r.y - sy2, sx2 * 2, sy2 * 2 ); // the bitmap extents
if( m_bShowName ) {
if( 0 == m_pMarkFont ) {
m_pMarkFont = FontMgr::Get().GetFont( _( "Marks" ) );
m_FontColor = FontMgr::Get().GetFontColor( _( "Marks" ) );
CalculateNameExtents();
}
if( m_pMarkFont ) {
wxRect r2( r.x + m_NameLocationOffsetX, r.y + m_NameLocationOffsetY, m_NameExtents.x,
m_NameExtents.y );
r1.Union( r2 );
}
}
hilitebox = r1;
hilitebox.x -= r.x;
hilitebox.y -= r.y;
float radius;
if( g_btouch ){
hilitebox.Inflate( 20 );
radius = 20.0f;
}
else{
hilitebox.Inflate( 4 );
radius = 4.0f;
}
wxColour hi_colour = pen->GetColour();
unsigned char transparency = 100;
if( m_bIsBeingEdited ){
hi_colour = GetGlobalColor( _T ( "YELO1" ) );
transparency = 150;
}
// Highlite any selected point
if( m_bPtIsSelected || m_bIsBeingEdited) {
AlphaBlending( dc, r.x + hilitebox.x, r.y + hilitebox.y, hilitebox.width, hilitebox.height, radius,
hi_colour, transparency );
}
bool bDrawHL = false;
if( m_bBlink && ( gFrame->nBlinkerTick & 1 ) ) bDrawHL = true;
if( ( !bDrawHL ) && ( NULL != m_pbmIcon ) ) {
dc.DrawBitmap( *pbm, r.x - sx2, r.y - sy2, true );
// on MSW, the dc Bounding box is not updated on DrawBitmap() method.
// Do it explicitely here for all platforms.
dc.CalcBoundingBox( r.x - sx2, r.y - sy2 );
dc.CalcBoundingBox( r.x + sx2, r.y + sy2 );
//.........这里部分代码省略.........
示例4: Draw
void RoutePoint::Draw( ocpnDC& dc, wxPoint *rpn )
{
wxPoint r;
wxRect hilitebox;
unsigned char transparency = 100;
cc1->GetCanvasPointPix( m_lat, m_lon, &r );
// return the home point in this dc to allow "connect the dots"
if( NULL != rpn ) *rpn = r;
if( !m_bIsVisible /*&& !m_bIsInTrack*/) // pjotrc 2010.02.13, 2011.02.24
return;
// Optimization, especially apparent on tracks in normal cases
if( m_IconName == _T("empty") && !m_bShowName && !m_bPtIsSelected ) return;
wxPen *pen;
if( m_bBlink ) pen = g_pRouteMan->GetActiveRoutePointPen();
else
pen = g_pRouteMan->GetRoutePointPen();
// Substitue icon?
wxBitmap *pbm;
if( ( m_bIsActive ) && ( m_IconName != _T("mob") ) ) pbm = pWayPointMan->GetIconBitmap(
_T ( "activepoint" ) );
else
pbm = m_pbmIcon;
int sx2 = pbm->GetWidth() / 2;
int sy2 = pbm->GetHeight() / 2;
// Calculate the mark drawing extents
wxRect r1( r.x - sx2, r.y - sy2, sx2 * 2, sy2 * 2 ); // the bitmap extents
if( m_bShowName ) {
if( 0 == m_pMarkFont ) {
m_pMarkFont = pFontMgr->GetFont( _( "Marks" ) );
m_FontColor = pFontMgr->GetFontColor( _("Marks") );
CalculateNameExtents();
}
if( m_pMarkFont ) {
wxRect r2( r.x + m_NameLocationOffsetX, r.y + m_NameLocationOffsetY, m_NameExtents.x,
m_NameExtents.y );
r1.Union( r2 );
}
}
hilitebox = r1;
hilitebox.x -= r.x;
hilitebox.y -= r.y;
hilitebox.Inflate( 2 );
// Highlite any selected point
if( m_bPtIsSelected ) {
AlphaBlending( dc, r.x + hilitebox.x, r.y + hilitebox.y, hilitebox.width, hilitebox.height, 0.0,
pen->GetColour(), transparency );
}
bool bDrawHL = false;
if( m_bBlink && ( gFrame->nBlinkerTick & 1 ) ) bDrawHL = true;
if( ( !bDrawHL ) && ( NULL != m_pbmIcon ) ) {
dc.DrawBitmap( *pbm, r.x - sx2, r.y - sy2, true );
// on MSW, the dc Bounding box is not updated on DrawBitmap() method.
// Do it explicitely here for all platforms.
dc.CalcBoundingBox( r.x - sx2, r.y - sy2 );
dc.CalcBoundingBox( r.x + sx2, r.y + sy2 );
}
if( m_bShowName ) {
if( m_pMarkFont ) {
dc.SetFont( *m_pMarkFont );
dc.SetTextForeground( m_FontColor );
dc.DrawText( m_MarkName, r.x + m_NameLocationOffsetX, r.y + m_NameLocationOffsetY );
}
}
// Save the current draw rectangle in the current DC
// This will be useful for fast icon redraws
CurrentRect_in_DC.x = r.x + hilitebox.x;
CurrentRect_in_DC.y = r.y + hilitebox.y;
CurrentRect_in_DC.width = hilitebox.width;
CurrentRect_in_DC.height = hilitebox.height;
if( m_bBlink ) g_blink_rect = CurrentRect_in_DC; // also save for global blinker
}
示例5: Paint
void Piano::Paint( int y, ocpnDC& dc, wxDC *shapeDC )
{
if(shapeDC) {
shapeDC->SetBackground( *wxBLACK_BRUSH);
shapeDC->SetBrush( *wxWHITE_BRUSH);
shapeDC->SetPen( *wxWHITE_PEN);
shapeDC->Clear();
}
ocpnStyle::Style* style = g_StyleManager->GetCurrentStyle();
if(!style->chartStatusWindowTransparent) {
dc.SetPen( *wxTRANSPARENT_PEN );
dc.SetBrush( m_backBrush );
dc.DrawRectangle( 0, y, cc1->GetClientSize().x, GetHeight() );
}
// Create the Piano Keys
int nKeys = m_key_array.GetCount();
wxPen ppPen( GetGlobalColor( _T("CHBLK") ), 1, wxPENSTYLE_SOLID );
dc.SetPen( ppPen );
for( int i = 0; i < nKeys; i++ ) {
int key_db_index = m_key_array.Item( i );
if( -1 == key_db_index ) continue;
bool selected = InArray(m_active_index_array, key_db_index);
if( ChartData->GetDBChartType( key_db_index ) == CHART_TYPE_CM93 ||
ChartData->GetDBChartType( key_db_index ) == CHART_TYPE_CM93COMP ) {
if(selected)
dc.SetBrush( m_scBrush );
else
dc.SetBrush( m_cBrush );
} else if( ChartData->GetDBChartFamily( key_db_index ) == CHART_FAMILY_VECTOR ) {
if(selected)
dc.SetBrush( m_svBrush );
else
dc.SetBrush( m_vBrush );
} else { // Raster Chart
if(selected)
dc.SetBrush( m_slBrush );
else
dc.SetBrush( m_tBrush );
}
#if 0
// Check to see if this box appears in the sub_light array
// If so, add a crosshatch pattern to the brush
if(InArray(m_eclipsed_index_array, key_db_index)) {
wxBrush ebrush( dc.GetBrush().GetColour(), wxCROSSDIAG_HATCH );
dc.SetBrush(ebrush);
}
#endif
if(m_bBusy)
dc.SetBrush( m_uvBrush );
wxRect box = KeyRect.Item( i );
box.y += y;
if( m_brounded ) {
dc.DrawRoundedRectangle( box.x, box.y, box.width, box.height, 4 );
if(shapeDC)
shapeDC->DrawRoundedRectangle( box.x, box.y, box.width, box.height, 4 );
} else {
dc.DrawRectangle( box.x, box.y, box.width, box.height );
if(shapeDC)
shapeDC->DrawRectangle( box );
}
if(InArray(m_eclipsed_index_array, key_db_index)) {
dc.SetBrush( m_backBrush );
int w = 3;
dc.DrawRoundedRectangle( box.x + w, box.y + w, box.width - ( 2 * w ),
box.height - ( 2 * w ), 3 );
}
// Look in the current noshow array for this index
if(InArray(m_noshow_index_array, key_db_index) &&
m_pInVizIconBmp && m_pInVizIconBmp->IsOk() )
dc.DrawBitmap(ConvertTo24Bit( dc.GetBrush().GetColour(), *m_pInVizIconBmp ),
box.x + 4, box.y + 3, false );
// Look in the current skew array for this index
if(InArray(m_skew_index_array, key_db_index) &&
m_pSkewIconBmp && m_pSkewIconBmp->IsOk())
dc.DrawBitmap(ConvertTo24Bit( dc.GetBrush().GetColour(), *m_pSkewIconBmp ),
box.x + box.width - m_pSkewIconBmp->GetWidth() - 4, box.y + 2, false );
// Look in the current tmerc array for this index
if(InArray(m_tmerc_index_array, key_db_index) &&
m_pTmercIconBmp && m_pTmercIconBmp->IsOk() )
dc.DrawBitmap(ConvertTo24Bit( dc.GetBrush().GetColour(), *m_pTmercIconBmp ),
box.x + box.width - m_pTmercIconBmp->GetWidth() - 4, box.y + 2, false );
// Look in the current poly array for this index
if(InArray(m_poly_index_array, key_db_index) &&
//.........这里部分代码省略.........