本文整理汇总了C++中BView::BeginLineArray方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::BeginLineArray方法的具体用法?C++ BView::BeginLineArray怎么用?C++ BView::BeginLineArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::BeginLineArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
/*
* Make inside state picture.
*/
BPicture*
HToolbarButton::MakeInsidePicture(BBitmap *in)
{
HToolbar *toolbar = cast_as(Parent(),HToolbar);
BRect buttonRect = toolbar->ButtonRect();
BView *view = new BView(BRect(0,0,buttonRect.Width(),buttonRect.Height())
,"offview",0,0);
BBitmap *bitmap = new BBitmap(view->Bounds(), in->ColorSpace(), true);
BPicture *pict;
bitmap->AddChild(view);
bitmap->Lock();
view->SetDrawingMode(B_OP_ALPHA);
view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
view->BeginPicture(new BPicture);
DrawBitmap(view,in);
DrawString(view,fName.String());
//view->SetHighColor(White);
//view->FillRect(BRect(0,0,0,22));
//view->FillRect(BRect(0,0,22,0));
//view->SetHighColor(BeShadow);
//view->FillRect(BRect(21,0,21,21));
//view->FillRect(BRect(0,21,21,21));
BRect rect(Bounds());
view->SetDrawingMode(B_OP_OVER);
rect.InsetBy(1,1);
view->BeginLineArray(5);
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
view->AddLine(rect.LeftTop(), rect.RightTop(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
rect.bottom--;
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
view->AddLine(rect.RightTop(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
view->EndLineArray();
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
view->StrokeRect(Bounds());
pict = view->EndPicture();
bitmap->Unlock();
delete bitmap;
return pict;
}
示例2: sizeof
// _UpdateThread
status_t
ColorSlider::_UpdateThread(void* data)
{
// initializing
ColorSlider* colorSlider = (ColorSlider*)data;
bool looperLocked = colorSlider->LockLooper();
port_id port = colorSlider->fUpdatePort;
orientation orient = colorSlider->fOrientation;
if (looperLocked)
colorSlider->UnlockLooper();
float h, s, v, r, g, b;
int R, G, B;
// drawing
int32 msg_code;
char msg_buffer;
while (true) {
port_info info;
do {
read_port(port, &msg_code, &msg_buffer, sizeof(msg_buffer));
get_port_info(port, &info);
} while (info.queue_count);
if (colorSlider->LockLooper()) {
uint colormode = colorSlider->fMode;
float fixedvalue1 = colorSlider->fFixedValue1;
float fixedvalue2 = colorSlider->fFixedValue2;
BBitmap* bitmap = colorSlider->fBgBitmap;
BView* view = colorSlider->fBgView;
bitmap->Lock();
colorSlider->UnlockLooper();
view->BeginLineArray(256);
switch (colormode) {
case R_SELECTED: {
G = round(fixedvalue1 * 255);
B = round(fixedvalue2 * 255);
for (int R = 0; R < 256; ++R) {
_DrawColorLineY( view, R, R, G, B );
}
}; break;
case G_SELECTED: {
R = round(fixedvalue1 * 255);
B = round(fixedvalue2 * 255);
for (int G = 0; G < 256; ++G) {
_DrawColorLineY( view, G, R, G, B );
}
}; break;
case B_SELECTED: {
R = round(fixedvalue1 * 255);
G = round(fixedvalue2 * 255);
for (int B = 0; B < 256; ++B) {
_DrawColorLineY( view, B, R, G, B );
}
}; break;
case H_SELECTED: {
s = 1.0;//fixedvalue1;
v = 1.0;//fixedvalue2;
if (orient == B_VERTICAL) {
for (int y = 0; y < 256; ++y) {
HSV_to_RGB( (float)y*6.0/255.0, s, v, r, g, b );
_DrawColorLineY( view, y, r*255, g*255, b*255 );
}
} else {
for (int x = 0; x < 256; ++x) {
HSV_to_RGB( (float)x*6.0/255.0, s, v, r, g, b );
_DrawColorLineX( view, x, r*255, g*255, b*255 );
}
}
}; break;
case S_SELECTED: {
h = fixedvalue1;
v = 1.0;//fixedvalue2;
for (int y = 0; y < 256; ++y) {
HSV_to_RGB( h, (float)y/255, v, r, g, b );
_DrawColorLineY( view, y, r*255, g*255, b*255 );
}
}; break;
//.........这里部分代码省略.........
示例3: bounds
void
BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
const BColumnTitle *pressedColumn,
void (*trackRectBlitter)(BView *, BRect), BRect passThru)
{
BRect bounds(Bounds());
BView *view;
if (useOffscreen) {
ASSERT(sOffscreen);
BRect frame(bounds);
frame.right += frame.left;
// this is kind of messy way of avoiding being clipped by the ammount the
// title is scrolled to the left
// ToDo: fix this
view = sOffscreen->BeginUsing(frame);
view->SetOrigin(-bounds.left, 0);
view->SetLowColor(LowColor());
view->SetHighColor(HighColor());
BFont font(be_plain_font);
font.SetSize(9);
view->SetFont(&font);
} else
view = this;
if (be_control_look != NULL) {
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
view->SetHighColor(tint_color(base, B_DARKEN_2_TINT));
view->StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
bounds.bottom--;
be_control_look->DrawButtonBackground(view, bounds, bounds, base, 0,
BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);
} else {
// fill background with light gray background
if (!updateOnly)
view->FillRect(bounds, B_SOLID_LOW);
view->BeginLineArray(4);
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor);
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor);
// draw lighter gray and white inset lines
bounds.InsetBy(0, 1);
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor);
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor);
view->EndLineArray();
}
int32 count = fTitleList.CountItems();
float minx = bounds.right;
float maxx = bounds.left;
for (int32 index = 0; index < count; index++) {
BColumnTitle *title = fTitleList.ItemAt(index);
title->Draw(view, title == pressedColumn);
BRect titleBounds(title->Bounds());
if (titleBounds.left < minx)
minx = titleBounds.left;
if (titleBounds.right > maxx)
maxx = titleBounds.right;
}
if (be_control_look != NULL) {
bounds = Bounds();
minx--;
view->SetHighColor(sLightShadowColor);
view->StrokeLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom - 1));
} else {
// first and last shades before and after first column
maxx++;
minx--;
view->BeginLineArray(2);
view->AddLine(BPoint(minx, bounds.top),
BPoint(minx, bounds.bottom), sShadowColor);
view->AddLine(BPoint(maxx, bounds.top),
BPoint(maxx, bounds.bottom), sShineColor);
view->EndLineArray();
}
#if !(APP_SERVER_CLEARS_BACKGROUND)
FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1), B_SOLID_LOW);
FillRect(BRect(maxx + 1, bounds.top + 1, bounds.right, bounds.bottom - 1), B_SOLID_LOW);
#endif
if (useOffscreen) {
if (trackRectBlitter)
(trackRectBlitter)(view, passThru);
view->Sync();
DrawBitmap(sOffscreen->Bitmap());
sOffscreen->DoneUsing();
} else if (trackRectBlitter)
(trackRectBlitter)(view, passThru);
}
示例4: sizeof
int32
ColorField::_UpdateThread(void *data)
{
// initialization
ColorField *colorField = (ColorField *)data;
BLooper *looper = colorField->Looper();
if (looper)
looper->Lock();
BBitmap* bitmap = colorField->fBgBitmap[0];
BView* view = colorField->fBgView[0];
port_id port = colorField->fUpdatePort;
if (looper)
looper->Unlock();
// draw
float h, s, v, r, g, b;
int R, G, B;
int32 msg_code;
char msg_buffer;
while (true) {
port_info info;
do {
read_port(port, &msg_code, &msg_buffer, sizeof(msg_buffer));
get_port_info(port, &info);
} while (info.queue_count);
if (looper)
looper->Lock();
uint colormode = colorField->fColorMode;
float fixedvalue = colorField->fFixedValue;
if (looper)
looper->Unlock();
bitmap->Lock();
view->BeginLineArray(256 * 256);
switch (colormode)
{
case R_SELECTED:
{
R = round(fixedvalue * 255);
for (int G = 0; G < 256; ++G)
for (int B = 0; B < 256; ++B)
DrawColorPoint(BPoint(G, 255.0 - B), R, G, B);
break;
}
case G_SELECTED:
{
G = round(fixedvalue * 255);
for (int R = 0; R < 256; ++R)
for (int B = 0; B < 256; ++B)
DrawColorPoint(BPoint(R, 255.0 - B), R, G, B);
break;
}
case B_SELECTED:
{
B = round(fixedvalue * 255);
for (int R = 0; R < 256; ++R)
for (int G = 0; G < 256; ++G)
DrawColorPoint(BPoint(R, 255.0 - G), R, G, B);
break;
}
case H_SELECTED:
{
h = fixedvalue;
for (int x = 0; x < 256; ++x) {
s = (float)x / 255.0;
for (int y = 0; y < 256; ++y) {
v = (float)y / 255.0;
HSV_to_RGB(h, s, v, r, g, b);
DrawColorPoint(BPoint(x, 255.0 - y), round(r * 255.0),
round(g * 255.0), round(b * 255.0));
}
}
break;
}
case S_SELECTED:
{
s = fixedvalue;
for (int x = 0; x < 256; ++x) {
h = 6.0 / 255 * x;
for (int y = 0; y<256; ++y) {
v = (float)y / 255.0;
HSV_to_RGB(h, s, v, r, g, b);
DrawColorPoint(BPoint(x, 255.0 - y), round(r * 255.0),
round(g * 255.0), round(b * 255.0));
//.........这里部分代码省略.........
示例5: reply
//.........这里部分代码省略.........
BGradient *gradient;
if (message.ReadGradient(&gradient) != B_OK)
continue;
offscreen->FillTriangle(points[0], points[1], points[2],
bounds, *gradient);
delete gradient;
}
invalidRegion.Include(bounds);
break;
}
case RP_STROKE_LINE:
{
BPoint points[2];
if (message.ReadList(points, 2) != B_OK)
continue;
offscreen->StrokeLine(points[0], points[1], pattern);
BRect bounds = _BuildInvalidateRect(points, 2);
invalidRegion.Include(bounds.InsetBySelf(-penSize, -penSize));
break;
}
case RP_STROKE_LINE_ARRAY:
{
int32 numLines;
if (message.Read(numLines) != B_OK)
continue;
BRect bounds;
offscreen->BeginLineArray(numLines);
for (int32 i = 0; i < numLines; i++) {
rgb_color color;
BPoint start, end;
message.ReadArrayLine(start, end, color);
offscreen->AddLine(start, end, color);
bounds.left = min_c(bounds.left, min_c(start.x, end.x));
bounds.top = min_c(bounds.top, min_c(start.y, end.y));
bounds.right = max_c(bounds.right, max_c(start.x, end.x));
bounds.bottom = max_c(bounds.bottom, max_c(start.y, end.y));
}
offscreen->EndLineArray();
invalidRegion.Include(bounds);
break;
}
case RP_FILL_REGION:
case RP_FILL_REGION_GRADIENT:
{
BRegion region;
if (message.ReadRegion(region) != B_OK)
continue;
if (code == RP_FILL_REGION)
offscreen->FillRegion(®ion, pattern);
else {
BGradient *gradient;
if (message.ReadGradient(&gradient) != B_OK)
continue;
offscreen->FillRegion(®ion, *gradient);
示例6: CreatePicture
/*------------------------------------------------------------------------------*\
( )
-
\*------------------------------------------------------------------------------*/
BPicture* BmToolbarButton::CreatePicture( int32 mode, float width,
float height) {
const char* label = mLabel.String();
BmBitmapHandle* imageHandle
= TheResources->IconByName(BmString("Button_")<<mResourceName);
BBitmap* image = imageHandle ? imageHandle->bitmap : NULL;
// Calc icon/label positions
BFont font( be_plain_font);
bool showIcons = ThePrefs->GetBool( "ShowToolbarIcons", true);
BmString labelMode = ThePrefs->GetString( "ShowToolbarLabel", "Bottom");
float labelWidth
= (label && labelMode != "Hide") ? font.StringWidth( label) : 0;
float labelHeight
= (label && labelMode != "Hide")
? TheResources->FontLineHeight( &font)
: 0;
float iconWidth = (showIcons && image) ? image->Bounds().Width() : 0;
float iconHeight = (showIcons && image) ? image->Bounds().Height() : 0;
BPoint posIcon( 0,0), posLabel( 0,0);
if (showIcons && (labelMode == "Left")) {
// Icon + Label/Left
float d = (width-(mNeedsLatch ? DIVLATCHW : 0)-DIVW-labelWidth-iconWidth)/2;
posLabel = BPoint( d,(height-labelHeight)/2);
posIcon = BPoint( d+DIVW+labelWidth+(mNeedsLatch ? DIVLATCHW : 0),
(height-iconHeight)/2-1);
} else if (showIcons && (labelMode == "Right")) {
// Icon + Label/Right
float d = (width-(mNeedsLatch ? DIVLATCHW : 0)-DIVW-labelWidth-iconWidth)/2;
posLabel = BPoint( d+DIVW+iconWidth,(height-labelHeight)/2);
posIcon = BPoint( d,(height-iconHeight)/2-1);
} else if (showIcons && (labelMode == "Top")) {
// Icon + Label/top
float d = (height-DIVH-labelHeight-iconHeight)/2-2;
posLabel = BPoint( (width-labelWidth-(mNeedsLatch ? DIVLATCHW : 0))/2, d);
posIcon = BPoint( (width-iconWidth)/2-1,d+DIVH+labelHeight);
} else if (showIcons && (labelMode == "Bottom")) {
// Icon + Label/bottom
float d = (height-DIVH-labelHeight-iconHeight)/2;
posLabel = BPoint( (width-labelWidth-(mNeedsLatch ? DIVLATCHW : 0))/2,
d+DIVH+iconHeight);
posIcon = BPoint( (width-iconWidth)/2-1,d);
} else if (!showIcons && labelMode != "Hide") {
// Label only
posLabel = BPoint( (width-labelWidth-(mNeedsLatch ? DIVLATCHW : 0))/2,
(height-labelHeight)/2);
} else if (showIcons && labelMode == "Hide") {
// Icon only
posIcon = BPoint( (width-iconWidth-(mNeedsLatch ? DIVLATCHW : 0))/2,
(height-iconHeight)/2);
}
if (mNeedsLatch) {
if (labelMode == "Hide")
mLatchRect.Set( posIcon.x+iconWidth+2,
posIcon.y+iconHeight/2-LATCHSZ/2,
width, height);
else
mLatchRect.Set( posLabel.x+labelWidth+2,
posLabel.y+labelHeight/2-LATCHSZ/2,
width, height);
} else
mLatchRect.Set( -1, -1, -1, -1);
// Draw
BRect rect(0,0,width-1,height-1);
BView* view = new BView( rect, NULL, B_FOLLOW_NONE, 0);
BBitmap* drawImage = new BBitmap( rect, B_RGBA32, true);
drawImage->AddChild( view);
drawImage->Lock();
BPicture* picture = new BPicture();
view->BeginPicture( picture);
view->SetHighColor( ui_color( B_PANEL_TEXT_COLOR));
view->SetViewColor( B_TRANSPARENT_COLOR);
view->SetLowColor( ui_color( B_PANEL_BACKGROUND_COLOR));
#ifndef __HAIKU__
BmToolbar* toolbar = dynamic_cast<BmToolbar*>(Parent()->Parent());
BBitmap* toolbarBackground = NULL;
if (toolbar) {
toolbarBackground = toolbar->BackgroundBitmap();
if (toolbarBackground)
view->DrawBitmap( toolbarBackground, Frame(), rect);
}
if (mode == STATE_ON) {
rect.InsetBy( 1, 1);
view->BeginLineArray(4);
view->AddLine( rect.LeftBottom(), rect.LeftTop(),
BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
view->AddLine( rect.LeftTop(), rect.RightTop(),
BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
view->AddLine( rect.LeftBottom(), rect.RightBottom(),
ui_color( B_SHINE_COLOR));
view->AddLine( rect.RightBottom(), rect.RightTop(),
ui_color( B_SHINE_COLOR));
//.........这里部分代码省略.........
示例7: _InitWindow
//.........这里部分代码省略.........
inputHeight->SetViewColor(200,200,200,255);
inputHeight->SetDrawingMode(B_OP_OVER);
// (inputHeight->TextView())->MakeEditable(false);
pictureSizeView->AddChild(label2);
pictureSizeView->AddChild(inputWidth);
pictureSizeView->AddChild(unit2);
inputWidth->SetViewColor(200,200,200,255);
inputWidth->SetDrawingMode(B_OP_OVER);
// (inputWidth->TextView())->MakeEditable(false);
//---Originalgrößen View---
//+++Neue Größe View+++
BRect newPictureSize = background;
newPictureSize.top=(pictureSize.bottom+3);
newPictureSize.bottom -=50;
BBox *newPictureSizeView=new BBox(newPictureSize,"pictureView2",B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT);
newPictureSizeView->SetLabel(new BStringView(BRect(10,0,50,20),"Label","Neue Größe:"));
outputWidth=new BTextControl(BRect(5,15,newPictureSize.Width()-80,20),"oWidth","Width:","",new BMessage(OUTPUT_WIDTH_CHANGED),B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED);
outputHeight=new BTextControl(BRect(5,35,newPictureSize.Width()-80,20),"oHeight","Height:","",new BMessage(OUTPUT_HEIGHT_CHANGED),B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED);
//Die Maseinheiten auswahl...
BMenu *messureMenu=new BMenu("px",B_ITEMS_IN_COLUMN);
messureMenu->SetRadioMode(true);
messureMenu->SetLabelFromMarked(true);
messureMenu->AddItem(item=new BMenuItem("px",new BMessage(MESSURE_MENU_PIXEL)));
item->SetMarked(true);
messureMenu->AddItem(item=new BMenuItem("%",new BMessage(MESSURE_MENU_PERCENT)));
BMenuField *messureKind=new BMenuField(BRect(newPictureSize.Width()-40,25,newPictureSize.Width()-5,40),"messureKind",NULL,messureMenu,B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT);
BRect rect=BRect(newPictureSize.Width()-75,20,newPictureSize.Width()-45,50);
BView *tmpView = new BView(rect, "temp", B_FOLLOW_NONE, B_WILL_DRAW );
// der Verknüpfungsknop
AddChild(tmpView);
//create on picture
rgb_color back=backView->ViewColor();
//back.alpha=255;
BPicture *on;
tmpView->BeginPicture(new BPicture);
tmpView->SetHighColor(back);
tmpView->FillRect(tmpView->Bounds());
tmpView->BeginLineArray(7);
tmpView->AddLine(BPoint(0,3),BPoint(15,3),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,0),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,6),black);
tmpView->AddLine(BPoint(15,3),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,24),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,30),black);
tmpView->EndLineArray();
on = tmpView->EndPicture();
//create off picture
BPicture *off;
tmpView->BeginPicture(new BPicture);
tmpView->SetHighColor(back);
tmpView->FillRect(tmpView->Bounds());
tmpView->BeginLineArray(8);
tmpView->AddLine(BPoint(0,3),BPoint(15,3),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,0),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,6),black);
tmpView->AddLine(BPoint(15,3),BPoint(15,10),black);
tmpView->AddLine(BPoint(15,20),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,24),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,30),black);
tmpView->EndLineArray();
tmpView->SetPenSize(1.5);
tmpView->SetHighColor(red);
tmpView->StrokeArc(BPoint(15,7),4,2,180,180);
tmpView->StrokeArc(BPoint(15,23),4,2,0,180);
off = tmpView->EndPicture();
//get rid of tmpView
RemoveChild(tmpView);
delete tmpView;
depent = new BPictureButton(rect,"concate", on, off, NULL,B_TWO_STATE_BUTTON,B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT);
newPictureSizeView->AddChild(outputHeight);
newPictureSizeView->AddChild(outputWidth);
newPictureSizeView->AddChild(depent);
newPictureSizeView->AddChild(messureKind);
backView->AddChild(newPictureSizeView);
// BButton *testButton=new BButton(BRect(10,Bounds().Height()-45,70,Bounds().Height()-25),"TestButton","Test",new BMessage(TEST_REQUEST),B_FOLLOW_BOTTOM);
BButton *testButton=new BButton(BRect(Bounds().Width()-60,Bounds().Height()-45,Bounds().Width()-7,Bounds().Height()-25),"TestButton","Berechnen",new BMessage(TEST_REQUEST),B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
// BButton *speichernButton=new BButton(BRect(Bounds().Width()-70,Bounds().Height()-45,Bounds().Width()-10,Bounds().Height()-25),"SaveButton","Save",new BMessage(TEST_REQUEST),B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
backView->AddChild(testButton);
// backView->AddChild(speichernButton);
//---Neue Größe View---
pluginWindow=NULL;
LoadPlugins();
}