Ejemplo n.º 1
0
void ColumnColorFilterFx::doCompute(TTile &tile, double frame,
                                    const TRenderSettings &ri) {
  if (!m_port.isConnected()) return;

  if (!TRaster32P(tile.getRaster()) && !TRaster64P(tile.getRaster()))
    throw TException("AffineFx unsupported pixel type");

  TRasterFxP src = m_port.getFx();
  src->compute(tile, frame, ri);

  TRop::applyColorScale(tile.getRaster(), m_colorFilter);
}
Ejemplo n.º 2
0
void TGeometryFx::doCompute(TTile &tile, double frame,
                            const TRenderSettings &ri) {
  TRasterFxPort *input = dynamic_cast<TRasterFxPort *>(getInputPort(0));
  assert(input);

  if (!input->isConnected()) return;

  if (!getActiveTimeRegion().contains(frame)) {
    TRasterFxP(input->getFx())->compute(tile, frame, ri);
    return;
  }

  if (!TRaster32P(tile.getRaster()) && !TRaster64P(tile.getRaster()))
    throw TException("AffineFx unsupported pixel type");

  TAffine aff1 = getPlacement(frame);
  TRenderSettings ri2(ri);
  ri2.m_affine = ri2.m_affine * aff1;

  TRasterFxP src = getInputPort("source")->getFx();
  src->compute(tile, frame, ri2);
  return;
}
Ejemplo n.º 3
0
void RenderCommand::flashRender()
{
	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
	TSceneProperties *sprop = scene->getProperties();
	FILE *fileP = fopen(m_fp, "wb");
	if (!fileP)
		return;
	ProgressDialog pb("rendering " + toQString(m_fp), "Cancel", 0, m_numFrames);
	pb.show();

	TDimension cameraSize = scene->getCurrentCamera()->getRes();
	double frameRate = sprop->getOutputProperties()->getFrameRate();
	TFlash flash(
		cameraSize.lx,
		cameraSize.ly,
		m_numFrames,
		frameRate,
		sprop->getOutputProperties()->getFileFormatProperties("swf"));
	flash.setBackgroundColor(sprop->getBgColor());

	std::vector<TXshSoundColumn *> columns;
	scene->getSoundColumns(columns);
	if (!columns.empty()) {
		TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();
		prop->m_frameRate = frameRate;
		TSoundTrack *st = scene->getXsheet()->makeSound(prop);
		if (st)
			flash.putSound(st, 0);
	}

	int i = 0;
	for (i = 0; i < m_numFrames; ++i, m_r += m_stepd) {
		flash.beginFrame(m_step * i + 1);
		TRasterFxP rfx = buildSceneFx(scene, m_r, 0, false);
		assert(rfx);
		rfx->compute(flash, tround(m_r)); // WARNING: This should accept a DOUBLE...
#ifdef BRAVODEMO
		TRasterImageP ri(loadBravo(scene->getCurrentCamera()->getRes()));
		int lx = ri->getRaster()->getLx();
		int ly = ri->getRaster()->getLx();
		flash.pushMatrix();
		int dx = tround(0.1 * (cameraSize.lx - lx));
		int dy = tround(0.1 * (cameraSize.ly - ly));
		flash.multMatrix(TTranslation((cameraSize.lx - lx) / 2 - (dx > 0 ? dx : 0), -(cameraSize.ly - ly) / 2 + (dy > 0 ? dy : 0)));
		flash.draw(ri, 0);
		flash.popMatrix();
#endif
		flash.endFrame(i == m_numFrames - 1, 0, true);
		if (pb.wasCanceled())
			break;
		pb.setValue(i + 1);
	}

	flash.writeMovie(fileP);
	fclose(fileP);

	TSystem::showDocument(m_fp);
	//QDesktopServices::openUrl(QUrl(toQString(m_fp)));

	TImageCache::instance()->remove(toString(m_fp.getWideString() + L".0"));
	TNotifier::instance()->notify(TSceneNameChange());
}