本文整理汇总了C++中mlt::GeometryItem::frame方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryItem::frame方法的具体用法?C++ GeometryItem::frame怎么用?C++ GeometryItem::frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mlt::GeometryItem
的用法示例。
在下文中一共展示了GeometryItem::frame方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressEvent
// virtual
void KeyframeHelper::mousePressEvent(QMouseEvent * event)
{
m_hoverKeyframe = -1;
if (event->button() != Qt::LeftButton) {
QWidget::mousePressEvent(event);
return;
}
int xPos = event->x() - margin;
int headOffset = m_lineHeight / 1.5;
if (m_geom != NULL && (event->y() <= headOffset)) {
// check if we want to move a keyframe
int mousePos = qMax((int)(xPos / m_scale), 0) + m_offset;
Mlt::GeometryItem item;
if (m_geom->next_key(&item, mousePos) == 0) {
if (qAbs((item.frame() - m_offset)* m_scale - xPos) < headOffset) {
m_movingItem.x(item.x());
m_movingItem.y(item.y());
m_movingItem.w(item.w());
m_movingItem.h(item.h());
m_movingItem.mix(item.mix());
m_movingItem.frame(item.frame());
while (!m_extraMovingItems.isEmpty()) {
Mlt::GeometryItem *gitem = m_extraMovingItems.takeFirst();
if (gitem) delete gitem;
}
for (int i = 0; i < m_extraGeometries.count(); ++i) {
if (m_extraGeometries.at(i)->next_key(item, mousePos) == 0) {
Mlt::GeometryItem *item2 = new Mlt::GeometryItem();
item2->x(item.x());
item2->frame(item.frame());
m_extraMovingItems.append(item2);
} else {
m_extraMovingItems.append(NULL);
}
}
m_dragStart = event->pos();
return;
}
}
}
int seekRequest = xPos / m_scale;
if (seekRequest != m_position) {
m_seekPosition = seekRequest;
emit requestSeek(m_seekPosition);
update();
}
}
示例2: slotDeleteFrame
void Geometryval::slotDeleteFrame(int pos)
{
// check there is more than one keyframe
Mlt::GeometryItem item;
int frame = m_timePos.getValue();
if (pos == -1) pos = frame;
int error = m_geom->next_key(&item, pos + 1);
if (error) {
error = m_geom->prev_key(&item, pos - 1);
if (error || item.frame() == pos) return;
}
m_geom->remove(frame);
buttonAdd->setEnabled(true);
buttonDelete->setEnabled(false);
widget->setEnabled(false);
spinTransp->setEnabled(false);
frameOptions->setEnabled(false);
m_reset->setEnabled(false);
m_helper->update();
slotPositionChanged(pos, false);
updateTransitionPath();
emit parameterChanged();
}
示例3: slotPreviousFrame
void Geometryval::slotPreviousFrame()
{
Mlt::GeometryItem item;
int error = m_geom->prev_key(&item, m_helper->value() - 1);
kDebug() << "// SEEK TO NEXT KFR: " << error;
if (error) return;
int pos = item.frame();
m_ui.spinPos->setValue(pos);
}
示例4: slotPreviousFrame
void Geometryval::slotPreviousFrame()
{
Mlt::GeometryItem item;
int error = m_geom->prev_key(&item, m_helper->value() - 1);
//qDebug() << "// SEEK TO NEXT KFR: " << error;
if (error) return;
int pos = item.frame();
m_timePos.setValue(pos);
slotPositionChanged();
}
示例5: slotNextFrame
void Geometryval::slotNextFrame()
{
Mlt::GeometryItem item;
int error = m_geom->next_key(&item, m_helper->value() + 1);
kDebug() << "// SEEK TO NEXT KFR: " << error;
if (error) {
// Go to end
m_ui.spinPos->setValue(m_ui.spinPos->maximum());
return;
}
int pos = item.frame();
m_ui.spinPos->setValue(pos);
}
示例6: offsetAnimation
QString GeometryWidget::offsetAnimation(int offset, bool useOffset)
{
Mlt::Geometry *geometry = new Mlt::Geometry((char*)NULL, m_outPoint, m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
Mlt::GeometryItem item;
int pos = 0;
int ix = 0;
while (!m_geometry->next_key(&item, pos)) {
pos = item.frame() + 1;
item.frame(item.frame() + offset);
geometry->insert(item);
ix++;
}
m_useOffset = useOffset;
QString result = geometry->serialise();
if (!m_fixedGeom && result.contains(QStringLiteral(";")) && !result.section(QStringLiteral(";"),0,0).contains(QStringLiteral("="))) {
result.prepend("0=");
}
m_geometry->parse(result.toUtf8().data(), m_outPoint, m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
m_timeline->setKeyGeometry(m_geometry, m_inPoint, m_outPoint, m_useOffset);
delete geometry;
return result;
}
示例7: slotNextFrame
void Geometryval::slotNextFrame()
{
Mlt::GeometryItem item;
int error = m_geom->next_key(&item, m_helper->value() + 1);
int pos;
//qDebug() << "// SEEK TO NEXT KFR: " << error;
if (error) {
// Go to end
pos = m_helper->frameLength;
} else pos = item.frame();
m_timePos.setValue(pos);
slotPositionChanged();
}
示例8: slotUpdateTransitionProperties
void Geometryval::slotUpdateTransitionProperties()
{
int pos = m_timePos.getValue();
Mlt::GeometryItem item;
int error = m_geom->next_key(&item, pos);
if (error || item.frame() != pos) {
// no keyframe under cursor
return;
}
QRectF r = m_paramRect->rect().normalized();
QPointF rectpos = m_paramRect->pos();
item.x(rectpos.x() / m_dar);
item.y(rectpos.y());
item.w(r.width() / m_dar);
item.h(r.height());
m_geom->insert(item);
updateTransitionPath();
emit parameterChanged();
}
示例9: slotAddFrame
void Geometryval::slotAddFrame()
{
int pos = m_ui.spinPos->value();
Mlt::GeometryItem item;
item.frame(pos);
item.x(m_paramRect->pos().x());
item.y(m_paramRect->pos().y());
item.w(m_paramRect->rect().width());
item.h(m_paramRect->rect().height());
item.mix(m_ui.spinTransp->value());
m_geom->insert(item);
m_ui.buttonAdd->setEnabled(false);
m_ui.buttonDelete->setEnabled(true);
m_ui.widget->setEnabled(true);
m_ui.spinTransp->setEnabled(true);
m_scaleMenu->setEnabled(true);
m_alignMenu->setEnabled(true);
m_helper->update();
emit parameterChanged();
}
示例10: updateTransitionPath
void Geometryval::updateTransitionPath()
{
if (m_fixedMode) return;
Mlt::GeometryItem item;
int pos = 0;
int counter = 0;
QPainterPath path;
while (true) {
if (m_geom->next_key(&item, pos) == 1) break;
pos = item.frame();
if (counter == 0) {
path.moveTo(item.x() * m_dar + item.w() * m_dar / 2, item.y() + item.h() / 2);
} else {
path.lineTo(item.x() * m_dar + item.w() * m_dar / 2, item.y() + item.h() / 2);
}
counter++;
pos++;
}
m_path->setPath(path);
}
示例11: slotDeleteFrame
void Geometryval::slotDeleteFrame()
{
// check there is more than one keyframe
Mlt::GeometryItem item;
const int pos = m_ui.spinPos->value();
int error = m_geom->next_key(&item, pos + 1);
if (error) {
error = m_geom->prev_key(&item, pos - 1);
if (error || item.frame() == pos) return;
}
m_geom->remove(m_ui.spinPos->value());
m_ui.buttonAdd->setEnabled(true);
m_ui.buttonDelete->setEnabled(false);
m_ui.widget->setEnabled(false);
m_ui.spinTransp->setEnabled(false);
m_scaleMenu->setEnabled(false);
m_alignMenu->setEnabled(false);
m_helper->update();
slotPositionChanged(pos, false);
updateTransitionPath();
emit parameterChanged();
}
示例12: slotAddFrame
void Geometryval::slotAddFrame(int pos)
{
int frame = m_timePos.getValue();
if (pos == -1) pos = frame;
Mlt::GeometryItem item;
item.frame(pos);
QRectF r = m_paramRect->rect().normalized();
QPointF rectpos = m_paramRect->pos();
item.x(rectpos.x() / m_dar);
item.y(rectpos.y());
item.w(r.width() / m_dar);
item.h(r.height());
item.mix(spinTransp->value());
m_geom->insert(item);
buttonAdd->setEnabled(false);
buttonDelete->setEnabled(true);
widget->setEnabled(true);
spinTransp->setEnabled(true);
frameOptions->setEnabled(true);
m_reset->setEnabled(true);
m_helper->update();
emit parameterChanged();
}