Ejemplo n.º 1
0
        public void draw(RenderingMode mode)
        {
            if (mode == RenderingMode.Select)
            {
                GL.LoadName(ID);
            }

            //GL.PushMatrix();

            Drawing.drawQuadRounded(position, width, height, 4, 10, false, Color.lightGray);
            Drawing.drawQuadRounded(position, width, height, 1, 10, true, secondColor);
            Drawing.drawQuadRounded(position, width, headerHeight, 1, 10, true, mainColor);
            Drawing.drawQuad(position + new Vector(0, 10), width, headerHeight - 10, 1, true, mainColor);
            Drawing.drawText(position, Vector.zero , new Vector(1, 1), 0, width -10, headerHeight, headerText, textColor, 12, font);
            Drawing.drawText(position + new Vector(0, headerHeight), Vector.zero, new Vector(1, 1), 0, width - 10, height - headerHeight - 5, text, textColor, 12, font);

            for (int i = 0; i < input.Count; i++)
            {
                input[i].draw(mode, new Vector(10 + i * (input[i].width + 5), -input[i].height));
            }

            for (int i = 0; i < output.Count; i++)
            {
                output[i].draw(mode, new Vector(10 + i * (output[i].width + 5), height));
            }

            //GL.PopMatrix();
        }
Ejemplo n.º 2
0
        private static Dictionary<string, string> GetMetricRenderingContextValues(MetricBase metricBase, int depth, RenderingMode renderingMode, bool open)
        {
            var contextValues = new Dictionary<string, string>
                                   {
                                       { "MetricInstanceSetType", string.IsNullOrEmpty(metricBase.DomainEntityType) ? "" : metricBase.DomainEntityType.Replace(" ","") },
                                       { "MetricType", metricBase.MetricType.ToString() },
                                       { "Depth", "Level" + depth.ToString(CultureInfo.InvariantCulture) },
                                       { "Enabled", metricBase.Enabled.ToString(CultureInfo.InvariantCulture).ToLower() },
                                       { "GrandParentMetricId", metricBase.Parent==null || metricBase.Parent.Parent==null ? string.Empty : metricBase.Parent.Parent.MetricId.ToString(CultureInfo.InvariantCulture) },
                                       { "ParentMetricId", metricBase.Parent==null ? string.Empty : metricBase.Parent.MetricId.ToString(CultureInfo.InvariantCulture) },
                                       { "MetricId", metricBase.MetricId.ToString(CultureInfo.InvariantCulture) },
                                       { "ParentMetricVariantId", metricBase.Parent==null ? string.Empty : metricBase.Parent.MetricVariantId.ToString(CultureInfo.InvariantCulture) },
                                       { "MetricVariantId", metricBase.MetricVariantId.ToString(CultureInfo.InvariantCulture) },
                                       { "RenderingMode", renderingMode.ToString() },
                                       { "NullValue", AllGranularDescendantsHaveNullValues(metricBase)},
                                       { "MetricVariantType", metricBase.MetricVariantType.ToString() },
                                       { "Open", open.ToString(CultureInfo.InvariantCulture).ToLower() },
                                       // Note: We may want to introduce an extensibility point here to populate domain-specific values into the rendering context to allow for template overriding based on domain values
                                       //{ "LocalEducationAgencyId", "" },
                                       //{ "SchoolId","" },
                                       //{ "StudentUSI", "" },
                                   };

            return contextValues;
        }
Ejemplo n.º 3
0
        private IEnumerable<IRenderingJob> CreateRenderingJobs(FileSystemInfo inputPath,
                                                           IBatchRenderingOptions inputOutputInfo,
                                                           RenderingMode? mode)
        {
            IEnumerable<IRenderingJob> output;

              if(inputPath != null && (inputPath is FileInfo))
              {
            output = new [] { CreateRenderingJob((FileInfo) inputPath, mode, inputPath.GetParentDirectory()) };
              }
              else if(inputPath != null && (inputPath is DirectoryInfo))
              {
            var dir = (DirectoryInfo) inputPath;

            output = (from file in dir.GetFiles(inputOutputInfo.InputSearchPattern, SearchOption.AllDirectories)
                  where  !inputOutputInfo.IgnoredPaths.Any(x => file.IsChildOf(x))
                  select CreateRenderingJob(file, mode, dir));
              }
              else
              {
            output = new IRenderingJob[0];
              }

              return output;
        }
