本文整理汇总了C++中BPoint类的典型用法代码示例。如果您正苦于以下问题:C++ BPoint类的具体用法?C++ BPoint怎么用?C++ BPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PushState
void TExportZone::DrawInMarker(BRect updateRect)
{
// Set up environment
PushState();
BPoint drawPt;
// Draw left marker
if (updateRect.Intersects(m_InRect) )
{
// Draw indicator in new location
drawPt.Set(m_InRect.left, m_InRect.top);
DrawBitmap(m_InMarker, drawPt);
}
// Draw right marker
if (updateRect.Intersects(m_OutRect) )
{
// Draw indicator in new location
drawPt.Set(m_OutRect.left, m_OutRect.top);
DrawBitmap(m_OutMarker, drawPt);
}
// Restore environment
PopState();
}
示例2: HighColor
void TVideoCaptureToolbar::Draw(BRect updateRect)
{
// Setup environment
rgb_color saveColor = HighColor();
// Fill background
SetHighColor(kBlueGrey);
FillRect(Bounds());
// Frame it
BPoint endPt;
SetHighColor(kWhite);
MovePenTo(Bounds().left, Bounds().top+1);
endPt.Set( Bounds().right, Bounds().top+1 );
StrokeLine(endPt);
SetHighColor(kMediumGrey);
MovePenTo(Bounds().left, Bounds().bottom-1);
endPt.Set( Bounds().right, Bounds().bottom-1 );
StrokeLine(endPt);
SetHighColor(kBlack);
MovePenTo(Bounds().left, Bounds().top);
endPt.Set( Bounds().right, Bounds().top );
StrokeLine(endPt);
MovePenTo(Bounds().left, Bounds().bottom);
endPt.Set( Bounds().right, Bounds().bottom );
StrokeLine(endPt);
// Restore Environment
SetHighColor(saveColor);
}
示例3: PushState
void TCueSheetTimeView::Draw(BRect updateRect)
{
// Set up environment
PushState();
const BRect bounds = Bounds();
BPoint startPt, endPt;
// Draw TimeRect frame
SetHighColor(kLightGrey);
FillRect(bounds);
// Draw black outline
SetHighColor(kBlack);
startPt.Set(bounds.left, bounds.top);
endPt.Set(bounds.left, bounds.bottom);
StrokeLine(startPt, endPt);
startPt.Set(bounds.right, bounds.top);
endPt.Set(bounds.right, bounds.bottom);
StrokeLine(startPt, endPt);
// Draw shadow
SetHighColor(kMediumGrey);
startPt.Set(bounds.right-1, bounds.top);
endPt.Set(bounds.right-1, bounds.bottom);
StrokeLine(startPt, endPt);
startPt.Set(bounds.right-1, bounds.bottom);
endPt.Set(bounds.left+1, bounds.bottom);
StrokeLine(startPt, endPt);
// Draw highlight
SetHighColor(kWhite);
startPt.Set(bounds.left+1, bounds.bottom - 2);
endPt.Set(bounds.left+1, bounds.top);
StrokeLine(startPt, endPt);
startPt.Set(bounds.left+1, bounds.top);
endPt.Set(bounds.right-2, bounds.top);
StrokeLine(startPt, endPt);
// Draw cue sheet start time
BFont font;
GetFont(&font);
SetFont(be_bold_font);
SetHighColor(kBlack);
BPoint textPt;
char timeStr[256];
int32 startTime = m_CueSheetWindow->GetCueSheetView()->StartTime();
textPt.Set(bounds.left + 9, bounds.top + 16);
TimeToString(startTime, m_CueSheetWindow->GetCueSheetView()->GetTimeFormat(), timeStr, FALSE);
DrawString(timeStr, textPt);
// Restore environment
PopState();
}
示例4: Draw
void CharView::Draw(BRect urect)
{
BPoint point;
font_height fheight;
char utf8Char[3];
uint16 uniChar[1];
urect = Bounds();
// SetLowColor(def_viewcolor);
SetDrawingMode(B_OP_COPY);
SetHighColor(strokeColor);
SetPenSize(1);
StrokeRect(urect);
urect.InsetBy(1, 1);
SetHighColor(bgColor);
FillRect(urect);
SetLowColor(bgColor);
SetHighColor(displayColor);
if (drawmode) {
font.SetSize(urect.Width() * 0.6);
font.GetHeight(&fheight);
// Unicode to UTF8 Character encoding
uniChar[0] = B_HOST_TO_BENDIAN_INT16(((mutf == 0) || (mutf == 65535)) ? 1 : mutf);
int32 state = 0;
int32 srcLen = 2;
int32 destLen = sizeof(utf8Char);
convert_to_utf8(B_UNICODE_CONVERSION, (const char*)uniChar, &srcLen,
utf8Char, &destLen, &state);
SetFont(&font);
bool hasGlyph[1];
font.GetHasGlyphs(utf8Char, 1, hasGlyph);
if (hasGlyph[0]) {
float choffset = (urect.right - urect.left - StringWidth(utf8Char, destLen)) / 2;
float cvoffset = (urect.Height() - fheight.ascent - fheight.descent) / 2 + fheight.ascent;
point.Set(choffset, cvoffset);
DrawString(utf8Char, destLen, point);
}
}
/* printf("\nCharView!\n");
printf("utf8Char[0]: %x\n", utf8Char[0]);
printf("utf8Char[1]: %x\n", utf8Char[1]);
printf("utf8Char[2]: %x\n", utf8Char[2]);*/
}
示例5: _segl0
pointlist* logicop::logic::hole2simple(const pointlist& outside, const pointlist& inside) {
segmentlist _segl0(outside,0);
segmentlist _segl1(inside,1);
EventQueue* _eq = new EventQueue(_segl0, _segl1); // create the event queue
SweepLine _sl;
BindCollection BC;
_eq->swipe4bind(_sl, BC);
BindSegment* sbc = BC.get_highest();
//insert 2 crossing points and link them
BPoint* cpsegA = _segl0.insertbindpoint(sbc->poly0seg(), sbc->poly0pnt());
BPoint* cpsegB = _segl1.insertbindpoint(sbc->poly1seg(), sbc->poly1pnt());
cpsegA->linkto(cpsegB);
cpsegB->linkto(cpsegA);
// normalize the segment lists
_segl0.normalize(outside);
_segl1.normalize(inside);
// dump the new polygons in VList terms
VPoint* outshape = _segl0.dump_points();
_segl1.dump_points();
// traverse and form the resulting shape
VPoint* centinel = outshape;
pointlist *shgen = new pointlist();
bool direction = true; /*next*/
VPoint* pickup = centinel;
VPoint* prev = centinel->prev();
bool modify = false;
do {
shgen->push_back(TP(pickup->cp()->x(), pickup->cp()->y()));
modify = (-1 == prev->visited());
prev = pickup;
pickup = pickup->follower(direction, modify);
} while (pickup != centinel);
// Validate the resulting polygon
laydata::valid_poly check(*shgen);
// delete shgen;
if (!check.valid()) {
std::ostringstream ost;
ost << ": Resulting shape is invalid - " << check.failtype();
tell_log(console::MT_ERROR, ost.str().c_str());
}
else {
if (laydata::shp_OK != check.status())
*shgen = check.get_validated();
}
return shgen;
}
示例6: text_update
void bx_beos_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y,
bx_vga_tminfo_t tm_info)
{
unsigned i, x, y;
BPoint point;
unsigned char achar;
unsigned nchars;
aWindow->Lock();
// Number of characters on screen, variable number of rows
nchars = text_cols * text_rows;
// first draw over character at original block cursor location
if ((prev_block_cursor_y*text_cols + prev_block_cursor_x) < nchars) {
achar = new_text[(prev_block_cursor_y*text_cols + prev_block_cursor_x)*2];
point.Set(prev_block_cursor_x*8, prev_block_cursor_y*16 + bx_headerbar_y);
aView->DrawBitmap(vgafont[achar], point);
}
for (i=0; i<nchars*2; i+=2) {
if ((old_text[i]!=new_text[i]) ||
(old_text[i+1]!=new_text[i+1]))
{
achar = new_text[i];
x = (i/2) % text_cols;
y = (i/2) / text_cols;
point.Set(x*8, y*16 + bx_headerbar_y);
aView->DrawBitmap(vgafont[achar], point);
}
}
prev_block_cursor_x = cursor_x;
prev_block_cursor_y = cursor_y;
// now draw character at new block cursor location in reverse
if ((cursor_y*text_cols + cursor_x) < nchars) {
achar = new_text[(cursor_y*text_cols + cursor_x)*2];
point.Set(cursor_x*8, cursor_y*16 + bx_headerbar_y);
aView->set_inv_text_colors();
aView->DrawBitmap(vgafont[achar], point);
aView->set_text_colors();
}
aWindow->Unlock();
}
示例7: ConvertToScreen
BPoint
FolderShaperWindow::GetMouse()
{
BPoint point;
uint32 buttons;
topbox->GetMouse(&point, &buttons);
point = ConvertToScreen(point);
float width, height;
m_menubar-> GetPreferredSize(&width, &height);
point.Set(point.x, point.y+height+2);
return point;
}
示例8: BList
TPolygon::TPolygon( BRect rect )
{
m_PointList = new BList();
// Copy data over
BPoint tmpPt;
tmpPt.Set(rect.left, rect.top);
m_PointList->AddItem(&tmpPt);
tmpPt.Set(rect.right, rect.top);
m_PointList->AddItem(&tmpPt);
tmpPt.Set(rect.right, rect.bottom);
m_PointList->AddItem(&tmpPt);
tmpPt.Set(rect.left, rect.bottom);
m_PointList->AddItem(&tmpPt);
}
示例9: GetChainParams
status_t GlEllipse::GetChainParams( const gl_generate_args& args,
BPoint& ptX, BPoint& ptY,
BPoint& ptW, BPoint& ptH,
GlAlgo** outAX, GlAlgo** outAY, GlAlgo** outAZ) const
{
ptX.Set(DEF_REL_X, DEF_ABS_X);
ptY.Set(DEF_REL_Y, DEF_ABS_Y);
ptW.Set(DEF_REL_W, DEF_ABS_W);
ptH.Set(DEF_REL_H, DEF_ABS_H);
ptX = Params().Point('x_pt');
ptY = Params().Point('y_pt');
ptW = Params().Point('w_pt');
ptH = Params().Point('h_pt');
ArpVALIDATE(outAX && outAY && outAZ, return B_ERROR);
*outAX = GenerateChainAlgo(_X_KEY, args);
*outAY = GenerateChainAlgo(_Y_KEY, args);
*outAZ = GenerateChainAlgo(_Z_KEY, args);
return B_OK;
}
示例10:
// PositionMarkerAt
void
ColorField::PositionMarkerAt(BPoint where)
{
BRect rect = _BitmapRect();
where.ConstrainTo(rect);
where -= rect.LeftTop();
fLastMarkerPosition = fMarkerPosition;
fMarkerPosition = where;
Invalidate();
}
示例11: PushState
void TElementsSorter::Draw(BRect updateRect)
{
PushState();
// Draw dummy header to the right of our rightmost TSorter
TSorterContainer* sorter = static_cast<TSorterContainer*>(fSorterList->ItemAt( fSorterList->CountItems()-1) );
if (sorter) {
BRect bounds = Bounds();
bounds.bottom = bounds.top + kSorterHeight;
bounds.left = sorter->Frame().right;
if (updateRect.Intersects(bounds) ) {
// Fill background
SetHighColor(kBeGrey);
FillRect(bounds);
// Frame it
BPoint endPt;
SetHighColor(kWhite);
MovePenTo(bounds.left, bounds.top+1);
endPt.Set( bounds.right, bounds.top+1 );
StrokeLine(endPt);
SetHighColor(kMediumGrey);
MovePenTo(bounds.left, bounds.bottom-1);
endPt.Set( bounds.right, bounds.bottom-1 );
StrokeLine(endPt);
SetHighColor(kBlack);
MovePenTo(bounds.left, bounds.top);
endPt.Set( bounds.right, bounds.top );
StrokeLine(endPt);
MovePenTo(bounds.left, bounds.bottom);
endPt.Set( bounds.right, bounds.bottom );
StrokeLine(endPt);
}
}
PopState();
}
示例12: show_headerbar
void bx_beos_gui_c::show_headerbar(void)
{
unsigned xorigin;
BPoint origin;
// clear header bar area to white
aWindow->Lock();
aView->set_headerbar_colors();
aView->FillRect(BRect(0, 0, dimension_x-1, bx_headerbar_y-1), B_SOLID_LOW);
for (unsigned i=0; i<bx_headerbar_entries; i++) {
if (bx_headerbar_entry[i].alignment == BX_GRAVITY_LEFT)
xorigin = bx_headerbar_entry[i].xorigin;
else
xorigin = dimension_x - bx_headerbar_entry[i].xorigin;
origin.Set(xorigin, 0);
aView->DrawBitmap(bx_headerbar_entry[i].bitmap, origin);
}
aView->set_text_colors();
aWindow->Unlock();
}
示例13: KeyDown
void MainView::KeyDown(const char *key, int32 num_bytes)
{
BPoint shift;
BPoint point = sel_bounds.LeftTop();
int multiplier = 1;
uint32 mods = modifiers();
if(mods & B_SHIFT_KEY) {
multiplier = 5;
}
Invalidate();
if(key_down) {
h_ruler->SetSelRect(sel_bounds);
v_ruler->SetSelRect(sel_bounds);
key_down = false;
}
switch(*key) {
case B_LEFT_ARROW:
shift.Set(-1 * multiplier,0);
h_ruler->UpdateSlider(point);
moveSelectedFieldsBy(shift);
break;
case B_RIGHT_ARROW:
shift.Set(1 * multiplier,0);
h_ruler->UpdateSlider(point);
moveSelectedFieldsBy(shift);
break;
case B_UP_ARROW:
shift.Set(0,-1 * multiplier);
v_ruler->UpdateSlider(point);
moveSelectedFieldsBy(shift);
break;
case B_DOWN_ARROW:
shift.Set(0,1 * multiplier);
v_ruler->UpdateSlider(point);
moveSelectedFieldsBy(shift);
break;
default:
break;
}
}
示例14: ThumbRangeFor
void
BChannelSlider::DrawChannel(BView* into, int32 channel, BRect area,
bool pressed)
{
float hCenter = area.Width() / 2;
float vCenter = area.Height() / 2;
BPoint leftTop;
BPoint bottomRight;
if (fIsVertical) {
leftTop.Set(area.left + hCenter, area.top + vCenter);
bottomRight.Set(leftTop.x, leftTop.y + ThumbRangeFor(channel));
} else {
leftTop.Set(area.left, area.top + vCenter);
bottomRight.Set(area.left + ThumbRangeFor(channel), leftTop.y);
}
DrawGroove(into, channel, leftTop, bottomRight);
BPoint thumbLocation = leftTop;
if (fIsVertical)
thumbLocation.y += ThumbDeltaFor(channel);
else
thumbLocation.x += ThumbDeltaFor(channel);
DrawThumb(into, channel, thumbLocation, pressed);
}
示例15: FolderRow
bool ListView1::InitiateDrag(BPoint point, bool wasSelected) {
printf("InitiateDrag():");
point.PrintToStream();
BRow *row=FocusRow();
if (row==NULL) return false;
/*
if ((CDMode==DATACD_INDEX) || (CDMode==BOOTABLECD_INDEX)) { // yes? then we are not in audio mode
folderRow=new FolderRow(((FolderRow *)row)->GetFilename(),
((FolderRow *)row)->IsFolder(),
((FolderRow *)row)->GetBitmap());
} else */
if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)){
audioRow=new AudioRow(((AudioRow *)row)->GetTrackNumber(),((AudioRow *)row)->GetFilename(),
((AudioRow *)row)->GetPregap(),
((AudioRow *)row)->GetBytes(),
((AudioRow *)row)->GetLength());
audioRow->SetCDTitle(((AudioRow *)row)->GetCDTitle());
audioRow->SetIndexList(((AudioRow *)row)->GetIndexList());
audioRow->SetPregap(((AudioRow *)row)->GetPregap());
audioRow->SetStartFrame(((AudioRow *)row)->GetStartFrame());
audioRow->SetEndFrame(((AudioRow *)row)->GetEndFrame());
// audioRow->SetStartTime(((AudioRow *)row)->GetStartTime());
// audioRow->SetEndTime(((AudioRow *)row)->GetEndTime());
//audioRow=new AudioRow(*((AudioRow *)row));
}
BMessage *message=new BMessage(LISTITEM_DROPPED);
BRect rect;
if (GetRowRect(row, &rect)) {
void *r=(void *)row;
message->AddPointer("from", r);
if (!((FolderRow *)row)->IsFolder())
message->AddInt32("index", (int32)IndexOf(row));
DragMessage(message, rect);
// if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX))
// RemoveRow(IndexOf(row));
//delete row;
}
return true;
}