public override void Initialize(object config, string outPath) { m_config = (fcAPI.fcGifConfig)config; m_config.numColors = Mathf.Clamp(m_config.numColors, 1, 256); m_ctx = fcAPI.fcGifCreateContext(ref m_config); var path = outPath + ".gif"; m_ostream = fcAPI.fcCreateFileStream(path); fcAPI.fcGifAddOutputStream(m_ctx, m_ostream); }
public override void Initialize(MovieRecorder recorder) { m_numVideoFrames = 0; m_config = recorder.gifConfig; fcAPI.fcGifConfig gifconf = fcAPI.fcGifConfig.default_value; gifconf.width = recorder.scratchBuffer.width; gifconf.height = recorder.scratchBuffer.height; gifconf.num_colors = Mathf.Clamp(m_config.numColors, 1, 256); gifconf.max_active_tasks = 0; m_ctx = fcAPI.fcGifCreateContext(ref gifconf); var path = recorder.outputDir.GetFullPath() + "/" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".gif"; m_ostream = fcAPI.fcCreateFileStream(path); fcAPI.fcGifAddOutputStream(m_ctx, m_ostream); }
public override void Initialize(object config, string outPath) { if (!fcAPI.fcGifIsSupported()) { Debug.LogError("Gif encoder is not available on this platform."); return; } m_config = (fcAPI.fcGifConfig)config; m_config.numColors = Mathf.Clamp(m_config.numColors, 1, 256); m_ctx = fcAPI.fcGifCreateContext(ref m_config); var path = outPath + ".gif"; var stream = fcAPI.fcCreateFileStream(path); fcAPI.fcGifAddOutputStream(m_ctx, stream); stream.Release(); }