本文整理汇总了C++中BView::SetLineMode方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::SetLineMode方法的具体用法?C++ BView::SetLineMode怎么用?C++ BView::SetLineMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::SetLineMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
status_t
CanvasMessage::ReadViewState(BView& view, ::pattern& pattern)
{
bool subPixelPrecise;
float penSize, miterLimit;
drawing_mode drawingMode;
source_alpha sourceAlpha;
alpha_function alphaFunction;
cap_mode capMode;
join_mode joinMode;
rgb_color highColor, lowColor;
Read(penSize);
Read(subPixelPrecise);
Read(drawingMode);
Read(sourceAlpha);
Read(alphaFunction);
Read(pattern);
Read(capMode);
Read(joinMode);
Read(miterLimit);
Read(highColor);
status_t result = Read(lowColor);
if (result != B_OK)
return result;
uint32 flags = view.Flags() & ~B_SUBPIXEL_PRECISE;
view.SetFlags(flags | (subPixelPrecise ? B_SUBPIXEL_PRECISE : 0));
view.SetPenSize(penSize);
view.SetDrawingMode(drawingMode);
view.SetBlendingMode(sourceAlpha, alphaFunction);
view.SetLineMode(capMode, joinMode, miterLimit);
view.SetHighColor(highColor);
view.SetLowColor(lowColor);
return B_OK;
}
示例2: reply
//.........这里部分代码省略.........
if (message.Read(color) != B_OK)
continue;
if (code == RP_SET_HIGH_COLOR)
offscreen->SetHighColor(color);
else
offscreen->SetLowColor(color);
break;
}
case RP_SET_PEN_SIZE:
{
float newPenSize;
if (message.Read(newPenSize) != B_OK)
continue;
offscreen->SetPenSize(newPenSize);
penSize = newPenSize / 2;
break;
}
case RP_SET_STROKE_MODE:
{
cap_mode capMode;
join_mode joinMode;
float miterLimit;
message.Read(capMode);
message.Read(joinMode);
if (message.Read(miterLimit) != B_OK)
continue;
offscreen->SetLineMode(capMode, joinMode, miterLimit);
break;
}
case RP_SET_BLENDING_MODE:
{
source_alpha sourceAlpha;
alpha_function alphaFunction;
message.Read(sourceAlpha);
if (message.Read(alphaFunction) != B_OK)
continue;
offscreen->SetBlendingMode(sourceAlpha, alphaFunction);
break;
}
case RP_SET_PATTERN:
{
if (message.Read(pattern) != B_OK)
continue;
break;
}
case RP_SET_DRAWING_MODE:
{
drawing_mode drawingMode;
if (message.Read(drawingMode) != B_OK)
continue;
offscreen->SetDrawingMode(drawingMode);
break;
}
示例3: _
void
ActivityView::_DrawHistory(bool drawBackground)
{
_UpdateOffscreenBitmap();
BView* view = this;
if (fOffscreen != NULL) {
fOffscreen->Lock();
view = _OffscreenView();
}
BRect frame = _HistoryFrame();
BRect outerFrame = frame.InsetByCopy(-2, -2);
// draw the outer frame
uint32 flags = 0;
if (!drawBackground)
flags |= BControlLook::B_BLEND_FRAME;
be_control_look->DrawTextControlBorder(this, outerFrame,
outerFrame, fLegendBackgroundColor, flags);
// convert to offscreen view if necessary
if (view != this)
frame.OffsetTo(B_ORIGIN);
view->SetLowColor(fHistoryBackgroundColor);
view->FillRect(frame, B_SOLID_LOW);
uint32 step = 2;
uint32 resolution = fDrawResolution;
if (fDrawResolution > 1) {
step = 1;
resolution--;
}
uint32 width = frame.IntegerWidth() - 10;
uint32 steps = width / step;
bigtime_t timeStep = RefreshInterval() * resolution;
bigtime_t now = system_time();
// Draw scale
// TODO: add second markers?
view->SetPenSize(1);
rgb_color scaleColor = view->LowColor();
uint32 average = (scaleColor.red + scaleColor.green + scaleColor.blue) / 3;
if (average < 96)
scaleColor = tint_color(scaleColor, B_LIGHTEN_2_TINT);
else
scaleColor = tint_color(scaleColor, B_DARKEN_2_TINT);
view->SetHighColor(scaleColor);
view->StrokeLine(BPoint(frame.left, frame.top + frame.Height() / 2),
BPoint(frame.right, frame.top + frame.Height() / 2));
// Draw values
view->SetPenSize(1.5);
BAutolock _(fSourcesLock);
for (uint32 i = fSources.CountItems(); i-- > 0;) {
ViewHistory* viewValues = fViewValues.ItemAt(i);
DataSource* source = fSources.ItemAt(i);
DataHistory* values = fValues.ItemAt(i);
viewValues->Update(values, steps, fDrawResolution, now, timeStep,
RefreshInterval());
uint32 x = viewValues->Start() * step;
BShape shape;
bool first = true;
for (uint32 i = viewValues->Start(); i < steps; x += step, i++) {
float y = _PositionForValue(source, values,
viewValues->ValueAt(i));
if (first) {
shape.MoveTo(BPoint(x, y));
first = false;
} else
shape.LineTo(BPoint(x, y));
}
view->SetHighColor(source->Color());
view->SetLineMode(B_BUTT_CAP, B_ROUND_JOIN);
view->MovePenTo(B_ORIGIN);
view->StrokeShape(&shape);
}
// TODO: add marks when an app started or quit
view->Sync();
if (fOffscreen != NULL) {
fOffscreen->Unlock();
DrawBitmap(fOffscreen, outerFrame.LeftTop());
}
}