Beispiel #1
0
 VectorFxGadget(FxGadgetController *controller, const TPointParamP &pa,
                const TPointParamP &pb)
     : FxGadget(controller), m_pa(pa), m_pb(pb), m_selected(0) {
   addParam(pa->getX());
   addParam(pa->getY());
   addParam(pb->getX());
   addParam(pb->getY());
 }
QList<TPointD> TToneCurveParam::getValue(double frame) const {
  int i;
  QList<TPointD> points;
  for (i = 0; i < getCurrentParamSet()->getParamCount(); i++) {
    TPointParamP pointParam = getCurrentParamSet()->getParam(i);
    points.push_back(pointParam->getValue(frame));
  }
  return points;
}
Beispiel #3
0
 RectFxGadget(FxGadgetController *controller, const TDoubleParamP &width,
              const TDoubleParamP &height, const TPointParamP &center)
     : FxGadget(controller)
     , m_width(width)
     , m_height(height)
     , m_center(center)
     , m_picked(None) {
   addParam(width);
   addParam(height);
   if (center) addParam(center->getX()), addParam(center->getY());
 }
void TToneCurveParam::setValue(double frame, const QList<TPointD> &value,
                               bool undoing) {
  if (value.size() == 0) return;
  int paramCount = getCurrentParamSet()->getParamCount();
  assert(paramCount == value.size());
  int i = 0;
  for (i = 0; i < paramCount; i++) {
    TPointParamP param = getCurrentParamSet()->getParam(i);
    TPointD point      = value.at(i);
    param->setValue(frame, point);
  }
}
void TToneCurveParam::setDefaultValue(const QList<TPointD> &value) {
  int pointCount = value.size();
  if (pointCount == 0) return;

  int paramCount = getCurrentParamSet()->getParamCount();
  assert(paramCount == pointCount);

  int i;
  for (i = 0; i < pointCount; i++) {
    TPointParamP param = getCurrentParamSet()->getParam(i);
    TPointD paramPoint(param->getValue(0));
    TPointD strokePoint(value.at(i));
    param->setDefaultValue(strokePoint);
  }
  m_isLinear->setDefaultValue(false);
}
Beispiel #6
0
 QuadFxGadget(FxGadgetController *controller, const TPointParamP &pa,
              const TPointParamP &pb, const TPointParamP &pc,
              const TPointParamP &pd)
     : FxGadget(controller), m_pa(pa), m_pb(pb), m_pc(pc), m_pd(pd) {
   addParam(pa->getX());
   addParam(pa->getY());
   addParam(pb->getX());
   addParam(pb->getY());
   addParam(pc->getX());
   addParam(pc->getY());
   addParam(pd->getX());
   addParam(pd->getY());
 }
Beispiel #7
0
 PointFxGadget(FxGadgetController *controller, const TPointParamP &param)
     : FxGadget(controller), m_xParam(param->getX()), m_yParam(param->getY()) {
   addParam(m_xParam);
   addParam(m_yParam);
 }
