本文整理汇总了C++中View类的典型用法代码示例。如果您正苦于以下问题:C++ View类的具体用法?C++ View怎么用?C++ View使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onBeginDrawFrame
void TextStyle::onBeginDrawFrame(const View& _view, Scene& _scene, int _textureUnit) {
bool contextLost = Style::glContextLost();
m_fontContext->bindAtlas(0);
m_shaderProgram->setUniformf("u_uv_scale_factor",
1.0f / m_fontContext->getAtlasResolution());
if (contextLost) {
m_shaderProgram->setUniformi("u_tex", 0);
}
if (m_dirtyViewport || contextLost) {
m_shaderProgram->setUniformMatrix4f("u_ortho", glm::value_ptr(_view.getOrthoViewportMatrix()));
m_dirtyViewport = false;
}
Style::onBeginDrawFrame(_view, _scene, 1);
}
示例2: transform_pixels_locator
GIL_FORCEINLINE
F transform_pixels_locator( const View& src, const rect_t<std::ptrdiff_t>& srcRod,
const ViewDst& dst, const rect_t<std::ptrdiff_t>& dstRod,
const rect_t<std::ptrdiff_t>& renderWin, F& fun )
{
const std::ptrdiff_t renderWidth = renderWin.x2 - renderWin.x1;
typename View::xy_locator sloc = src.xy_at( renderWin.x1-srcRod.x1, renderWin.y1-srcRod.y1 );
for( std::ptrdiff_t y = renderWin.y1; y < renderWin.y2; ++y )
{
typename ViewDst::x_iterator dstIt = dst.x_at( renderWin.x1-dstRod.x1, y-dstRod.y1 );
for( std::ptrdiff_t x = renderWin.x1;
x < renderWin.x2;
++x, ++sloc.x(), ++dstIt )
{
*dstIt = fun( sloc );
}
sloc.x() -= renderWidth; ++sloc.y();
}
return fun;
}
示例3: drawCharactersFromView
void Play::drawCharactersFromView(const View& view)
{
if(!_isPlaying)
return ;
// Draw from view only if it was installed
for(const auto& v : _views)
{
if(v->id() == view.id())
{
StageTime time(_drawClock.totalSeconds(),
_drawClock.elapsedSeconds(),
_drawClock.ticksPerSecond());
DrawCaller drawCaller(v, time);
(*_currentAct)->welcome( drawCaller );
break;
}
}
}
示例4: insert_feature
double State::insert_feature(int feature_idx, vector<double> feature_data,
View& which_view) {
string col_datatype = global_col_datatypes[feature_idx];
CM_Hypers& hypers = hypers_m[feature_idx];
double crp_logp_delta, data_logp_delta;
double score_delta = calc_feature_view_predictive_logp(feature_data,
col_datatype,
which_view,
crp_logp_delta,
data_logp_delta,
hypers);
vector<int> data_global_row_indices = create_sequence(feature_data.size());
which_view.insert_col(feature_data,
data_global_row_indices, feature_idx,
hypers);
view_lookup[feature_idx] = &which_view;
column_crp_score += crp_logp_delta;
data_score += data_logp_delta;
return score_delta;
}
示例5: lock
bool LarsonSekaninaInstance::ExecuteOn( View& view )
{
AutoViewLock lock( view );
ImageVariant image = view.Image();
if ( image.IsComplexSample() )
return false;
StandardStatus status;
image.SetStatusCallback( &status );
Console().EnableAbort();
ImageVariant sharpImg;
sharpImg.CreateFloatImage( (image.BitsPerSample() > 32) ? image.BitsPerSample() : 32 );
sharpImg.AllocateImage( image->Width(), image->Height(), 1, ColorSpace::Gray );
if ( useLuminance && image->IsColor() )
{
ImageVariant L;
image.GetLightness( L );
Convolve( L, sharpImg, interpolation, radiusDiff, angleDiff, center, 0 );
ApplyFilter( L, sharpImg, amount, threshold, deringing, rangeLow, rangeHigh, false, 0, highPass );
image.SetLightness( L );
}
else
{
for ( int c = 0, n = image->NumberOfNominalChannels(); c < n; ++c )
{
image->SelectChannel( c );
if ( n > 1 )
Console().WriteLn( "<end><cbr>Processing channel #" + String( c ) );
Convolve( image, sharpImg, interpolation, radiusDiff, angleDiff, center, c );
ApplyFilter( image, sharpImg, amount, threshold, deringing, rangeLow, rangeHigh, disableExtension, c, highPass );
}
}
return true;
}
示例6: drawScene
void drawScene() {
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glViewport(0,0, width, height);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
v.setView(width, height);
if (c.isThirdPerson()) c.updateLook(m);
else c.updateLook(m.getX()+hx, m.getY()+hy, m.getZ());
if (phase == 0) introGame();
if (phase == 1) playGame();
if (phase == 2) concGame();
glutSwapBuffers();
}
示例7: pivot
void PivotPlugin::pivot()
{
View *view = dynamic_cast<View *>(parent());
if (!view) {
return;
}
if ((view->selection()->lastRange().width() < 2) || (view->selection()->lastRange().height() < 2)) {
KMessageBox::error(view->canvasWidget(), i18n("You must select multiple cells."));
return;
}
QPointer<Pivot> dialog = new Pivot(view->canvasWidget(), view->selection());
dialog->exec();
delete dialog;
}
示例8: if
View lb::operator|(View const& _a, View const& _b)
{
if (!!_a->children().size() == !!_b->children().size())
{
View ret = FrameBody::create();
_a->setParent(ret);
_b->setParent(ret);
return ret;
}
else if (_a->children().size())
{
_b->setParent(_a);
return _a;
}
else
{
_a->setParent(_b);
return _b;
}
}
示例9: transform_pixels_locator_progress
GIL_FORCEINLINE
F transform_pixels_locator_progress( const View& src, const OfxRectI& srcRod,
const ViewDst& dst, const OfxRectI& dstRod,
const OfxRectI& renderWin, const F& fun, IProgress& p )
{
const std::ptrdiff_t renderWidth = renderWin.x2 - renderWin.x1;
typename View::xy_locator sloc = src.xy_at( renderWin.x1-srcRod.x1, renderWin.y1-srcRod.y1 );
for( std::ptrdiff_t y = renderWin.y1; y < renderWin.y2; ++y )
{
typename ViewDst::x_iterator dstIt = dst.x_at( renderWin.x1-dstRod.x1, y-dstRod.y1 );
for( std::ptrdiff_t x = renderWin.x1;
x < renderWin.x2;
++x, ++sloc.x(), ++dstIt )
{
*dstIt = fun( sloc );
}
sloc.x() -= renderWidth; ++sloc.y();
if( p.progressForward( renderWidth ) )
return fun;
}
return fun;
}
示例10: region
/*!
Estimates shift of current image relative to background image.
\param [in] current - current image.
\param [in] region - a region at the background where the algorithm start to search current image. Estimated shift is taken relative of the region.
\param [in] maxShift - a 2D-point which characterizes maximal possible shift of the region (along X and Y axes).
\param [in] hiddenAreaPenalty - a parameter used to restrict searching of the shift at the border of background image.
\param [in] regionAreaMin - a parameter used to set minimal area of region use for shift estimation. By default is equal to 25.
\return a result of shift estimation.
*/
bool Estimate(const View & current, const Rect & region, const Point & maxShift, double hiddenAreaPenalty = 0, ptrdiff_t regionAreaMin = REGION_CORRELATION_AREA_MIN)
{
assert(current.Size() == region.Size() && region.Area() > 0);
assert(_current.Size() && _current[0].width >= current.width && _current[0].height >= current.height);
if (region.Area() < regionAreaMin)
return false;
InitLevels(region, maxShift, regionAreaMin);
SetCurrent(current, region);
Point shift;
for (ptrdiff_t i = _levels.size() - 1; i >= 0; i--)
{
shift.x *= 2;
shift.y *= 2;
if (!SearchLocalMin(_levels[i], shift, hiddenAreaPenalty))
return false;
shift = _levels[i].shift;
}
return true;
}
示例11: init
void init(View& view, std::vector<Sprite*>& sprites, bool val[2][WIDTH][HEIGHT]) {
int i,j;
for (i = 0; i < HEIGHT; i++) {
for (j=0; j < WIDTH;j++) {
Vector2d<float> pos(j*S_WIDTH,i*S_WIDTH);
Vector2d<float> size(S_WIDTH,S_WIDTH);
Rect<float> texCoord(0,0,S_WIDTH,S_WIDTH);
Sprite *s = view.addSprite(pos,size,"bitmap",texCoord);
Color tColor(System::rnd(10)/10.0f,System::rnd(10)/10.0f,System::rnd(10)/10.0f,1.0f);
Vector2d<float> c(2,2);
s->setRotationCenter(c);
s->setRotationAngle(45.0f);
s->setTintColor(tColor);
sprites.push_back(s);
s->hide();
val[0][j][i] = false;
if (System::rnd(7) == 0) {
val[0][j][i] = true;
}
}
}
}
示例12: renderAxes
void PoslvControl::renderAxes(View& view, const QColor& color, double length) {
Line<double, 3> l_1, l_2, l_3;
l_1[1][0] = length;
view.render(l_1, color, _T_w_i);
l_2[1][1] = length;
view.render(l_2, color, _T_w_i);
l_3[1][2] = length;
view.render(l_3, color, _T_w_i);
Eigen::Vector3d xLabelPosition = _T_w_i * l_1[1];
Eigen::Vector3d yLabelPosition = _T_w_i * l_2[1];
Eigen::Vector3d zLabelPosition = _T_w_i * l_3[1];
view.render("X", xLabelPosition, color, 0.2*length);
view.render("Y", yLabelPosition, color, 0.2*length);
view.render("Z", zLabelPosition, color, 0.2*length);
Eigen::Vector3d labelPosition = _T_w_i * Eigen::Vector3d(0, 0, length + 0.1);
view.render("poslv", labelPosition, color, 0.2 * length);
}
示例13: UpdateReadout
void BinarizeInterface::UpdateReadout( const View& v, const DPoint&, double R, double G, double B, double /*A*/ )
{
if ( GUI != 0 && IsVisible() )
{
if ( instance.isGlobal )
{
RGBColorSystem rgbws;
v.Window().GetRGBWS( rgbws );
instance.level[0] = instance.level[1] = instance.level[2] = rgbws.Lightness( R, G, B );
}
else
{
instance.level[0] = R;
instance.level[1] = G;
instance.level[2] = B;
}
UpdateControls();
if ( !RealTimePreview::IsUpdating() )
RealTimePreview::Update();
}
}
示例14: paintEvent
void SummaryDrawWidget::paintEvent( QPaintEvent * )
{
Channel *ch;
//if((right - left) <= 0) return;
View *view = gdata->view;
/* if (view->totalTime() == 0) {
buffer = new QPixmap(size());
buffer->fill(myBackgroundColor);
bitBlt(this, 0, 0, buffer); */
if(gdata->totalTime() < 0) return;
double timeRatio = double(width()) / gdata->totalTime();
double pitchRatio = double(height()) / (gdata->topPitch() / scaler);
beginDrawing();
//draw all the channels
for(int j = 0; j < (int)gdata->channels.size(); j++) {
ch = gdata->channels.at(j);
if(!ch->isVisible()) continue;
//drawChannel(ch, p, view->leftTime(), (view->totalTime() / (double) width()), 0.0f, (double) view->topNote() / (double) height(), DRAW_VIEW_SUMMARY);
drawChannel(*this, ch, p, gdata->leftTime(), view->currentTime(), (gdata->totalTime() / (double) width()), 0.0f, (double) gdata->topPitch() / (double) height(), DRAW_VIEW_SUMMARY);
}
//draw the view rectangle
p.setPen(QPen(colorGroup().highlight(), 1));
p.drawRect(int((gdata->leftTime()+view->viewLeft())*timeRatio), height()-1-int((view->viewTop())*pitchRatio),
int(view->viewWidth()*timeRatio), int(view->viewHeight()*pitchRatio));
//draw the current time line
p.setPen(QPen(colorGroup().foreground(), 1));
//p.moveTo(int((gdata->leftTime()+view->currentTime())*timeRatio), 0);
//p.lineTo(int((gdata->leftTime()+view->currentTime())*timeRatio), height()-1);
p.drawLine(int((gdata->leftTime()+view->currentTime())*timeRatio), 0,
int((gdata->leftTime()+view->currentTime())*timeRatio), height()-1);
endDrawing();
}
示例15: for_each
inline
void
for_each(
View const &_view,
Function const &_function,
MakeIterator const _make_iterator,
mizuiro::image::algorithm::uninitialized const _uninitialized
)
{
switch(
_uninitialized
)
{
case mizuiro::image::algorithm::uninitialized::yes:
mizuiro::image::algorithm::unary_iteration(
mizuiro::image::algorithm::detail::wrap_prepare<
typename
View::access,
typename
View::format
>(
_view.format_store(),
_function
),
_view,
_make_iterator
);
return;
case mizuiro::image::algorithm::uninitialized::no:
mizuiro::image::algorithm::unary_iteration(
_function,
_view,
_make_iterator
);
return;
}
}