本文整理汇总了C++中CalcBoundingBox函数的典型用法代码示例。如果您正苦于以下问题:C++ CalcBoundingBox函数的具体用法?C++ CalcBoundingBox怎么用?C++ CalcBoundingBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CalcBoundingBox函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxBrush
void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter)
{
//Radius
wxInt32 cx = rect.GetWidth() / 2;
wxInt32 cy = rect.GetHeight() / 2;
wxInt32 nRadius;
if (cx < cy)
nRadius = cx;
else
nRadius = cy;
// make sure the background is filled (todo move into specific platform implementation ?)
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
m_graphicContext->SetBrush( wxBrush( destColour) );
m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height);
m_graphicContext->SetBrush( m_graphicContext->CreateRadialGradientBrush(
rect.x+circleCenter.x,rect.y+circleCenter.y,
rect.x+circleCenter.x,rect.y+circleCenter.y,
nRadius,initialColour,destColour));
m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height);
m_graphicContext->SetPen(m_pen);
m_graphicContext->SetBrush(m_brush);
CalcBoundingBox(rect.x, rect.y);
CalcBoundingBox(rect.x + rect.width, rect.y + rect.height);
}
开发者ID:animecomico,项目名称:wxWidgets,代码行数:31,代码来源:dcgraph.cpp
示例2: DoGetTextExtent
void wxSVGFileDC::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle)
{
//known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW
if (m_graphics_changed) NewGraphics ();
wxString s, sTmp;
// calculate bounding box
wxCoord w, h, desc ;
DoGetTextExtent(sText, &w, &h, &desc);
double rad = DegToRad(angle);
// wxT("upper left") and wxT("upper right")
CalcBoundingBox(x, y);
CalcBoundingBox((wxCoord)(x + w*cos(rad)), (wxCoord)(y - h*sin(rad)));
// wxT("bottom left") and wxT("bottom right")
x += (wxCoord)(h*sin(rad));
y += (wxCoord)(h*cos(rad));
CalcBoundingBox(x, y);
CalcBoundingBox((wxCoord)(x + h*sin(rad)), (wxCoord)(y + h*cos(rad)));
if (m_backgroundMode == wxSOLID)
{
// draw background first
// just like DoDrawRectangle except we pass the text color to it and set the border to a 1 pixel wide text background
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::Draw Rotated Text Call plotting text background")) ;
sTmp.Printf ( wxT(" <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" "), x,y+desc-h, w, h );
s = sTmp + wxT("style=\"fill:#") + wxColStr (m_textBackgroundColour) + wxT("; ") ;
s = s + wxT("stroke-width:1; stroke:#") + wxColStr (m_textBackgroundColour) + wxT("; ") ;
sTmp.Printf ( wxT("\" transform=\"rotate( %.2g %d %d ) \">"), -angle, x,y ) ;
s = s + sTmp + newline ;
write(s);
}
//now do the text itself
s.Printf (wxT(" <text x=\"%d\" y=\"%d\" "),x,y );
sTmp = m_font.GetFaceName () ;
if (sTmp.Len () > 0) s = s + wxT("style=\"font-family:") + sTmp + wxT("; ");
else s = s + wxT("style=\" ") ;
wxString fontweights [3] = { wxT("normal"), wxT("lighter"), wxT("bold") };
s = s + wxT("font-weight:") + fontweights[m_font.GetWeight() - wxNORMAL] + semicolon + space;
wxString fontstyles [5] = { wxT("normal"), wxT("style error"), wxT("style error"), wxT("italic"), wxT("oblique") };
s = s + wxT("font-style:") + fontstyles[m_font.GetStyle() - wxNORMAL] + semicolon + space;
sTmp.Printf (wxT("font-size:%dpt; fill:#"), m_font.GetPointSize () );
s = s + sTmp ;
s = s + wxColStr (m_textForegroundColour) + wxT("; stroke:#") + wxColStr (m_textForegroundColour) + wxT("; ") ;
sTmp.Printf ( wxT("stroke-width:0;\" transform=\"rotate( %.2g %d %d ) \" >"), -angle, x,y ) ;
s = s + sTmp + sText + wxT("</text> ") + newline ;
if (m_OK)
{
write(s);
}
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawRotatedText Call executed")) ;
}
开发者ID:Seashell2011,项目名称:Wickbert,代码行数:60,代码来源:dcsvg.cpp
示例3: wxCHECK_RET
void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask )
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
wxCHECK_RET( bmp.IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
int w = bmp.GetScaledWidth();
int h = bmp.GetScaledHeight();
if ( bmp.GetDepth() == 1 )
{
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
m_graphicContext->SetBrush(m_textBackgroundColour);
m_graphicContext->DrawRectangle( x, y, w, h );
m_graphicContext->SetBrush(m_textForegroundColour);
m_graphicContext->DrawBitmap( bmp, x, y, w, h );
m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush));
m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen));
}
else // not a monochrome bitmap, handle it normally
{
// make a copy in case we need to remove its mask, if we don't modify
// it the copy is cheap as bitmaps are reference-counted
wxBitmap bmpCopy(bmp);
if ( !useMask && bmp.GetMask() )
bmpCopy.SetMask(NULL);
m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h );
}
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
}
开发者ID:animecomico,项目名称:wxWidgets,代码行数:32,代码来源:dcgraph.cpp
示例4: wxCHECK_RET
void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
{
wxCHECK_RET( Ok(), wxT("invalid dc") );
wxCoord xx = XLOG2DEV(x);
wxCoord yy = YLOG2DEV(y);
// update the bounding box
wxCoord w, h;
CalcBoundingBox(x, y);
GetTextExtent(text, &w, &h);
CalcBoundingBox(x + w, y + h);
// if background mode is solid, DrawText must paint text's background:
if ( m_backgroundMode == wxSOLID )
{
wxCHECK_RET( m_textBackgroundColour.Ok(),
wxT("invalid background color") );
SelectColour(m_textBackgroundColour);
m_surface->FillRectangle(xx, yy, XLOG2DEVREL(w), YLOG2DEVREL(h));
}
// finally draw the text itself:
wxCHECK_RET( m_textForegroundColour.Ok(),
wxT("invalid foreground color") );
SelectColour(m_textForegroundColour);
m_surface->DrawString(wxSTR_TO_DFB(text), -1, xx, yy, DSTF_LEFT | DSTF_TOP);
// restore pen's colour, because other drawing functions expect the colour
// to be set to the pen:
SelectColour(m_pen.GetColour());
}
开发者ID:hgwells,项目名称:tive,代码行数:33,代码来源:dc.cpp
示例5: wxCHECK_RET
void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord w, wxCoord h,
double radius)
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
if (radius < 0.0)
radius = - radius * ((w < h) ? w : h);
// CMB: draw nothing if transformed w or h is 0
if (w == 0 || h == 0)
return;
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
if ( m_graphicContext->ShouldOffset() )
{
// if we are offsetting the entire rectangle is moved 0.5, so the
// border line gets off by 1
w -= 1;
h -= 1;
}
m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:28,代码来源:dcgraph.cpp
示例6: wxASSERT
void wxGCDCImpl::DoDrawPolyPolygon(int n,
const int count[],
const wxPoint points[],
wxCoord xoffset,
wxCoord yoffset,
wxPolygonFillMode fillStyle)
{
wxASSERT(n > 1);
wxGraphicsPath path = m_graphicContext->CreatePath();
int i = 0;
for ( int j = 0; j < n; ++j)
{
wxPoint start = points[i];
path.MoveToPoint( start.x+ xoffset, start.y+ yoffset);
++i;
int l = count[j];
for ( int k = 1; k < l; ++k)
{
path.AddLineToPoint( points[i].x+ xoffset, points[i].y+ yoffset);
++i;
}
// close the polygon
if ( start != points[i-1])
path.AddLineToPoint( start.x+ xoffset, start.y+ yoffset);
}
m_graphicContext->DrawPath( path , fillStyle);
wxRect2DDouble box = path.GetBox();
CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y));
CalcBoundingBox(wxRound(box.m_x + box.m_width),
wxRound(box.m_y + box.m_height));
}
开发者ID:animecomico,项目名称:wxWidgets,代码行数:33,代码来源:dcgraph.cpp
示例7: GetOwner
void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
{
// For compatibility with other ports (notably wxGTK) and because it's
// genuinely useful, we allow passing multiline strings to DrawText().
// However there is no native OSX function to draw them directly so we
// instead reuse the generic DrawLabel() method to render them. Of course,
// DrawLabel() itself will call back to us but with single line strings
// only so there won't be any infinite recursion here.
if ( str.find('\n') != wxString::npos )
{
GetOwner()->DrawLabel(str, wxRect(x, y, 0, 0));
return;
}
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") );
if ( str.empty() )
return;
if ( !m_logicalFunctionSupported )
return;
if ( m_backgroundMode == wxTRANSPARENT )
m_graphicContext->DrawText( str, x ,y);
else
m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush(m_textBackgroundColour) );
wxCoord w, h;
GetOwner()->GetTextExtent(str, &w, &h);
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
}
开发者ID:animecomico,项目名称:wxWidgets,代码行数:32,代码来源:dcgraph.cpp
示例8: NewGraphicsIfNeeded
void wxSVGFileDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
NewGraphicsIfNeeded();
wxString s;
s = wxString::Format(wxS(" <path %sd=\"M%d %d L%d %d\"/>\n"), wxGetPenPattern(m_pen), x1, y1, x2, y2);
write(s);
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:12,代码来源:dcsvg.cpp
示例9: NewGraphicsIfNeeded
void wxSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
NewGraphicsIfNeeded();
wxString s;
s.Printf ( wxT("<path d=\"M%d %d L%d %d\" /> \n"), x1,y1,x2,y2 );
if (m_OK)
{
write(s);
}
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
开发者ID:Jasonudoo,项目名称:wxWidgets,代码行数:12,代码来源:dcsvg.cpp
示例10: wxT
void wxSVGFileDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
if (m_graphics_changed) NewGraphics ();
wxString s ;
s.Printf ( wxT("<path d=\"M%d %d L%d %d\" /> \n"), x1,y1,x2,y2 );
if (m_OK)
{
write(s);
}
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawLine Call executed")) ;
CalcBoundingBox(x1, y1) ;
CalcBoundingBox(x2, y2) ;
return;
};
开发者ID:Seashell2011,项目名称:Wickbert,代码行数:14,代码来源:dcsvg.cpp
示例11: Randomize
cCaveTunnel::cCaveTunnel(
int a_BlockStartX, int a_BlockStartY, int a_BlockStartZ, int a_StartRadius,
int a_BlockEndX, int a_BlockEndY, int a_BlockEndZ, int a_EndRadius,
cNoise & a_Noise
)
{
m_Points.push_back(cCaveDefPoint(a_BlockStartX, a_BlockStartY, a_BlockStartZ, a_StartRadius));
m_Points.push_back(cCaveDefPoint(a_BlockEndX, a_BlockEndY, a_BlockEndZ, a_EndRadius));
if ((a_BlockStartY <= 0) && (a_BlockEndY <= 0))
{
// Don't bother detailing this cave, it's under the world anyway
m_MinBlockX = m_MaxBlockX = 0;
m_MinBlockY = m_MaxBlockY = -1;
m_MinBlockZ = m_MaxBlockZ = 0;
return;
}
Randomize(a_Noise);
Smooth();
// We know that the linear finishing won't affect the bounding box, so let's calculate it now, as we have less data:
CalcBoundingBox();
FinishLinear();
}
开发者ID:ThuGie,项目名称:MCServer,代码行数:26,代码来源:Caves.cpp
示例12: switch
void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection )
{
wxPoint start;
wxPoint end;
switch( nDirection)
{
case wxWEST :
start = rect.GetRightBottom();
start.x++;
end = rect.GetLeftBottom();
break;
case wxEAST :
start = rect.GetLeftBottom();
end = rect.GetRightBottom();
end.x++;
break;
case wxNORTH :
start = rect.GetLeftBottom();
start.y++;
end = rect.GetLeftTop();
break;
case wxSOUTH :
start = rect.GetLeftTop();
end = rect.GetLeftBottom();
end.y++;
break;
default :
break;
}
if (rect.width == 0 || rect.height == 0)
return;
m_graphicContext->SetBrush( m_graphicContext->CreateLinearGradientBrush(
start.x,start.y,end.x,end.y, initialColour, destColour));
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height);
m_graphicContext->SetPen(m_pen);
m_graphicContext->SetBrush(m_brush);
CalcBoundingBox(rect.x, rect.y);
CalcBoundingBox(rect.x + rect.width, rect.y + rect.height);
}
开发者ID:animecomico,项目名称:wxWidgets,代码行数:46,代码来源:dcgraph.cpp
示例13: wxLogDebug
bool wxDFBDCImpl::DoBlitFromSurface(const wxIDirectFBSurfacePtr& src,
wxCoord srcx, wxCoord srcy,
wxCoord w, wxCoord h,
wxCoord dstx, wxCoord dsty)
{
// don't do anything if the source rectangle is outside of source surface,
// DirectFB would assert in that case:
wxSize srcsize;
src->GetSize(&srcsize.x, &srcsize.y);
if ( !wxRect(srcx, srcy, w, h).Intersects(wxRect(srcsize)) )
{
wxLogDebug("Blitting from area outside of the source surface, caller code needs fixing.");
return false;
}
CalcBoundingBox(dstx, dsty);
CalcBoundingBox(dstx + w, dsty + h);
DFBRectangle srcRect = { srcx, srcy, w, h };
DFBRectangle dstRect = { XLOG2DEV(dstx), YLOG2DEV(dsty),
XLOG2DEVREL(w), YLOG2DEVREL(h) };
wxIDirectFBSurfacePtr dst(m_surface);
// FIXME: this will have to be different in useMask case, see above
DFBSurfaceBlittingFlags blitFlag = (src->GetPixelFormat() == DSPF_ARGB)
? DSBLIT_BLEND_ALPHACHANNEL
: DSBLIT_NOFX;
if ( !dst->SetBlittingFlags(blitFlag) )
return false;
if ( srcRect.w != dstRect.w || srcRect.h != dstRect.h )
{
// the bitmap is drawn stretched:
dst->StretchBlit(src, &srcRect, &dstRect);
}
else
{
// no stretching, size is preserved:
dst->Blit(src, &srcRect, dstRect.x, dstRect.y);
}
return true;
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:44,代码来源:dc.cpp
示例14: ComputeBoundingBox
void ComputeBoundingBox(UStaticMesh* StaticMesh, FVector& Center, FVector& Extents)
{
// Calculate bounding Box.
FRawMesh RawMesh;
FStaticMeshSourceModel& SrcModel = StaticMesh->SourceModels[0];
SrcModel.RawMeshBulkData->LoadRawMesh(RawMesh);
FVector unitVec = FVector(1.f);
CalcBoundingBox(RawMesh, Center, Extents, unitVec);
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:10,代码来源:GeomFitUtils.cpp
注:本文中的CalcBoundingBox函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论