Beispiel #8
0
void FxGadget::setValue(const TPointParamP &param, const TPointD &pos) {
  param->setValue(m_controller->getCurrentFrame(), pos);
}
Beispiel #9
0
TPointD FxGadget::getValue(const TPointParamP &param) const {
  return param->getValue(m_controller->getCurrentFrame());
}
void FreeDistortBaseFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri)
{
	if (!m_input.isConnected())
		return;

	//Upon deactivation, this fx does nothing.
	if (m_deactivate->getValue()) {
		m_input->compute(tile, frame, ri);
		return;
	}

	//Get the source quad
	TPointD p00_b = m_p00_b->getValue(frame);
	TPointD p10_b = m_p10_b->getValue(frame);
	TPointD p01_b = m_p01_b->getValue(frame);
	TPointD p11_b = m_p11_b->getValue(frame);

	//Get destination quad
	TPointD p00_a = m_p00_a->getValue(frame);
	TPointD p10_a = m_p10_a->getValue(frame);
	TPointD p01_a = m_p01_a->getValue(frame);
	TPointD p11_a = m_p11_a->getValue(frame);

	if (m_isCastShadow) {
		//Shadows are mirrored
		tswap(p00_a, p01_a);
		tswap(p10_a, p11_a);
	}

	//Get requested tile's geometry
	TRasterP tileRas(tile.getRaster());
	TRectD tileRect(convert(tileRas->getBounds()) + tile.m_pos);

	//Call transform to get the minimal rectOnInput
	TRectD inRect;
	TRenderSettings riNew;
	TRectD inBBox;

	safeTransform(frame, 0, tileRect, ri, inRect, riNew, inBBox);

	//Intersect with the bbox
	inRect *= inBBox;

	if (myIsEmpty(inRect))
		return;

	double scale = ri.m_affine.a11;

	double downBlur = m_downBlur->getValue(frame) * scale;
	double upBlur = m_upBlur->getValue(frame) * scale;
	int brad = tceil(tmax(downBlur, upBlur));

	inRect = inRect.enlarge(brad);

	TDimension inRectSize(tceil(inRect.getLx()), tceil(inRect.getLy()));

	TTile inTile;
	m_input->allocateAndCompute(inTile, inRect.getP00(), inRectSize, tileRas, frame, riNew);

	TPointD inTilePosRi = inTile.m_pos;

	//Update quads by the scale factors
	p00_b = riNew.m_affine * p00_b;
	p10_b = riNew.m_affine * p10_b;
	p01_b = riNew.m_affine * p01_b;
	p11_b = riNew.m_affine * p11_b;

	p00_a = ri.m_affine * p00_a;
	p10_a = ri.m_affine * p10_a;
	p01_a = ri.m_affine * p01_a;
	p11_a = ri.m_affine * p11_a;

	PerspectiveDistorter perpDistorter(
		p00_b - inTile.m_pos, p10_b - inTile.m_pos, p01_b - inTile.m_pos, p11_b - inTile.m_pos,
		p00_a, p10_a, p01_a, p11_a);

	BilinearDistorter bilDistorter(
		p00_b - inTile.m_pos, p10_b - inTile.m_pos, p01_b - inTile.m_pos, p11_b - inTile.m_pos,
		p00_a, p10_a, p01_a, p11_a);

	TQuadDistorter *distorter;
	if (m_distortType->getValue() == PERSPECTIVE)
		distorter = &perpDistorter;
	else if (m_distortType->getValue() == BILINEAR)
		distorter = &bilDistorter;
	else
		assert(0);

	if (m_isCastShadow) {
		TRaster32P ras32 = inTile.getRaster();
		TRaster64P ras64 = inTile.getRaster();

		if (ras32) {
			if (m_fade->getValue(frame) > 0)
				doFade(ras32, m_color->getValue(frame), m_fade->getValue(frame) / 100.0);
			if (brad > 0)
				doBlur(ras32, upBlur, downBlur,
					   m_upTransp->getValue(frame) / 100.0, m_downTransp->getValue(frame) / 100.0,
					   inBBox.y0 - inTile.m_pos.y, inBBox.y1 - inTile.m_pos.y);
			else if (m_upTransp->getValue(frame) > 0 || m_downTransp->getValue(frame) > 0)
				doTransparency(ras32, m_upTransp->getValue(frame) / 100.0, m_downTransp->getValue(frame) / 100.0,
							   inBBox.y0 - inTile.m_pos.y, inBBox.y1 - inTile.m_pos.y);
		} else if (ras64) {
			if (m_fade->getValue(frame) > 0)
				doFade(ras64, toPixel64(m_color->getValue(frame)), m_fade->getValue(frame) / 100.0);
			if (brad > 0)
				doBlur(ras64, upBlur, downBlur,
					   m_upTransp->getValue(frame) / 100.0, m_downTransp->getValue(frame) / 100.0,
					   inBBox.y0 - inTile.m_pos.y, inBBox.y1 - inTile.m_pos.y);
			else if (m_upTransp->getValue(frame) > 0 || m_downTransp->getValue(frame) > 0)
				doTransparency(ras64, m_upTransp->getValue(frame) / 100.0, m_downTransp->getValue(frame) / 100.0,
							   inBBox.y0 - inTile.m_pos.y, inBBox.y1 - inTile.m_pos.y);
		} else
			assert(false);
	}

	distort(tileRas, inTile.getRaster(), *distorter, convert(tile.m_pos), TRop::Bilinear);
}