本文整理汇总了C#中SharpDX.WIC.ImagingFactory类的典型用法代码示例。如果您正苦于以下问题:C# ImagingFactory类的具体用法?C# ImagingFactory怎么用?C# ImagingFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImagingFactory类属于SharpDX.WIC命名空间,在下文中一共展示了ImagingFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BitmapEncoder
/// <summary>
/// Initializes a new instance of the <see cref="BitmapEncoder"/> class.
/// </summary>
/// <param name="factory">The factory.</param>
/// <param name="containerFormatGuid">The container format GUID. List from <see cref="ContainerFormatGuids"/> </param>
/// <param name="stream">A stream to use as the output of this bitmap encoder.</param>
/// <unmanaged>HRESULT IWICImagingFactory::CreateEncoder([In] const GUID& guidContainerFormat,[In, Optional] const GUID* pguidVendor,[Out] IWICBitmapEncoder** ppIEncoder)</unmanaged>
public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, System.IO.Stream stream = null)
{
this.factory = factory;
factory.CreateEncoder(containerFormatGuid, null, this);
if (stream != null)
Initialize(stream);
}
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:14,代码来源:BitmapEncoder.cs
示例2: GetColorContexts
internal static ColorContext[] GetColorContexts(ColorContextsProvider getColorContexts, ImagingFactory imagingFactory)
{
ColorContext[] colorContexts;
Result result = TryGetColorContexts(getColorContexts, imagingFactory, out colorContexts);
result.CheckError();
return colorContexts;
}
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:7,代码来源:ColorContextsHelper.cs
示例3: TryGetColorContexts
internal static Result TryGetColorContexts(ColorContextsProvider getColorContexts, ImagingFactory imagingFactory, out ColorContext[] colorContexts)
{
colorContexts = null;
int count;
Result result = getColorContexts(0, null, out count);
if (result.Success)
{
colorContexts = new ColorContext[count];
if (count > 0)
{
// http://msdn.microsoft.com/en-us/library/windows/desktop/ee690135(v=vs.85).aspx
// The ppIColorContexts array must be filled with valid data: each IWICColorContext* in the array must
// have been created using IWICImagingFactory::CreateColorContext.
for (int i = 0; i < count; i++)
colorContexts[i] = new ColorContext(imagingFactory);
int actualCount;
getColorContexts(count, colorContexts, out actualCount);
Debug.Assert(count == actualCount);
}
}
return result;
}
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:27,代码来源:ColorContextsHelper.cs
示例4: Direct2DFactories
public Direct2DFactories()
{
WICFactory = new WIC.ImagingFactory ();
DWFactory = new DW.Factory ();
var d3DDevice = new D3D11.Device (
D3D.DriverType.Hardware,
D3D11.DeviceCreationFlags.BgraSupport
#if DEBUG
| D3D11.DeviceCreationFlags.Debug
#endif
,
D3D.FeatureLevel.Level_11_1,
D3D.FeatureLevel.Level_11_0,
D3D.FeatureLevel.Level_10_1,
D3D.FeatureLevel.Level_10_0,
D3D.FeatureLevel.Level_9_3,
D3D.FeatureLevel.Level_9_2,
D3D.FeatureLevel.Level_9_1
);
var dxgiDevice = ComObject.As<SharpDX.DXGI.Device> (d3DDevice.NativePointer);
var d2DDevice = new D2D1.Device (dxgiDevice);
D2DFactory = d2DDevice.Factory;
//_d2DDeviceContext = new D2D1.DeviceContext (d2DDevice, D2D1.DeviceContextOptions.None);
//var dpi = DisplayDpi;
//_d2DDeviceContext.DotsPerInch = new Size2F (dpi, dpi);
}
开发者ID:rbrian,项目名称:NGraphics,代码行数:28,代码来源:Direct2DCanvas.cs
示例5: WICStream
/// <summary>
/// Initializes a new instance of the <see cref="WICStream"/> class from a <see cref="IStream"/>.
/// </summary>
/// <param name="factory">The factory.</param>
/// <param name="stream">The stream.</param>
/// <msdn-id>ee719789</msdn-id>
/// <unmanaged>HRESULT IWICStream::InitializeFromIStream([In, Optional] IStream* pIStream)</unmanaged>
/// <unmanaged-short>IWICStream::InitializeFromIStream</unmanaged-short>
public WICStream(ImagingFactory factory, Stream stream)
: base(IntPtr.Zero)
{
factory.CreateStream(this);
streamProxy = new ComStreamProxy(stream);
var istreamPtr = ComStreamShadow.ToIntPtr(streamProxy);
InitializeFromIStream_(istreamPtr);
}
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:16,代码来源:WICStream.cs
示例6: GifRecorder
/// <summary>
/// Initializes instance members of the <see cref="GifRecorder"/> class.
/// </summary>
public GifRecorder()
{
GifRepeatCount = 0;
_imagingFactory = new ImagingFactory();
_frames = new List<BitmapFrame>();
MaxFramePerSecond = 8;
_desktopManager = new DesktopManager();
}
开发者ID:ababhamdi,项目名称:FastCapt,代码行数:11,代码来源:GifRecorder.cs
示例7: Initialize
public static void Initialize() {
lock (SyncObject) {
if (!_isInitailized) {
_factory = new ImagingFactory();
_isInitailized = true;
}
}
}
开发者ID:Hozuki,项目名称:Noire,代码行数:8,代码来源:TextureLoader.cs
示例8: BitmapImpl
/// <summary>
/// Initializes a new instance of the <see cref="BitmapImpl"/> class.
/// </summary>
/// <param name="factory">The WIC imaging factory to use.</param>
/// <param name="stream">The stream to read the bitmap from.</param>
public BitmapImpl(ImagingFactory factory, Stream stream)
{
_factory = factory;
using (BitmapDecoder decoder = new BitmapDecoder(factory, stream, DecodeOptions.CacheOnLoad))
{
WicImpl = new Bitmap(factory, decoder.GetFrame(0), BitmapCreateCacheOption.CacheOnLoad);
}
}
开发者ID:jkoritzinsky,项目名称:Avalonia,代码行数:14,代码来源:BitmapImpl.cs
示例9: BitmapImpl
public BitmapImpl(ImagingFactory factory, string fileName)
{
this.factory = factory;
using (BitmapDecoder decoder = new BitmapDecoder(factory, fileName, DecodeOptions.CacheOnDemand))
{
this.WicImpl = new Bitmap(factory, decoder.GetFrame(0), BitmapCreateCacheOption.CacheOnDemand);
}
}
开发者ID:Robertofon,项目名称:Perspex,代码行数:9,代码来源:BitmapImpl.cs
示例10: CCLabel_Renderer81
public CCLabel_Renderer81()
{
var d2dFactory = CreateD2DFactory();
var newDevice = CreateDevice();
CreateRenderingResources(newDevice, d2dFactory);
FactoryImaging = new SharpDX.WIC.ImagingFactory();
}
开发者ID:haithemaraissia,项目名称:CocosSharp,代码行数:10,代码来源:CCLabel-Renderer81.cs
示例11: LoadBitmaps
private static void LoadBitmaps()
{
var fac = new SharpDX.WIC.ImagingFactory();
var target = GraphicsWindow.Instance.RenderTarget2D;
var stream = new NativeFileStream(Application.StartupPath + "\\Images\\Ship 1.png", NativeFileMode.Open, NativeFileAccess.Read);
var decoder = new BitmapDecoder(fac, stream, DecodeOptions.CacheOnDemand);
var frame = decoder.GetFrame(0);
var converter = new FormatConverter(fac);
converter.Initialize(frame, SharpDX.WIC.PixelFormat.Format32bppPRGBA);
BitShip1 = Bitmap1.FromWicBitmap(GraphicsWindow.Instance.RenderTarget2D, converter);
}
开发者ID:jonathandlo,项目名称:deep-space-dive,代码行数:12,代码来源:Constants.cs
示例12: Main
private static void Main()
{
var wicFactory = new ImagingFactory();
var d2dFactory = new SharpDX.Direct2D1.Factory();
string filename = "output.jpg";
const int width = 512;
const int height = 512;
var rectangleGeometry = new RoundedRectangleGeometry(d2dFactory, new RoundedRectangle() { RadiusX = 32, RadiusY = 32, Rect = new RectangleF(128, 128, width - 128, height-128) });
var wicBitmap = new Bitmap(wicFactory, width, height, SharpDX.WIC.PixelFormat.Format32bppBGR, BitmapCreateCacheOption.CacheOnLoad);
var renderTargetProperties = new RenderTargetProperties(RenderTargetType.Default, new PixelFormat(Format.Unknown, AlphaMode.Unknown), 0, 0, RenderTargetUsage.None, FeatureLevel.Level_DEFAULT);
var d2dRenderTarget = new WicRenderTarget(d2dFactory, wicBitmap, renderTargetProperties);
var solidColorBrush = new SolidColorBrush(d2dRenderTarget, Color.White);
d2dRenderTarget.BeginDraw();
d2dRenderTarget.Clear(Color.Black);
d2dRenderTarget.FillGeometry(rectangleGeometry, solidColorBrush, null);
d2dRenderTarget.EndDraw();
if (File.Exists(filename))
File.Delete(filename);
var stream = new WICStream(wicFactory, filename, NativeFileAccess.Write);
// Initialize a Jpeg encoder with this stream
var encoder = new JpegBitmapEncoder(wicFactory);
encoder.Initialize(stream);
// Create a Frame encoder
var bitmapFrameEncode = new BitmapFrameEncode(encoder);
bitmapFrameEncode.Initialize();
bitmapFrameEncode.SetSize(width, height);
var pixelFormatGuid = SharpDX.WIC.PixelFormat.FormatDontCare;
bitmapFrameEncode.SetPixelFormat(ref pixelFormatGuid);
bitmapFrameEncode.WriteSource(wicBitmap);
bitmapFrameEncode.Commit();
encoder.Commit();
bitmapFrameEncode.Dispose();
encoder.Dispose();
stream.Dispose();
System.Diagnostics.Process.Start(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory,filename)));
}
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:49,代码来源:Program.cs
示例13: RenderTargetBitmapImpl
public RenderTargetBitmapImpl(
ImagingFactory imagingFactory,
Factory d2dFactory,
int width,
int height)
: base(imagingFactory, width, height)
{
this.target = new WicRenderTarget(
d2dFactory,
this.WicImpl,
new RenderTargetProperties
{
DpiX = 96,
DpiY = 96,
});
}
开发者ID:Robertofon,项目名称:Perspex,代码行数:16,代码来源:RenderTargetBitmapImpl.cs
示例14: RenderTargetBitmapImpl
public RenderTargetBitmapImpl(
ImagingFactory imagingFactory,
Factory d2dFactory,
int width,
int height)
: base(imagingFactory, width, height)
{
var props = new RenderTargetProperties
{
DpiX = 96,
DpiY = 96,
};
_target = new WicRenderTarget(
d2dFactory,
WicImpl,
props);
}
开发者ID:healtech,项目名称:Perspex,代码行数:18,代码来源:RenderTargetBitmapImpl.cs
示例15: Direct2D1RenderTargetBitmap
public Direct2D1RenderTargetBitmap(
Factory d2dFactory,
ImagingFactory wicFactory,
SharpDX.WIC.Bitmap bitmap)
: base(wicFactory, bitmap)
{
double dpiX;
double dpiY;
this.d2dFactory = d2dFactory;
bitmap.GetResolution(out dpiX, out dpiY);
this.target = new WicRenderTarget(
d2dFactory,
bitmap,
new RenderTargetProperties
{
DpiX = (float)dpiX,
DpiY = (float)dpiY,
});
}
开发者ID:modulexcite,项目名称:Avalonia,代码行数:21,代码来源:Direct2D1RenderTargetBitmap.cs
示例16: GifBitmapEncoder
/// <summary>
/// Initializes a new instance of the <see cref="GifBitmapEncoder"/> class.
/// </summary>
/// <param name="factory">The factory.</param>
/// <param name="stream">The output stream.</param>
public GifBitmapEncoder(ImagingFactory factory, Stream stream = null)
: base(factory, ContainerFormatGuids.Gif, stream)
{
}
开发者ID:numo16,项目名称:SharpDX,代码行数:9,代码来源:GifBitmapEncoder.cs
示例17: ColorTransform
/// <summary>
/// Initializes a new instance of the <see cref="ColorTransform"/> class.
/// </summary>
/// <param name="factory">The factory.</param>
/// <unmanaged>HRESULT IWICImagingFactory::CreateColorTransformer([Out, Fast] IWICColorTransform** ppIWICColorTransform)</unmanaged>
public ColorTransform(ImagingFactory factory)
: base(IntPtr.Zero)
{
factory.CreateColorTransformer(this);
}
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:10,代码来源:ColorTransform.cs
示例18: CreateFont
//private string CreateFont(string fontName, float fontSize, CCRawList<char> charset)
private Font CreateFont(string fontName, float fontSize)
{
Font _currentFont;
if (Factory2D == null)
{
Factory2D = new SharpDX.Direct2D1.Factory();
FactoryDWrite = new SharpDX.DirectWrite.Factory();
FactoryImaging = new SharpDX.WIC.ImagingFactory();
dpi = Factory2D.DesktopDpi;
dpiScale = dpi.Height / 72f;
}
_currentFontCollection = FactoryDWrite.GetSystemFontCollection(true);
if (_defaultFont == null)
{
_defaultFont = GenericSanSerif();
}
FontFamily fontFamily = GetFontFamily(fontName);
FontCollection fontCollection;
if (!_fontCollectionCache.TryGetValue(fontName, out fontCollection))
{
var ext = Path.GetExtension(fontName);
if (!String.IsNullOrEmpty(ext) && ext.ToLower() == ".ttf")
{
try
{
var fileFontLoader = new FileFontLoader(FactoryDWrite, fontName);
var fileFontCollection = new FontCollection(FactoryDWrite, fileFontLoader, fileFontLoader.Key);
_currentFontCollection = fileFontCollection;
fontFamily = _currentFontCollection.GetFontFamily(0);
var ffn = fontFamily.FamilyNames;
_currentFont = fontFamily.GetFirstMatchingFont(FontWeight.Regular, FontStretch.Normal, FontStyle.Normal);
_fontCollectionCache.Add(fontName, fileFontCollection);
_currentFontCollection = fileFontCollection;
}
catch
{
_currentFont = GetFont(fontName, fontSize);
CCLog.Log("{0} not found. Defaulting to {1}.", fontName, _currentFont.FontFamily.FamilyNames.GetString(0));
}
}
else
{
_currentFont = GetFont(fontName, fontSize);
}
}
else
{
fontFamily = fontCollection.GetFontFamily(0);
_currentFont = fontFamily.GetFirstMatchingFont(FontWeight.Regular, FontStretch.Normal, FontStyle.Normal);
_currentFontCollection = fontCollection;
}
return _currentFont;
}
开发者ID:haithemaraissia,项目名称:CocosSharp,代码行数:68,代码来源:CCLabel-WindowsPhone81.cs
示例19: CreateFont
private string CreateFont(string fontName, float fontSize, CCRawList<char> charset)
{
if (Factory2D == null)
{
Factory2D = new SharpDX.Direct2D1.Factory();
FactoryDWrite = new SharpDX.DirectWrite.Factory();
FactoryImaging = new SharpDX.WIC.ImagingFactory();
dpi = Factory2D.DesktopDpi;
dpiScale = dpi.Height / 72f;
}
if (_defaultFont == null)
{
_defaultFont = GenericSanSerif();
//_defaultDIP = ConvertPointSizeToDIP(_defaultFontSizeEm);
}
FontFamily fontFamily = GetFontFamily(fontName);
if (!_fontFamilyCache.TryGetValue(fontName, out fontFamily))
{
var ext = Path.GetExtension(fontName);
_currentFont = _defaultFont;
if (!String.IsNullOrEmpty(ext) && ext.ToLower() == ".ttf")
{
//var appPath = AppDomain.CurrentDomain.BaseDirectory;
//var contentPath = Path.Combine(appPath, CCApplication.SharedApplication.Content.RootDirectory);
//var fontPath = Path.Combine(contentPath, fontName);
//if (File.Exists(fontPath))
//{
// try
//{
//var fontFileReference = new FontCollection(
//_loadedFonts.AddFontFile(fontPath);
// //fontFamily = _loadedFonts.Families[_loadedFonts.Families.Length - 1];
// //_currentFont = new Font(fontFamily, fontSize);
// }
// catch
// {
// _currentFont = _defaultFont;
// }
//}
//else
//{
_currentFont = _defaultFont;
_currentFontSizeEm = fontSize;
_currentDIP = ConvertPointSizeToDIP(fontSize);
//}
}
else
{
_currentFont = GetFont(fontName, fontSize);
_currentFontSizeEm = fontSize;
_currentDIP = ConvertPointSizeToDIP(fontSize);
}
_fontFamilyCache.Add(fontName, _currentFont.FontFamily);
}
else
{
_currentFont = fontFamily.GetFirstMatchingFont(FontWeight.Regular, FontStretch.Normal, FontStyle.Normal);
_currentFontSizeEm = fontSize;
_currentDIP = ConvertPointSizeToDIP(fontSize);
}
fontName = _currentFont.FontFamily.FamilyNames.GetString(0);
textFormat = new TextFormat(FactoryDWrite, fontName, _currentDIP);
GetKerningInfo(charset);
return _currentFont.ToString();
}
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:79,代码来源:CCLabel-Windows.cs
示例20: GifBitmapDecoder
/// <summary>
/// Initializes a new instance of the <see cref="GifBitmapDecoder"/> class.
/// </summary>
/// <param name="factory">The factory.</param>
/// <param name="guidVendorRef">The GUID vendor ref.</param>
public GifBitmapDecoder(ImagingFactory factory, Guid guidVendorRef)
: base(factory, ContainerFormatGuids.Gif, guidVendorRef)
{
}
开发者ID:numo16,项目名称:SharpDX,代码行数:9,代码来源:GifBitmapDecoder.cs
注:本文中的SharpDX.WIC.ImagingFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论