/// <summary>
        /// Initializes a new instance of the <see cref="FactoryHandlerD2D"/> class.
        /// </summary>
        internal FactoryHandlerD2D(GraphicsCoreConfiguration coreConfiguration)
        {
            var factoryOptions = new D2D.FactoryOptions();

            factoryOptions.DebugLevel = coreConfiguration.DebugEnabled ? D2D.DebugLevel.Information : D2D.DebugLevel.None;

            _factory = D2D1CreateFactory <D2D.ID2D1Factory2>(
                D2D.FactoryType.SingleThreaded,
                factoryOptions);
        }
示例#2
0
 internal FactoryHandlerDXGI(GraphicsCoreConfiguration coreConfiguration)
 {
     _dxgiFactory = SeeingSharpUtil.TryExecute(() => CreateDXGIFactory2 <IDXGIFactory4>(coreConfiguration.DebugEnabled));
     if (_dxgiFactory == null)
     {
         _dxgiFactory = SeeingSharpUtil.TryExecute(() => CreateDXGIFactory2 <IDXGIFactory2>(coreConfiguration.DebugEnabled));
     }
     if (_dxgiFactory == null)
     {
         _dxgiFactory = SeeingSharpUtil.TryExecute(() => CreateDXGIFactory1 <IDXGIFactory1>());
     }
     if (_dxgiFactory == null)
     {
         throw new SeeingSharpGraphicsException("Unable to create the DXGI Factory object!");
     }
 }
        public void SimpleUpload_ColorBitmap_WrongTextureSize()
        {
            var coreConfig = new GraphicsCoreConfiguration();

            coreConfig.DebugEnabled = true;

            var testResource = new AssemblyResourceLink(
                typeof(TextureUploaderTests), "Resources.TextureUploader", "TestTexture.png");

            using (var engineFactory = new EngineFactory(coreConfig))
                using (var device = EngineDevice.CreateSoftwareDevice(engineFactory))
                    using (var colorTexture = GraphicsHelper.CreateTexture(device, testResource))
                        using (var texUploader = new TextureUploader(device, 100, 100, GraphicsHelper.Internals.DEFAULT_TEXTURE_FORMAT, true))
                            using (texUploader.UploadToMemoryMappedTexture <int>(colorTexture))
                            {
                            }
        }
        public void SimpleUpload_ColorBitmap_WrongUploadFormat()
        {
            var coreConfig = new GraphicsCoreConfiguration();

            coreConfig.DebugEnabled = true;

            var testResource = new AssemblyResourceLink(
                typeof(TextureUploaderTests), "Resources.TextureUploader", "TestTexture.png");

            using (var engineFactory = new EngineFactory(coreConfig))
                using (var device = EngineDevice.CreateSoftwareDevice(engineFactory))
                    using (var colorTexture = GraphicsHelper.CreateTexture(device, testResource))
                        using (var texUploader = TextureUploader.ConstructUsingPropertiesFromTexture(device, colorTexture))
                            using (texUploader.UploadToMemoryMappedTexture <Vector3>(colorTexture))
                            {
                            }
        }
        public void SimpleUpload_ColorBitmap()
        {
            var coreConfig = new GraphicsCoreConfiguration();

            coreConfig.DebugEnabled = true;

            var testResource = new AssemblyResourceLink(
                typeof(TextureUploaderTests), "Resources.TextureUploader", "TestTexture.png");

            using (var engineFactory = new EngineFactory(coreConfig))
                using (var device = EngineDevice.CreateSoftwareDevice(engineFactory))
                    using (var colorTexture = GraphicsHelper.CreateTexture(device, testResource))
                        using (var texUploader = TextureUploader.ConstructUsingPropertiesFromTexture(device, colorTexture))
                            using (var uploaded = texUploader.UploadToMemoryMappedTexture <int>(colorTexture))
                            {
                                Assert.IsTrue(new Color4(uploaded[224, 326]).EqualsWithTolerance(Color4.RedColor));
                                Assert.IsTrue(new Color4(uploaded[10, 10]).EqualsWithTolerance(Color4.White));
                                Assert.IsTrue(new Color4(uploaded[561, 261]).EqualsWithTolerance(new Color4(0, 38, 255)));
                                Assert.IsTrue(new Color4(uploaded[538, 669]).EqualsWithTolerance(new Color4(255, 0, 220)));
                            }
        }
示例#6
0
 public void EditCoreConfiguration(GraphicsCoreConfiguration coreConfig)
 {
 }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FactoryHandlerWIC" /> class.
 /// </summary>
 internal FactoryHandlerWIC(GraphicsCoreConfiguration coreConfiguration)
 {
     _wicFactory = new IWICImagingFactory();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphicsDeviceConfiguration" /> class.
 /// </summary>
 /// <param name="coreConfig">The core configuration object.</param>
 public GraphicsDeviceConfiguration(GraphicsCoreConfiguration coreConfig)
 {
     this.CoreConfiguration = coreConfig;
 }
示例#9
0
 public void EditCoreConfiguration(GraphicsCoreConfiguration coreConfig)
 {
     _manipulateCoreConfig?.Invoke(coreConfig);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FactoryHandlerDWrite"/> class.
 /// </summary>
 internal FactoryHandlerDWrite(GraphicsCoreConfiguration coreConfiguration)
 {
     // Create DirectWrite Factory object
     _factory = DWriteCreateFactory <DWrite.IDWriteFactory>(DWrite.FactoryType.Shared);
 }