本文整理汇总了C++中BRect::IntegerWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ BRect::IntegerWidth方法的具体用法?C++ BRect::IntegerWidth怎么用?C++ BRect::IntegerWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRect
的用法示例。
在下文中一共展示了BRect::IntegerWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p
// ToolDraw
void
PickManipulator::ToolDraw(BView* into, BRect itemFrame)
{
if (itemFrame.IntegerWidth() < 4)
return;
itemFrame.InsetBy(1, 1);
int32 dotCount = itemFrame.IntegerHeight() / 3;
BPoint p(itemFrame.LeftTop());
for (int32 i = 0; i < dotCount; i++) {
into->SetHighColor(0, 0, 0, 75);
into->StrokeLine(p, p);
p = p + BPoint(1, 1);
into->SetHighColor(255, 255, 255, 200);
into->StrokeLine(p, p);
p = p + BPoint(-1, 2);
}
itemFrame.right--;
if (itemFrame.IntegerWidth() < 6)
return;
p = itemFrame.RightTop();
for (int32 i = 0; i < dotCount; i++) {
into->SetHighColor(0, 0, 0, 75);
into->StrokeLine(p, p);
p = p + BPoint(1, 1);
into->SetHighColor(255, 255, 255, 200);
into->StrokeLine(p, p);
p = p + BPoint(-1, 2);
}
}
示例2: BWindow
Tearoff::Tearoff(BRect frame, const char *name, MainWindow *parent, MenuName menu_name, int idx)
: BWindow(frame, name, B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, 0)
{
int y = 0;
BFont font;
BMenu *menu;
this->parent = parent;
menu = parent->GetMenu(menu_name);
menu->GetFont(&font);
for(int i = 1; i < menu->CountItems(); i++) {
BMenuItem *item = menu->ItemAt(i);
if(item->Message()) {
BButton *b = new BButton(BRect(0, y, frame.IntegerWidth(), y + TEAROFF_BUTTON_HEIGHT), "", item->Label(), new BMessage(item->Message()->what), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
font.SetSize(TEAROFF_FONT_SIZE);
b->SetFont(&font);
AddChild(b);
y = y + TEAROFF_BUTTON_HEIGHT;
}
}
this->ResizeTo(frame.IntegerWidth(), y);
this->SetTitle(menu->Name());
this->index = idx;
delete menu;
}
示例3: screen
/*****************************************************************************
* VideoWindow::SetFullScreen
*****************************************************************************/
void
VideoWindow::SetFullScreen(bool doIt)
{
if (doIt)
{
SetLook( B_NO_BORDER_WINDOW_LOOK );
BScreen screen( this );
BRect rect = screen.Frame();
Activate();
MoveTo(0.0, 0.0);
ResizeTo(rect.IntegerWidth(), rect.IntegerHeight());
be_app->ObscureCursor();
fInterfaceShowing = false;
fSettings->AddFlags(VideoSettings::FLAG_FULL_SCREEN);
}
else
{
SetLook( B_TITLED_WINDOW_LOOK );
MoveTo(winSize.left, winSize.top);
ResizeTo(winSize.IntegerWidth(), winSize.IntegerHeight());
be_app->ShowCursor();
fInterfaceShowing = true;
fSettings->ClearFlags(VideoSettings::FLAG_FULL_SCREEN);
}
}
示例4: CopyPixelsIn
status_t MesaDriver::CopyPixelsIn(BBitmap *bitmap, BPoint location)
{
color_space scs = bitmap->ColorSpace();
color_space dcs = m_bitmap->ColorSpace();
if (scs != dcs && (dcs != B_RGBA32 || scs != B_RGB32)) {
printf("CopyPixelsIn(): incompatible color space: %s != %s\n",
color_space_name(scs),
color_space_name(dcs));
return B_BAD_TYPE;
}
// debugger("CopyPixelsIn()");
BRect sr = bitmap->Bounds();
BRect dr = m_bitmap->Bounds();
sr = sr & dr.OffsetBySelf(location);
dr = sr.OffsetByCopy(-location.x, -location.y);
uint8 *ps = (uint8 *) bitmap->Bits();
uint8 *pd = (uint8 *) m_bitmap->Bits();
uint32 *s, *d;
uint32 y;
for (y = (uint32) sr.top; y <= (uint32) sr.bottom; y++) {
s = (uint32 *) (ps + y * bitmap->BytesPerRow());
s += (uint32) sr.left;
d = (uint32 *) (pd + (y + (uint32) (dr.top - sr.top)) * m_bitmap->BytesPerRow());
d += (uint32) dr.left;
memcpy(d, s, dr.IntegerWidth() * 4);
}
return B_OK;
}
示例5: GetBufferSize
void MesaDriver::GetBufferSize(GLframebuffer * framebuffer, GLuint *width,
GLuint *height)
{
GET_CURRENT_CONTEXT(ctx);
if (!ctx)
return;
MesaDriver * md = (MesaDriver *) ctx->DriverCtx;
BGLView *bglview = md->m_bglview;
assert(bglview);
BRect b = bglview->Bounds();
*width = (GLuint) b.IntegerWidth() + 1; // (b.right - b.left + 1);
*height = (GLuint) b.IntegerHeight() + 1; // (b.bottom - b.top + 1);
md->m_bottom = (GLint) b.bottom;
if (ctx->Visual.doubleBufferMode) {
if (*width != md->m_width || *height != md->m_height) {
// allocate new size of back buffer bitmap
if (md->m_bitmap)
delete md->m_bitmap;
BRect rect(0.0, 0.0, *width - 1, *height - 1);
md->m_bitmap = new BBitmap(rect, B_RGBA32);
}
}
else
{
md->m_bitmap = NULL;
}
md->m_width = *width;
md->m_height = *height;
}
示例6: sizeof
ViewBuffer::ViewBuffer(BRect frame)
: BView(frame, "ViewBuffer", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS),
fColumns(frame.IntegerWidth() / CHAR_WIDTH),
fRows(frame.IntegerHeight() / CHAR_HEIGHT),
fGlyphGrid(NULL),
fResizeCallback(NULL),
// initially, the cursor is hidden
fCursorX(-1),
fCursorY(-1)
{
SetFont(be_fixed_font);
// initialize private palette
for (int i = 0; i < 8; i++) {
fPalette[i].red = (sPalette32[i] >> 16) & 0xff;
fPalette[i].green = (sPalette32[i] >> 8) & 0xff;
fPalette[i].blue = (sPalette32[i] >> 0) & 0xff;
fPalette[i].alpha = 0xff;
}
// initialize glyph grid
uint32 size = fRows * fColumns;
if (size > 0) {
fGlyphGrid = new uint16[size];
memset(fGlyphGrid, 0, size * sizeof(uint16));
}
}
示例7:
// FrameResized
void
ColorField::FrameResized(float width, float height)
{
BRect r = _BitmapRect();
_AllocBitmap(r.IntegerWidth() + 1, r.IntegerHeight() + 1);
Invalidate();
}
示例8:
void
PeakView::FrameResized(float width, float height)
{
BRect bitmapFrame = _BackBitmapFrame();
_ResizeBackBitmap(bitmapFrame.IntegerWidth() + 1, fChannelCount);
_UpdateBackBitmap();
}
示例9: r
static void testSetOriginAndScale4(BView *view, BRect frame)
{
frame.InsetBy(2, 2);
BPoint center = centerPoint(frame);
BRect r(0, 0, frame.IntegerWidth() / 2, frame.IntegerHeight() / 2);
view->SetOrigin(center);
view->FillRect(r);
view->SetScale(0.5);
view->SetHighColor(kRed);
view->FillRect(r);
view->PushState();
//
view->SetOrigin(center.x+1, center.y);
// +1 to work around BeOS bug
// where setting the origin has no
// effect if it is the same as
// the previous value althou
// it is from the "outer" coordinate
// system
view->SetHighColor(kGreen);
view->FillRect(r);
view->PopState();
}
示例10: rect
/*! \brief Returns the frame of the specified workspace within the
workspaces view.
*/
BRect
WorkspacesView::_WorkspaceAt(int32 i)
{
int32 columns, rows;
_GetGrid(columns, rows);
BRect frame = Bounds();
ConvertToScreen(&frame);
int32 width = frame.IntegerWidth() / columns;
int32 height = frame.IntegerHeight() / rows;
int32 column = i % columns;
int32 row = i / columns;
BRect rect(column * width, row * height, (column + 1) * width,
(row + 1) * height);
rect.OffsetBy(frame.LeftTop());
// make sure there is no gap anywhere
if (column == columns - 1)
rect.right = frame.right;
if (row == rows - 1)
rect.bottom = frame.bottom;
return rect;
}
示例11: get_screen_size
Size2 OS_Haiku::get_screen_size(int p_screen) const {
// TODO: make this work with the p_screen parameter
BScreen *screen = new BScreen(window);
BRect frame = screen->Frame();
delete screen;
return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1);
}
示例12: PPSize
PPSize
DisplayDevice_Haiku::getDisplayResolution() const
{
BScreen screen;
BRect frame = screen.Frame();
return PPSize(frame.IntegerWidth(), frame.IntegerHeight());
}
示例13:
bool
Scaler::Matches(BRect rect, bool dither) const
{
return fRect.IntegerWidth() == rect.IntegerWidth() &&
fRect.IntegerHeight() == rect.IntegerHeight() &&
fDither == dither;
}
示例14: node
void
ShowImageWindow::_SaveWidthAndHeight()
{
if (fNavigator.CurrentPage() != 1)
return;
if (fImageView->Bitmap() == NULL)
return;
BRect bounds = fImageView->Bitmap()->Bounds();
int32 width = bounds.IntegerWidth() + 1;
int32 height = bounds.IntegerHeight() + 1;
BNode node(&fNavigator.CurrentRef());
if (node.InitCheck() != B_OK)
return;
const char* kWidthAttrName = "Media:Width";
const char* kHeightAttrName = "Media:Height";
int32 widthAttr;
ssize_t attrSize = node.ReadAttr(kWidthAttrName, B_INT32_TYPE, 0,
&widthAttr, sizeof(widthAttr));
if (attrSize <= 0 || widthAttr != width)
node.WriteAttr(kWidthAttrName, B_INT32_TYPE, 0, &width, sizeof(width));
int32 heightAttr;
attrSize = node.ReadAttr(kHeightAttrName, B_INT32_TYPE, 0,
&heightAttr, sizeof(heightAttr));
if (attrSize <= 0 || heightAttr != height)
node.WriteAttr(kHeightAttrName, B_INT32_TYPE, 0, &height, sizeof(height));
}
示例15: BGLRenderer
SoftPipeRenderer::SoftPipeRenderer(BGLView *view, ulong options,
BGLDispatcher* dispatcher)
: BGLRenderer(view, options, dispatcher),
fBitmap(NULL),
fDirectModeEnabled(false),
fInfo(NULL),
fInfoLocker("info locker"),
fOptions(options),
fColorSpace(B_NO_COLOR_SPACE)
{
CALLED();
time_t beg, end;
beg = time(NULL);
hsp_init(options);
end = time(NULL);
TRACE("hsp_init time: %f.\n", difftime(end, beg));
BRect b = GLView()->Bounds();
fColorSpace = B_RGBA32;
if (fDirectModeEnabled && fInfo != NULL) {
fColorSpace = BScreen(GLView()->Window()).ColorSpace();
}
int32 width = b.IntegerWidth();// + 1;
int32 height = b.IntegerHeight();// + 1;
TRACE("ColorSpace:\t%s\n", color_space_name(fColorSpace));
fBitmap = new BBitmap(BRect(0.f, 0.f, width /*- 1*/, height /*- 1*/), fColorSpace);
fWidth = width;
fHeight = height;
beg = time(NULL);
fContext = hsp_create_layer_context(fBitmap, 0);
TRACE("context:\t%d\n", (int)fContext);
end = time(NULL);
TRACE("hsp_create_layer_context time: %f.\n", difftime(end, beg));
if (!hsp_get_current_context())
LockGL();
}