本文整理汇总了C++中GetBox函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBox函数的具体用法?C++ GetBox怎么用?C++ GetBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetBox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParentNode
// Updates the position of the document based on the style properties.
void ElementDocument::UpdatePosition()
{
// We are only positioned relative to our parent, so if we're not parented we may as well bail now.
if (GetParentNode() == NULL)
return;
Vector2f position;
// Work out our containing block; relative offsets are calculated against it.
Vector2f containing_block = GetParentNode()->GetBox().GetSize(Box::CONTENT);
const Property *left = GetLocalProperty(LEFT);
const Property *right = GetLocalProperty(RIGHT);
if (left != NULL && left->unit != Property::KEYWORD)
position.x = ResolveProperty(LEFT, containing_block.x);
else if (right != NULL && right->unit != Property::KEYWORD)
position.x = (containing_block.x - GetBox().GetSize(Box::MARGIN).x) - ResolveProperty(RIGHT, containing_block.x);
else
position.x = GetBox().GetEdge(Box::MARGIN, Box::LEFT);
const Property *top = GetLocalProperty(TOP);
const Property *bottom = GetLocalProperty(BOTTOM);
if (top != NULL && top->unit != Property::KEYWORD)
position.y = ResolveProperty(TOP, containing_block.y);
else if (bottom != NULL && bottom->unit != Property::KEYWORD)
position.y = (containing_block.y - GetBox().GetSize(Box::MARGIN).y) - ResolveProperty(BOTTOM, containing_block.y);
else
position.y = GetBox().GetEdge(Box::MARGIN, Box::TOP);
SetOffset(position, NULL);
}
示例2: GetBox
void EParticlesObject::OnFrame()
{
inherited::OnFrame();
Fbox bb; GetBox(bb);
if (::Render->occ_visible(bb))
if (m_Particles) m_Particles->OnFrame(Device.dwTimeDelta);
}
示例3: Get_Object
void Get_Object(unsigned int X, unsigned int Y) {
cimage_order = -1;
box_order = -1;
// CImages
for ( _object_count = 0 ; _object_count < CurrentScreen->CImagesCount ; _object_count++ ) {
local_cimage = GetCImage(_object_count);
if (local_cimage->Active == 1) {
if (IsInsideObject(X, Y, local_cimage->Left, local_cimage->Top,
local_cimage->Width, local_cimage->Height) == 1) {
cimage_order = local_cimage->Order;
exec_cimage = local_cimage;
}
}
}
// Boxes
for ( _object_count = 0 ; _object_count < CurrentScreen->BoxesCount ; _object_count++ ) {
local_box = GetBox(_object_count);
if (local_box->Active == 1) {
if (IsInsideObject(X, Y, local_box->Left, local_box->Top,
local_box->Width, local_box->Height) == 1) {
box_order = local_box->Order;
exec_box = local_box;
}
}
}
_object_count = -1;
if (cimage_order > _object_count )
_object_count = cimage_order;
if (box_order > _object_count )
_object_count = box_order;
}
示例4: strlen
void PictSelection::WriteComments (ostream& to) {
to << "%!PS-Adobe-2.0 EPSF-1.2\n";
to << "%%DocumentFonts:";
int linelen = strlen("%%DocumentFonts:");
const int MAXLINELEN = 256;
IFontList* fontlist = new IFontList;
CollectFonts(fontlist);
for (fontlist->First(); !fontlist->AtEnd(); fontlist->Next()) {
IFont* font = fontlist->GetCur()->GetFont();
if (linelen + strlen(font->GetPrintFont()) + 2 <= MAXLINELEN) {
to << " ";
++linelen;
} else {
to << "\n%%+ ";
linelen = strlen("%%+ ");
}
to << font->GetPrintFont();
linelen += strlen(font->GetPrintFont());
}
to << "\n";
delete fontlist;
to << "%%Pages: 1\n";
Coord l, b, r, t;
GetBox(l, b, r, t);
to << "%%BoundingBox: " << l << " " << b << " " << r << " " << t << "\n";
to << "%%EndComments\n\n";
to << "50 dict begin\n\n";
}
示例5: Serialize
void CBoxHolder::Serialize(CArchive &ar)
{
CBox* box=NULL;
int n;
CString st;
CObject::Serialize(ar);
if (ar.IsStoring()){
n=m_Children.GetSize();
ar << n;
for (int i=0; i<n; i++){
box=GetBox(i);
st=box->Signature();
if (st=="")
st=box->ClassName();
TRACE("Serialize Class Name: %s\n", st);
ar << st;
box->Serialize(ar);
}
}
else{
ar >> n;
for (int i=0; i<n; i++){
ar >> st;
box=CFactory::instance(st);
if (box==NULL)
AfxThrowArchiveException(CArchiveException::generic,"");
box->Serialize(ar);
AddBox(box);
}
}
}
示例6: GetBox
void EditBoxCollection::track_cancel()
{
for(int i = 0; i < Count(); i++)
{
GetBox(i)->track_cancel();
}
}
示例7: GetBox
void * DropDown::GetItemData(INT32 ItemIndex)
{
wxOwnerDrawnComboBox * pGadget = GetBox();
if (!pGadget)
return NULL;
return m_pPopup->GetItemClientData(ItemIndex);
}
示例8: CBaseLuaWidget
CLuaImage::CLuaImage(const char *file) : CBaseLuaWidget(""), m_bHasImage(false)
{
m_pPixBuf = gdk_pixbuf_new_from_file(file, NULL);
if (m_pPixBuf)
{
int w = gdk_pixbuf_get_width(m_pPixBuf);
int h = gdk_pixbuf_get_height(m_pPixBuf);
int neww, newh;
if ((w > MaxImageW()) || (h > MaxImageH()))
{
GetScaledImageSize(w, h, MaxImageW(), MaxImageH(), neww, newh);
GdkPixbuf *tmp = gdk_pixbuf_scale_simple(m_pPixBuf, neww, newh, GDK_INTERP_BILINEAR);
g_object_unref(m_pPixBuf);
m_pPixBuf = tmp;
}
if (m_pPixBuf)
{
GtkWidget *img = gtk_image_new_from_pixbuf(m_pPixBuf);
g_object_unref(m_pPixBuf);
gtk_widget_show(img);
gtk_container_add(GTK_CONTAINER(GetBox()), img);
m_bHasImage = true;
}
}
}
示例9: GetBox
boolean FillPolygonObj::Intersects (BoxObj& ub) {
BoxObj b;
GetBox(b);
if (!b.Intersects(ub)) {
return false;
}
if (b.Within(ub)) {
return true;
}
LineObj bottom(ub._left, ub._bottom, ub._right, ub._bottom);
if (Intersects(bottom)) {
return true;
}
LineObj right(ub._right, ub._bottom, ub._right, ub._top);
if (Intersects(right)) {
return true;
}
LineObj top(ub._right, ub._top, ub._left, ub._top);
if (Intersects(top)) {
return true;
}
LineObj left(ub._left, ub._top, ub._left, ub._bottom);
return Intersects(left);
}
示例10: box
// This function adds an object to an existing bounding volume hierarchy.
// It first constructs a bounding box for the new object, then finds the
// optimal place to insert it into the hierachy using branch-and-bound, and
// finally inserts it at the determined location, updating all the costs
// associated with the nodes in the hierarchy as a side-effect.
void abvh::Insert( const Object *obj, double relative_cost )
{
AABB box( GetBox( *obj ) );
double bound = 0.0;
node *n = new node;
n->bbox = box;
n->object = obj;
n->SA = SurfaceArea( box );
n->EC = 1.0;
n->SEC_ = relative_cost;
n->AIC = relative_cost * n->SA;
n->SAIC = 0.0; // There are no child volumes yet.
// If this is the first node being added to the hierarchy,
// it becomes the root.
if( root == NULL ) { root = n; return; }
// Look for the optimal place to add the new node.
// The branch-and-bound procedure will figure out where
// to put it so as to cause the smallest increase in the
// estimated cost of the tree.
bound = Infinity;
node *insert_here = NULL;
Branch_and_Bound( root, n, insert_here, bound );
// Now actually insert the node in the optimal place.
insert_here->AddChild( n );
}
示例11: texture_dimensions
void ElementImage::GenerateGeometry()
{
// Release the old geometry before specifying the new vertices.
geometry.Release(true);
std::vector< Rocket::Core::Vertex >& vertices = geometry.GetVertices();
std::vector< int >& indices = geometry.GetIndices();
vertices.resize(4);
indices.resize(6);
// Generate the texture coordinates.
Vector2f texcoords[2];
if (using_coords)
{
Vector2f texture_dimensions((float) texture.GetDimensions(GetRenderInterface()).x, (float) texture.GetDimensions(GetRenderInterface()).y);
if (texture_dimensions.x == 0)
texture_dimensions.x = 1;
if (texture_dimensions.y == 0)
texture_dimensions.y = 1;
texcoords[0].x = (float) coords[0] / texture_dimensions.x;
texcoords[0].y = (float) coords[1] / texture_dimensions.y;
texcoords[1].x = (float) coords[2] / texture_dimensions.x;
texcoords[1].y = (float) coords[3] / texture_dimensions.y;
}
else
{
texcoords[0] = Vector2f(0, 0);
texcoords[1] = Vector2f(1, 1);
}
const Property* element_colour = GetProperty(BACKGROUND_COLOR);
float opacity = GetProperty<float>(OPACITY);
Colourb quad_colour = Colourb(255, 255, 255);
if (element_colour)
{
Colourb background_colour = element_colour->Get<Colourb>();
// Should be a non-transparent background
if (background_colour.alpha != 0)
quad_colour = background_colour;
}
// Apply opacity
quad_colour.alpha = (byte)(opacity * (float)quad_colour.alpha);
Rocket::Core::GeometryUtilities::GenerateQuad(&vertices[0], // vertices to write to
&indices[0], // indices to write to
Vector2f(0, 0), // origin of the quad
GetBox().GetSize(Rocket::Core::Box::CONTENT), // size of the quad
quad_colour, // colour of the vertices
texcoords[0], // top-left texture coordinate
texcoords[1]); // top-right texture coordinate
geometry_dirty = false;
}
示例12: GetObject
static errcode GetObject(FILE * dfile, SceneHandle scene) {
char objtype[80];
fscanf(dfile, "%s", objtype);
if (!stringcmp(objtype, "END_SCENE")) {
return PARSEEOF; /* end parsing */
}
if (!stringcmp(objtype, "TEXDEF")) {
return GetTexDef(dfile);
}
if (!stringcmp(objtype, "TEXALIAS")) {
return GetTexAlias(dfile);
}
if (!stringcmp(objtype, "BACKGROUND")) {
return GetBackGnd(dfile);
}
if (!stringcmp(objtype, "CYLINDER")) {
return GetCylinder(dfile);
}
if (!stringcmp(objtype, "FCYLINDER")) {
return GetFCylinder(dfile);
}
if (!stringcmp(objtype, "POLYCYLINDER")) {
return GetPolyCylinder(dfile);
}
if (!stringcmp(objtype, "SPHERE")) {
return GetSphere(dfile);
}
if (!stringcmp(objtype, "PLANE")) {
return GetPlane(dfile);
}
if (!stringcmp(objtype, "RING")) {
return GetRing(dfile);
}
if (!stringcmp(objtype, "BOX")) {
return GetBox(dfile);
}
if (!stringcmp(objtype, "SCALARVOL")) {
return GetVol(dfile);
}
if (!stringcmp(objtype, "TRI")) {
return GetTri(dfile);
}
if (!stringcmp(objtype, "STRI")) {
return GetSTri(dfile);
}
if (!stringcmp(objtype, "LIGHT")) {
return GetLight(dfile);
}
if (!stringcmp(objtype, "SCAPE")) {
return GetLandScape(dfile);
}
if (!stringcmp(objtype, "TPOLYFILE")) {
return GetTPolyFile(dfile);
}
fprintf(stderr, "Found bad token: %s expected an object type\n", objtype);
return PARSEBADSYNTAX;
}
示例13: IntersectOut
bool LLRegion::IntersectOut(const LLBBox &box) const
{
// First do faster test of bounding boxes
if(GetBox().IntersectOut(box))
return true;
return NoIntersection(box);
}
示例14: GetBox
// internal test to see if regions don't intersect (optimization)
bool LLRegion::NoIntersection(const LLRegion& region) const
{
if(Empty() || region.Empty())
return true;
LLBBox box = GetBox(), rbox = region.GetBox();
return box.IntersectOut(rbox) || NoIntersection(rbox) || region.NoIntersection(box);
}
示例15: DrawScreen
void DrawScreen(TScreen *aScreen) {
unsigned int order;
unsigned short rotation;
unsigned short cimage_idx;
TCImage *local_cimage;
unsigned short box_idx;
TBox *local_box;
object_pressed = 0;
order = 0;
cimage_idx = 0;
box_idx = 0;
CurrentScreen = aScreen;
if ((display_width != CurrentScreen->Width) || (display_height != CurrentScreen->Height)) {
rotation = TFTIntern_GetDisplayRotation();
if (display_width > CurrentScreen->Width) {
if (rotation == _TFT_INTERN_ROTATE_270)
rotation = _TFT_INTERN_ROTATE_0;
else
rotation++;
} else {
if (rotation == _TFT_INTERN_ROTATE_0)
rotation = _TFT_INTERN_ROTATE_270;
else
rotation--;
}
TFTIntern_SetDisplayRotation(rotation);
TSC2006_SetDisplaySize(CurrentScreen->Width, CurrentScreen->Height);
TFTIntern_Fill_Screen(CurrentScreen->Color);
display_width = CurrentScreen->Width;
display_height = CurrentScreen->Height;
}
else
TFTIntern_Fill_Screen(CurrentScreen->Color);
while (order < CurrentScreen->ObjectsCount) {
if (box_idx < CurrentScreen->BoxesCount) {
local_box = GetBox(box_idx);
if (order == local_box->Order) {
box_idx++;
order++;
DrawBox(local_box);
}
}
if (cimage_idx < CurrentScreen->CImagesCount) {
local_cimage = GetCImage(cimage_idx);
if (order == local_cimage->Order) {
cimage_idx++;
order++;
DrawCImage(local_cimage);
}
}
}
}