Ejemplo n.º 4
0
        public static void RenderMetrics(this HtmlHelper<object> helper, MetricBase metric, RenderingMode renderingMode)
        {
            var renderer = (AspNetMvcMetricRenderer) IoC.Resolve<IMetricRenderer>();
            renderer.Html = helper;

            var engine = IoC.Resolve<IMetricRenderingEngine>();
            engine.RenderMetrics(metric, renderingMode, renderer, helper.ViewData);
        }
        protected override void EstablishContext()
        {
            metricTemplateBinder.Setup(x => x.GetTemplateName(It.IsAny<Dictionary<string, string>>())).Callback<Dictionary<string, string>>(x => postedContextValues.Add(x)).Returns("template name");
            metricRenderer.Setup(x => x.Render(It.IsAny<String>(), It.IsAny<MetricBase>(), It.IsAny<int>(), It.IsAny<IDictionary<string, object>>())).Callback((string templateName, object mb, int depth, IDictionary<string, object> dictionary) => postedMetricRenderingValues.Add(new MetricRenderingParameters { TemplateName = templateName, MetricBase = (MetricBase)mb, Depth = depth }));

            metricBase = GetSuppliedMetricBase();

            metricRenderingContextProvider.Setup(x => x.ProvideContext(It.IsAny<MetricBase>(), It.IsAny<IDictionary<string, object>>())).Callback((MetricBase m, IDictionary<string, object> d) => contextDictionary["AggregateMetricId"] = m.MetricId);
            rootMetric = (ContainerMetric) metricBase;

            suppliedRenderingMode = RenderingMode.Overview;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the rendering jobs from the batch rendering options.
        /// </summary>
        /// <returns>The rendering jobs.</returns>
        /// <param name="inputOutputInfo">Input output info.</param>
        /// <param name="mode">Mode.</param>
        public IEnumerable<IRenderingJob> GetRenderingJobs(IBatchRenderingOptions inputOutputInfo,
                                                       RenderingMode? mode)
        {
            IEnumerable<IRenderingJob> output;

              if(inputOutputInfo.InputStream != null)
              {
            output = ReadFromStream(inputOutputInfo.InputStream, mode);
              }
              else
              {
            output = ReadFromInputPaths(inputOutputInfo, mode);
              }

              return output;
        }
Ejemplo n.º 7
0
        public void GetRenderingJobs_uses_correct_rendering_mode_for_streams(RenderingMode? inputMode,
                                                                         RenderingMode expectedMode)
        {
            // Arrange
              _docFactory
            .Setup(x => x.CreateDocument(It.IsAny<Stream>(), expectedMode, null, null))
            .Returns(Mock.Of<IZptDocument>());
              var options = Mock.Of<IBatchRenderingOptions>(x => x.InputStream == Mock.Of<Stream>());

              // Act
              var result = _sut.GetRenderingJobs(options, inputMode);
              var job = result.Single();
              job.GetDocument();

              // Assert
              _docFactory.Verify(x => x.CreateDocument(It.IsAny<Stream>(), expectedMode, null, null), Times.Once());
        }
Ejemplo n.º 8
0
        private IEngine CreateEngine()
        {
            string[] arguments = Environment.GetCommandLineArgs();
            RenderingMode = RenderingMode.HardwareAccelerated;
            if (arguments.FirstOrDefault(arg => arg.ToLower().Contains("lightweight")) != null)
            {
                RenderingMode = RenderingMode.OffScreen;
            }
            if (arguments.FirstOrDefault(arg => arg.ToLower().Contains("enable-file-log")) != null)
            {
                LoggerProvider.Instance.Level = SourceLevels.Verbose;
                LoggerProvider.Instance.FileLoggingEnabled = true;
                string logFile = $"DotNetBrowser-WinForms-{Guid.NewGuid()}.log";
                LoggerProvider.Instance.OutputFile = Path.GetFullPath(logFile);
            }

            try
            {
                IEngine engine = EngineFactory.Create(new EngineOptions.Builder
                {
                    RenderingMode = RenderingMode
                }.Build());
                engine.Downloads.StartDownloadHandler = new DefaultStartDownloadHandler(this);
                engine.Network.AuthenticateHandler    = new DefaultAuthenticationHandler(this);
                engine.Disposed += (sender, args) =>
                {
                    if (args.ExitCode != 0)
                    {
                        string message = $"The Chromium engine exit code was {args.ExitCode:x8}";
                        Trace.WriteLine(message);
                        MessageBox.Show(message,
                                        "DotNetBrowser Warning", MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                    }
                };
                return(engine);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e);
                MessageBox.Show(e.Message, "DotNetBrowser Initialization Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(null);
            }
        }
        /// <summary>
        /// 设置材质列表
        /// </summary>
        /// <param name="valueT"></param>

        public void SetRenderingMode(RenderingMode mode)
        {
            if (matEntitys == null)
            {
                return;
            }
            foreach (StardardMaterialEntity entity in matEntitys)
            {
                Material mat = entity.mat;
                if (mat.shader.name == "Standard")
                {
                    //Debug.Log(mat.shader.name);
                    //Debug.Log(mat.renderQueue);
                    StardardShaderMatHelper.SetMaterialRenderingMode(mat, mode);
                    //mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, valueT);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Specifies that the batch options are to be built from the files found within a directory path.
        /// </summary>
        /// <returns>The output options helper.</returns>
        /// <param name="directory">The directory.</param>
        /// <param name="mode">An optional rendering mode.</param>
        /// <param name="ignoredPaths">An optional collection of ignored paths.</param>
        /// <param name="searchPattern">An optional search pattern for files within the directory.</param>
        public IBatchOptionsMultipleInputOutputHelper FromDirectory(DirectoryInfo directory, RenderingMode? mode, IEnumerable<DirectoryInfo> ignoredPaths = null, string searchPattern = null)
        {
            if(directory == null)
              {
            throw new ArgumentNullException(nameof(directory));
              }
              if(mode.HasValue)
              {
            mode.Value.RequireDefinedValue(nameof(mode));
              }

              _inputPaths = new [] { directory };
              _renderingMode = mode;
              _ignoredPaths = ignoredPaths;
              _inputSearchPattern = searchPattern;

              return this;
        }
	public static void SetupMaterialWithBlendMode(Material material, RenderingMode blendMode)
	{
		switch (blendMode)
		{
		case RenderingMode.Opaque:
			material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
			material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
			material.SetInt("_ZWrite", 1);
			material.DisableKeyword("_ALPHATEST_ON");
			material.DisableKeyword("_ALPHABLEND_ON");
			material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			material.renderQueue = -1;
			break;
		case RenderingMode.Cutout:
			material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
			material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
			material.SetInt("_ZWrite", 1);
			material.EnableKeyword("_ALPHATEST_ON");
			material.DisableKeyword("_ALPHABLEND_ON");
			material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			material.renderQueue = 2450;
			break;
		case RenderingMode.Fade:
			material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
			material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
			material.SetInt("_ZWrite", 0);
			material.DisableKeyword("_ALPHATEST_ON");
			material.EnableKeyword("_ALPHABLEND_ON");
			material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			material.renderQueue = 3000;
			break;
		case RenderingMode.Transparent:
			material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
			material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
			material.SetInt("_ZWrite", 0);
			material.DisableKeyword("_ALPHATEST_ON");
			material.DisableKeyword("_ALPHABLEND_ON");
			material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
			material.renderQueue = 3000;
			break;
		}
}
Ejemplo n.º 12
0
        /// <summary>
        /// Specifies that the batch options are to be built from the files found within a directory path.
        /// </summary>
        /// <returns>The output options helper.</returns>
        /// <param name="path">The directory path.</param>
        /// <param name="mode">An optional rendering mode.</param>
        /// <param name="ignoredPaths">An optional collection of ignored paths.</param>
        /// <param name="searchPattern">An optional search pattern for files within the directory.</param>
        public IBatchOptionsMultipleInputOutputHelper FromDirectory(string path, RenderingMode? mode, IEnumerable<string> ignoredPaths = null, string searchPattern = null)
        {
            if(path == null)
              {
            throw new ArgumentNullException(nameof(path));
              }

              var directory = new DirectoryInfo(path);

              IEnumerable<DirectoryInfo> ignoredDirectories;
              if(ignoredPaths != null)
              {
            ignoredDirectories = ignoredPaths.Select(x => new DirectoryInfo(x));
              }
              else
              {
            ignoredDirectories = null;
              }

              return FromDirectory(directory, mode, ignoredDirectories, searchPattern);
        }
        /// <summary>
        /// 设置材质列表
        /// </summary>
        /// <param name="valueT"></param>

        public void SetRenderingMode(RenderingMode mode, Color colorT, bool isClearMainTexture)
        {
            if (matEntitys == null)
            {
                return;
            }
            foreach (StardardMaterialEntity entity in matEntitys)
            {
                Material mat = entity.mat;
                if (mat.shader.name == "Standard")
                {
                    //Debug.Log(mat.shader.name);
                    //Debug.Log(mat.renderQueue);
                    StardardShaderMatHelper.SetMaterialRenderingMode(mat, mode);
                    mat.color = colorT;
                    if (isClearMainTexture)
                    {
                        ClearMainTexture(mat);
                    }
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CSF.Zpt.BatchRendering.BatchRenderingOptions"/> class.
        /// </summary>
        /// <param name="inputStream">Input stream.</param>
        /// <param name="outputStream">Output stream.</param>
        /// <param name="inputPaths">Input paths.</param>
        /// <param name="outputPath">Output path.</param>
        /// <param name="inputSearchPattern">Input search pattern.</param>
        /// <param name="outputExtensionOverride">Output extension override.</param>
        /// <param name="ignoredPaths">Ignored paths.</param>
        /// <param name="renderingMode">The rendering mode override.</param>
        public BatchRenderingOptions(Stream inputStream = null,
                                  Stream outputStream = null,
                                  IEnumerable<FileSystemInfo> inputPaths = null,
                                  FileSystemInfo outputPath = null,
                                  string inputSearchPattern = null,
                                  string outputExtensionOverride = null,
                                  IEnumerable<DirectoryInfo> ignoredPaths = null,
                                  RenderingMode? renderingMode = null)
        {
            if(renderingMode.HasValue)
              {
            renderingMode.Value.RequireDefinedValue(nameof(renderingMode));
              }

              this.InputStream = inputStream;
              this.InputPaths = inputPaths?? new FileSystemInfo[0];
              this.IgnoredPaths = ignoredPaths;
              this.InputSearchPattern = inputSearchPattern?? DEFAULT_SEARCH_PATTERN;
              this.RenderingMode = renderingMode;

              this.OutputStream = outputStream;
              this.OutputPath = outputPath;
              this.OutputExtensionOverride = outputExtensionOverride;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Calls after the rendering mode is set at runtime.
        /// </summary>
        void OnRenderingModeChanged()
        {
            switch (this.RenderingMode)
            {
            case StereoRenderingMode.Stereo:
                this.mainCamera.enabled = false;
                this.mainCamera.tag     = "Untagged";
                this.mainCamera.SetCameraFov(this.hFov, this.vFov);
                this.leftEye.gameObject.SetActive(true);
                this.leftEye.tag = "MainCamera";
                this.rightEye.gameObject.SetActive(true);
                break;

            case StereoRenderingMode.Single:
                this.mainCamera.enabled = true;
                this.mainCamera.tag     = "MainCamera";
                this.mainCamera.ResetProjectionMatrix();
                this.leftEye.gameObject.SetActive(false);
                this.leftEye.tag = "Untagged";
                this.rightEye.gameObject.SetActive(false);
                break;
            }
            Debug.LogFormat("Rendering mode => {0}", RenderingMode.ToString());
        }
Ejemplo n.º 16
0
        private void RenderMetrics(MetricBase metricBase, RenderingMode renderingMode, IMetricRenderer renderer, int depth, IDictionary<string, object> viewData)
        {
            try
            {
                var renderingContextValues = GetMetricRenderingContextValues(metricBase, depth, renderingMode, true);
                renderer.Render(metricTemplateBinder.GetTemplateName(renderingContextValues), metricBase, depth, viewData);
                var containerMetric = metricBase as ContainerMetric;
                if (containerMetric != null)
                {
                    foreach (var child in containerMetric.Children)
                    {
                        metricRenderingContextProvider.ProvideContext(child, viewData);

                        RenderMetrics(child, renderingMode, renderer, depth + 1, viewData);
                    }
                }
                renderingContextValues = GetMetricRenderingContextValues(metricBase, depth, renderingMode, false);
                renderer.Render(metricTemplateBinder.GetTemplateName(renderingContextValues), metricBase, depth, viewData);
            }
            catch (Exception ex)
            {
				throw new InvalidOperationException(string.Format("Failed to render metricId:{0}  metricVariantId:{1}  name:{2}", metricBase.MetricId, metricBase.MetricVariantId, metricBase.Name), ex);
            }
        }
Ejemplo n.º 17
0
    static void SetRenderingMode(Material material, RenderingMode renderingMode)
    {
        switch (renderingMode)
        {
        case RenderingMode.Opaque:
            material.SetOverrideTag("RenderType", "Opaque");
            material.SetOverrideTag("Queue", "Geometry");
            material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Geometry;
            material.SetInt("_BlendA", (int)UnityEngine.Rendering.BlendMode.One);
            material.SetInt("_BlendB", (int)UnityEngine.Rendering.BlendMode.Zero);
            return;

        case RenderingMode.Transparent:
            material.SetOverrideTag("RenderType", "Transparent");
            material.SetOverrideTag("Queue", "Transparent");
            material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
            material.SetInt("_BlendA", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
            material.SetInt("_BlendB", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
            return;

        default:
            throw new Exception();
        }
    }
Ejemplo n.º 18
0
		internal static extern int glRenderMode(RenderingMode mode);
Ejemplo n.º 19
0
        /// <summary>
        /// Creates a document from the given source file.
        /// </summary>
        /// <param name="sourceFile">The source file containing the document to create.</param>
        /// <param name="encoding">The text encoding to use in reading the source file.</param>
        /// <param name="renderingMode">The rendering mode to use in creating the output document.</param>
        public IZptDocument CreateDocument(FileInfo sourceFile,
                                       Encoding encoding,
                                       RenderingMode? renderingMode)
        {
            if(sourceFile == null)
              {
            throw new ArgumentNullException(nameof(sourceFile));
              }
              if(renderingMode.HasValue && !renderingMode.Value.IsDefinedValue())
              {
            throw new ArgumentException(Resources.ExceptionMessages.InvalidRenderingMode, nameof(renderingMode));
              }

              RenderingMode actualMode;

              if(!renderingMode.HasValue)
              {
            bool detectionSuccess = TryDetectMode(sourceFile, out actualMode);
            if(!detectionSuccess)
            {
              var message = String.Format(Resources.ExceptionMessages.UnsupportedDocumentFilenameExtension,
                                      sourceFile.FullName);
              throw new ArgumentException(message, nameof(sourceFile));
            }
              }
              else
              {
            actualMode = renderingMode.Value;
              }

              encoding = encoding?? DefaultEncoding;
              var provider = SelectProvider(actualMode);

              return CreateDocument(provider, sourceFile, encoding);
        }
Ejemplo n.º 20
0
        private IZptDocumentProvider SelectProvider(RenderingMode mode)
        {
            IZptDocumentProvider output;

              switch(mode)
              {
              case RenderingMode.Html:
            output = _providers.GetDefaultHtmlProvider();
            break;

              case RenderingMode.Xml:
            output = _providers.GetDefaultXmlProvider();
            break;

              default:
            throw new ArgumentException("Rendering mode must be a concrete implementation", nameof(mode));
              }

              return output;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Gets a value indicating the <see cref="RenderingMode"/> detected for a given source file.
        /// </summary>
        /// <returns><c>true</c> if the <see cref="RenderingMode"/> could be auto-detected; <c>false</c> if not.</returns>
        /// <param name="sourceFile">The source file.</param>
        /// <param name="detectedMode">Exposes the detected rendering mode.</param>
        public bool TryDetectMode(FileInfo sourceFile, out RenderingMode detectedMode)
        {
            if(sourceFile == null)
              {
            throw new ArgumentNullException(nameof(sourceFile));
              }

              bool output;
              string extension = sourceFile.Extension;

              if(HtmlSuffixes.Contains(extension))
              {
            output = true;
            detectedMode = RenderingMode.Html;
              }
              else if(XmlSuffixes.Contains(sourceFile.Extension))
              {
            output = true;
            detectedMode = RenderingMode.Xml;
              }
              else
              {
            output = false;
            detectedMode = (RenderingMode) (-1);
              }

              return output;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Creates a template file from the given source file.
 /// </summary>
 /// <param name="sourceFile">The source file containing the document to create.</param>
 /// <param name="encoding">The text encoding to use in reading the source file.</param>
 /// <param name="renderingMode">The rendering mode to use in creating the output document.</param>
 public Tales.TemplateFile CreateTemplateFile(FileInfo sourceFile,
                                          Encoding encoding,
                                          RenderingMode? renderingMode)
 {
     var document = this.CreateDocument(sourceFile, encoding, renderingMode);
       return CreateTemplateFile(document);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Creates a document from the given source stream.
        /// </summary>
        /// <param name="source">The stream containing the document to create.</param>
        /// <param name="renderingMode">The rendering mode to use in creating the output document.</param>
        /// <param name="sourceInfo">Optional information about the source of the document.</param>
        /// <param name="encoding">The text encoding to use in reading the source file.</param>
        public IZptDocument CreateDocument(Stream source,
                                       RenderingMode renderingMode,
                                       ISourceInfo sourceInfo = null,
                                       Encoding encoding = null)
        {
            if(source == null)
              {
            throw new ArgumentNullException(nameof(source));
              }
              if(!renderingMode.IsDefinedValue())
              {
            throw new ArgumentException(Resources.ExceptionMessages.InvalidRenderingMode, nameof(renderingMode));
              }

              encoding = encoding?? DefaultEncoding;
              sourceInfo = sourceInfo?? UnknownSourceFileInfo.Instance;
              var provider = SelectProvider(renderingMode);

              return CreateDocument(provider, source, sourceInfo, encoding);
        }
Ejemplo n.º 24
0
        public RenderingMode RenderMode(RenderingMode mode)
        {
            int retValue = gl.glRenderMode((int)mode);
            CheckException();

            return (RenderingMode)retValue;
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Specifies that the batch options are to be built from a collection of input files.
        /// </summary>
        /// <returns>The output options helper.</returns>
        /// <param name="files">The files.</param>
        /// <param name="mode">An optional rendering mode.</param>
        public IBatchOptionsMultipleInputOutputHelper FromFiles(IEnumerable<FileInfo> files, RenderingMode? mode)
        {
            if(files == null)
              {
            throw new ArgumentNullException(nameof(files));
              }
              if(mode.HasValue)
              {
            mode.Value.RequireDefinedValue(nameof(mode));
              }

              _inputPaths = files;
              _renderingMode = mode;

              return this;
        }
Ejemplo n.º 26
0
 internal virtual void draw(RenderingMode mode)
 {
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Creates a glyph run analysis object, which encapsulates information used to render a glyph run.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="glyphRun">A structure that contains the properties of the glyph run (font face, advances, and so on).</param>
 /// <param name="pixelsPerDip">Number of physical pixels per DIP (device independent pixel). For example, if rendering onto a 96 DPI bitmap then pixelsPerDip is 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 1.25.</param>
 /// <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified the emSize and pixelsPerDip.</param>
 /// <param name="renderingMode">A value that specifies the rendering mode, which must be one of the raster rendering modes (that is, not default and not outline).</param>
 /// <param name="measuringMode">Specifies the measuring mode to use with glyphs.</param>
 /// <param name="baselineOriginX">The horizontal position (X-coordinate) of the baseline origin, in DIPs.</param>
 /// <param name="baselineOriginY">Vertical position (Y-coordinate) of the baseline origin, in DIPs.</param>
 /// <remarks>
 /// The glyph run analysis object contains the results of analyzing the glyph run, including the positions of all the glyphs and references to all of the rasterized glyphs in the font cache.
 /// </remarks>
 /// <unmanaged>HRESULT IDWriteFactory::CreateGlyphRunAnalysis([In] const DWRITE_GLYPH_RUN* glyphRun,[None] float pixelsPerDip,[In, Optional] const DWRITE_MATRIX* transform,[None] DWRITE_RENDERING_MODE renderingMode,[None] DWRITE_MEASURING_MODE measuringMode,[None] float baselineOriginX,[None] float baselineOriginY,[Out] IDWriteGlyphRunAnalysis** glyphRunAnalysis)</unmanaged>
 public GlyphRunAnalysis(Factory factory, GlyphRun glyphRun, float pixelsPerDip, RawMatrix3x2? transform, RenderingMode renderingMode, MeasuringMode measuringMode, float baselineOriginX, float baselineOriginY)
 {
     factory.CreateGlyphRunAnalysis(glyphRun, pixelsPerDip, transform, renderingMode, measuringMode, baselineOriginX, baselineOriginY, this);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Creates a glyph run analysis object, which encapsulates information used to render a glyph run.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="glyphRun">A structure that contains the properties of the glyph run (font face, advances, and so on).</param>
 /// <param name="pixelsPerDip">Number of physical pixels per DIP (device independent pixel). For example, if rendering onto a 96 DPI bitmap then pixelsPerDip is 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 1.25.</param>
 /// <param name="renderingMode">A value that specifies the rendering mode, which must be one of the raster rendering modes (that is, not default and not outline).</param>
 /// <param name="measuringMode">Specifies the measuring mode to use with glyphs.</param>
 /// <param name="baselineOriginX">The horizontal position (X-coordinate) of the baseline origin, in DIPs.</param>
 /// <param name="baselineOriginY">Vertical position (Y-coordinate) of the baseline origin, in DIPs.</param>
 /// <remarks>
 /// The glyph run analysis object contains the results of analyzing the glyph run, including the positions of all the glyphs and references to all of the rasterized glyphs in the font cache.
 /// </remarks>
 /// <unmanaged>HRESULT IDWriteFactory::CreateGlyphRunAnalysis([In] const DWRITE_GLYPH_RUN* glyphRun,[None] float pixelsPerDip,[In, Optional] const DWRITE_MATRIX* transform,[None] DWRITE_RENDERING_MODE renderingMode,[None] DWRITE_MEASURING_MODE measuringMode,[None] float baselineOriginX,[None] float baselineOriginY,[Out] IDWriteGlyphRunAnalysis** glyphRunAnalysis)</unmanaged>
 public GlyphRunAnalysis(Factory factory, GlyphRun glyphRun, float pixelsPerDip, RenderingMode renderingMode, MeasuringMode measuringMode, float baselineOriginX, float baselineOriginY)
     : this(factory, glyphRun, pixelsPerDip, null, renderingMode, measuringMode, baselineOriginX, baselineOriginY)
 {
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Specifies that the batch options are to be built from a <c>System.IO.Stream</c>.
        /// </summary>
        /// <returns>The output options helper.</returns>
        /// <param name="stream">The stream.</param>
        /// <param name="mode">The rendering mode.</param>
        public IBatchOptionsSingleInputOutputHelper FromStream(Stream stream, RenderingMode mode)
        {
            if(stream == null)
              {
            throw new ArgumentNullException(nameof(stream));
              }
              mode.RequireDefinedValue(nameof(mode));

              _inputStream = stream;
              _renderingMode = mode;

              return this;
        }
Ejemplo n.º 30
0
        public void TryDetectMode_returns_expected_result(string filename, bool expectedResult, RenderingMode expectedMode)
        {
            // Arrange
              RenderingMode actualMode;
              var file = new FileInfo(filename);

              // Act
              bool result = _sut.TryDetectMode(file, out actualMode);

              // Assert
              Assert.AreEqual(expectedResult, result, "Correct result");
              if(expectedResult)
              {
            Assert.AreEqual(expectedMode, actualMode, "Detected mode");
              }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Gets the rendering jobs from the rendering job factory.
 /// </summary>
 /// <returns>The rendering jobs.</returns>
 /// <param name="options">Batch rendering options.</param>
 /// <param name="mode">An optional rendering mode override.</param>
 protected virtual IEnumerable<IRenderingJob> GetRenderingJobs(IBatchRenderingOptions options, RenderingMode? mode)
 {
     return _jobFactory.GetRenderingJobs(options, mode);
 }
Ejemplo n.º 32
0
 /// <summary>	
 /// Creates a rendering parameters object with the specified properties. 	
 /// </summary>	
 /// <param name="factory">A reference to a DirectWrite factory <see cref="Factory"/></param>
 /// <param name="gamma">The gamma level to be set for the new rendering parameters object. </param>
 /// <param name="enhancedContrast">The enhanced contrast level to be set for the new rendering parameters object. </param>
 /// <param name="clearTypeLevel">The ClearType level to be set for the new rendering parameters object. </param>
 /// <param name="pixelGeometry">Represents the internal structure of a device pixel (that is, the physical arrangement of red, green, and blue color components) that is assumed for purposes of rendering text. </param>
 /// <param name="renderingMode">A value that represents the method (for example, ClearType natural quality) for rendering glyphs. </param>
 /// <unmanaged>HRESULT IDWriteFactory::CreateCustomRenderingParams([None] float gamma,[None] float enhancedContrast,[None] float clearTypeLevel,[None] DWRITE_PIXEL_GEOMETRY pixelGeometry,[None] DWRITE_RENDERING_MODE renderingMode,[Out] IDWriteRenderingParams** renderingParams)</unmanaged>
 public RenderingParams(Factory factory, float gamma, float enhancedContrast, float clearTypeLevel, PixelGeometry pixelGeometry, RenderingMode renderingMode)
 {
     factory.CreateCustomRenderingParams(gamma, enhancedContrast, clearTypeLevel, pixelGeometry, renderingMode, this);
 }
Ejemplo n.º 33
0
 public static RenderingMode RenderMode(RenderingMode mode)
 {
     int retValue = gl.glRenderMode((int)mode);
     return (RenderingMode)retValue;
 }
Ejemplo n.º 34
0
		public static Int32 RenderMode(RenderingMode mode)
		{
			Int32 retValue;

			Debug.Assert(Delegates.pglRenderMode != null, "pglRenderMode not implemented");
			retValue = Delegates.pglRenderMode((Int32)mode);
			CallLog("glRenderMode({0}) = {1}", mode, retValue);
			DebugCheckErrors();

			return (retValue);
		}
Ejemplo n.º 35
0
 internal void SetRenderingMode(RenderingMode mode)
 {
     if (RenderingMode.Speed == mode)
     {
         this.m_graphics.SmoothingMode = SmoothingMode.HighSpeed;
     }
     else if (RenderingMode.Quality == mode)
     {
         this.m_graphics.SmoothingMode = SmoothingMode.HighQuality;
     }
     else
     {
         string message = string.Format("Invalid rendering mode = {0}", mode);
         throw new ArgumentException(message, "mode");
     }
 }