public DataBuffer CreateIndexBuffer(int length, Usage usage, Format format, Pool pool) { IntPtr pOut = IntPtr.Zero; int res = Interop.Calli(comPointer, length, (int)usage, (int)format, (int)pool, (IntPtr)(void*)&pOut, IntPtr.Zero,(*(IntPtr**)comPointer)[27]); if( res < 0 ) { throw new SharpDXException( res ); } return new DataBuffer( pOut ); }
public PixelDataProvider(int width, int height, int numChannels, Device device, Usage usage) : base() { Format pf = Format.X8R8G8B8; switch (numChannels) { case 1: pf = Format.A8; break; case 3: pf = Format.R8G8B8; break; case 4: pf = Format.X8R8G8B8; break; case 8: pf = Format.A16B16G16R16; break; } //TODO: how to find out which Formats are supported?? //device.DeviceCaps.TextureCaps if (pf == Format.R8G8B8) pf = Format.X8R8G8B8; //RenderToSurface sf = new RenderToSurface(device, width, height, pf, false, null); //this._tx = new Texture(device, width, height, 1, Usage.RenderTarget, pf, Pool.Default); // Pool.Managed doesn't work with Usage.RenderTarget Pool pool = Pool.Managed; if (usage == Usage.RenderTarget) pool = Pool.Default; this._tx = new Texture(device, width, height, 1, usage, pf, pool); //this._sd = this._tx.GetLevelDescription(0); this._surf = this._tx.GetSurfaceLevel(0); //AOAO this._sd = this._surf.Description; }
public static Texture2D FromFile(DeviceContext context, string file, Usage usage, Pool pool) { using (var stream = File.OpenRead(file)) { return FromStream(context, stream, usage, pool); } }
public ReadTexture(int width, int height, uint handle, EnumEntry formatEnum, EnumEntry usageEnum) { Format format; if (formatEnum.Name == "INTZ") format = D3DX.MakeFourCC((byte)'I', (byte)'N', (byte)'T', (byte)'Z'); else if (formatEnum.Name == "RAWZ") format = D3DX.MakeFourCC((byte)'R', (byte)'A', (byte)'W', (byte)'Z'); else if (formatEnum.Name == "RESZ") format = D3DX.MakeFourCC((byte)'R', (byte)'E', (byte)'S', (byte)'Z'); else if (formatEnum.Name == "No Specific") throw (new Exception("Texture mode not supported")); else format = (Format)Enum.Parse(typeof(Format), formatEnum, true); var usage = Usage.Dynamic; if (usageEnum.Index == (int)(TextureType.RenderTarget)) usage = Usage.RenderTarget; else if (usageEnum.Index == (int)(TextureType.DepthStencil)) usage = Usage.DepthStencil; this.FWidth = width; this.FHeight = height; this.FHandle = (IntPtr)unchecked((int)handle); this.FFormat = format; this.FUsage = usage; Initialise(); }
private WrappedCubeTexture(Device device, int edgeSize, Usage usage, Format format, Pool pool) { _usage = usage; _format = format; _edgeSize = edgeSize; _pool = pool; CreateCubeTexture(device); }
/// <summary> /// Initializes a new instance of the <see cref="CubeTexture"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="edgeLength">Length of the edge.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="sharedHandle">The shared handle.</param> public CubeTexture(Device device, int edgeLength, int levelCount, Usage usage, Format format, Pool pool, ref IntPtr sharedHandle) : base(IntPtr.Zero) { unsafe { fixed (void* pSharedHandle = &sharedHandle) device.CreateCubeTexture(edgeLength, levelCount, (int)usage, format, pool, this, (IntPtr)pSharedHandle); } }
public Texture2D(Device d, int width, int height, Usage u) { handle = new Texture(d, width, height, 1, u, Format.A8R8G8B8, Pool.Default); usage = u; Width = width; Height = height; device = d; managed = false; }
public Texture2D(Device d, int width, int height) { handle = new Texture(d, width, height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed); Width = width; Height = height; device = d; managed = true; usage = Usage.None; }
/// <summary> /// Initializes a new instance of the <see cref="VolumeTexture"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="sharedHandle">The shared handle.</param> /// <unmanaged>HRESULT IDirect3DDevice9::CreateVolumeTexture([In] unsigned int Width,[In] unsigned int Height,[In] unsigned int Levels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[Out, Fast] IDirect3DVolumeTexture9** ppVolumeTexture,[In] void** pSharedHandle)</unmanaged> public VolumeTexture(Device device, int width, int height, int depth, int levelCount, Usage usage, Format format, Pool pool, ref IntPtr sharedHandle) : base(IntPtr.Zero) { unsafe { fixed (void* pSharedHandle = &sharedHandle) device.CreateVolumeTexture(width, height, depth, levelCount, (int)usage, format, pool, this, new IntPtr(pSharedHandle)); } }
/// <summary> /// Initializes a new instance of the <see cref="IndexBuffer"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="sizeInBytes">The size in bytes.</param> /// <param name="usage">The usage.</param> /// <param name="pool">The pool.</param> /// <param name="sixteenBit">if set to <c>true</c> use 16bit index buffer, otherwise, use 32bit index buffer.</param> /// <param name="sharedHandle">The shared handle.</param> /// <msdn-id>bb174357</msdn-id> /// <unmanaged>HRESULT IDirect3DDevice9::CreateIndexBuffer([In] unsigned int Length,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[Out, Fast] IDirect3DIndexBuffer9** ppIndexBuffer,[In] void** pSharedHandle)</unmanaged> /// <unmanaged-short>IDirect3DDevice9::CreateIndexBuffer</unmanaged-short> public IndexBuffer(Device device, int sizeInBytes, Usage usage, Pool pool, bool sixteenBit, ref IntPtr sharedHandle) : base(IntPtr.Zero) { unsafe { fixed (void* pSharedHandle = &sharedHandle) device.CreateIndexBuffer(sizeInBytes, (int)usage, sixteenBit ? Format.Index16 : Format.Index32, pool, this, (IntPtr)pSharedHandle); } }
public ReadTexture(int width, int height, IntPtr handle, Format format, Usage usage) { this.FWidth = width; this.FHeight = height; this.FHandle = handle; this.FFormat = format; this.FUsage = usage; Initialise(); }
public Texture2D(Device d, string file) { handle = Texture.FromFile(d, Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), file), Usage.None, Pool.Managed); ImageInformation i = ImageInformation.FromFile(file); Width = i.Width; Height = i.Height; device = d; managed = true; usage = Usage.None; }
/// <summary> /// Initializes a new instance of the <see cref="SharpDX.Direct3D9.VertexBuffer" /> class. /// </summary> /// <param name="device">The device that will be used to create the buffer.</param> /// <param name="sizeInBytes">Size of the buffer, in bytes.</param> /// <param name="usage">The requested usage of the buffer.</param> /// <param name="format">The vertex format of the vertices in the buffer. If set to <see cref="SharpDX.Direct3D9.VertexFormat" />.None, the buffer will be a non-FVF buffer.</param> /// <param name="pool">The memory class into which the resource will be placed.</param> /// <param name="sharedHandle">The variable that will receive the shared handle for this resource.</param> /// <remarks>This method is only available in Direct3D9 Ex.</remarks> /// <msdn-id>bb174364</msdn-id> /// <unmanaged>HRESULT IDirect3DDevice9::CreateVertexBuffer([In] unsigned int Length,[In] D3DUSAGE Usage,[In] D3DFVF FVF,[In] D3DPOOL Pool,[Out, Fast] IDirect3DVertexBuffer9** ppVertexBuffer,[In] void** pSharedHandle)</unmanaged> /// <unmanaged-short>IDirect3DDevice9::CreateVertexBuffer</unmanaged-short> public VertexBuffer(Device device, int sizeInBytes, Usage usage, VertexFormat format, Pool pool, ref IntPtr sharedHandle) : base(IntPtr.Zero) { unsafe { sharedHandle = IntPtr.Zero; fixed (void* pSharedHandle = &sharedHandle) device.CreateVertexBuffer(sizeInBytes, usage, format, pool, this, new IntPtr(pSharedHandle)); } }
/// <summary> /// Checks texture-creation parameters. /// </summary> /// <param name="device">Device associated with the texture.</param> /// <param name="size">Requested size of the texture. Null if </param> /// <param name="mipLevelCount">Requested number of mipmap levels for the texture.</param> /// <param name="usage">The requested usage for the texture.</param> /// <param name="format">Requested format for the texture.</param> /// <param name="pool">Memory class where the resource will be placed.</param> /// <returns>A value type containing the proposed values to pass to the texture creation functions.</returns> /// <unmanaged>HRESULT D3DXCheckCubeTextureRequirements([In] IDirect3DDevice9* pDevice,[InOut] unsigned int* pSize,[InOut] unsigned int* pNumMipLevels,[In] unsigned int Usage,[InOut] D3DFORMAT* pFormat,[In] D3DPOOL Pool)</unmanaged> public static CubeTextureRequirements CheckRequirements(Device device, int size, int mipLevelCount, Usage usage, Format format, Pool pool) { var result = new CubeTextureRequirements { Size = size, MipLevelCount = mipLevelCount, Format = format }; D3DX9.CheckCubeTextureRequirements(device, ref result.Size, ref result.MipLevelCount, (int)usage, ref result.Format, pool); return result; }
public BufferDescription( int sizeInBytes, Usage usage, BindFlags bindFlags, MiscFlags miscFlags, ExtraFlags extraFlags, int structureByteStide) { SizeInBytes = sizeInBytes; Usage = usage; BindFlags = bindFlags; MiscFlags = miscFlags; ExtraFlags = extraFlags; StructureByteStride = structureByteStide; }
protected TextureBase(DeviceContext context, int width, int height, int levelCount, Usage usage, Format format, Pool pool) : base(context) { _size = new Vector2(width, height); _width = width; _height = height; _levelCount = levelCount; _usage = usage; _format = format; _pool = pool; _texture = new Texture(context, width, height, levelCount, usage, format, pool); #if DEBUG Context.PerformanceMonitor.IncreaseLifetimeCounter(LifetimeCounters.TextureCount); #endif }
public override IEnumerable<string> GetAttributesTextFor(FieldInfo field, Usage defaultUsage, ParsingPolicyAttribute[] parsingPolicies) { var res = new List<string>(base.GetAttributesTextFor(field, defaultUsage, parsingPolicies)); var fieldType = field.FieldType; var renameRule = field.GetCustomAttribute<RenameAttribute>(); string fieldName = field.GetCustomAttribute<NameAttribute>()?.Name ?? field.Name; if (!field.IsDefined<RefAttribute>()) { if (field.IsPolymorphic()) { Type attributeType = !fieldType.IsArray || field.IsDefined<InlineAttribute>() ? typeof(XmlElementAttribute) : typeof(XmlArrayItemAttribute); foreach (var t in field.GetKnownSerializableTypes()) res.Add(GetItemAttributeText(attributeType, t, renameRule)); } else if ( field.FieldType.IsArray && !field.IsDefined<ConverterAttribute>() && !field.IsDefined<ParserAttribute>() && !parsingPolicies.Any(p => p.CanParse(field.FieldType))) { Type attributeType = field.IsDefined<InlineAttribute>() ? typeof(XmlElementAttribute) : typeof(XmlArrayItemAttribute); Type itemTypeName = field.FieldType.GetElementType(); res.Add(GetItemAttributeText(attributeType, itemTypeName, renameRule)); } } var rawFieldType = field.GetRawFieldType(parsingPolicies); if (rawFieldType.IsSimple()) { res.Add(AttributeBuilder.GetTextFor<XmlAttributeAttribute>(fieldName)); } else if (!res.Any(a => a.Contains(nameof(XmlElementAttribute)))) { if (rawFieldType.IsArray) res.Add(AttributeBuilder.GetTextFor<XmlArrayAttribute>(fieldName)); else res.Add(AttributeBuilder.GetTextFor<XmlElementAttribute>(fieldName)); } if (field.IsDefined<HiddenAttribute>()) res.Add(AttributeBuilder.GetTextFor<XmlIgnoreAttribute>()); return res.Where(a => a != null); }
public TextureBase(DeviceContext context, Texture texture) : base(context) { _texture = texture; SurfaceDescription desc = _texture.GetLevelDescription(0); _width = desc.Width; _height = desc.Height; _size = new Vector2(_width, _height); _levelCount = _texture.LevelCount; _usage = desc.Usage; _format = desc.Format; _pool = desc.Pool; #if DEBUG Context.PerformanceMonitor.IncreaseLifetimeCounter(LifetimeCounters.TextureCount); #endif }
public virtual IEnumerable<string> GetAttributesTextFor(FieldInfo field, Usage defaultUsage, ParsingPolicyAttribute[] parsingPolicies) { var result = new List<string>(); var fieldType = field.FieldType; string usageAttribute = null; bool isForcedUsage = defaultUsage == Usage.ForceRequired || defaultUsage == Usage.ForceOptional; if (isForcedUsage) { if (defaultUsage == Usage.ForceRequired) usageAttribute = AttributeBuilder.GetTextFor<RequiredAttribute>(); else if (defaultUsage == Usage.ForceOptional) usageAttribute = AttributeBuilder.GetTextFor<OptionalAttribute>(); } else if (fieldType.IsValueType && Nullable.GetUnderlyingType(field.FieldType) == null) { usageAttribute = AttributeBuilder.GetTextFor<RequiredAttribute>(); } else if (Nullable.GetUnderlyingType(field.FieldType) != null) { usageAttribute = AttributeBuilder.GetTextFor<OptionalAttribute>(); } else if (!field.IsDefined<RequiredAttribute>() && !field.IsDefined<OptionalAttribute>()) { if (defaultUsage == Usage.Required) usageAttribute = AttributeBuilder.GetTextFor<RequiredAttribute>(); else if (defaultUsage == Usage.Optional) usageAttribute = AttributeBuilder.GetTextFor<OptionalAttribute>(); } if (usageAttribute != null) result.Add(usageAttribute); var attributes = field.GetCustomAttributes().ToArray(); var attributesData = field.GetCustomAttributesData(); for (int i = 0; i < attributes.Length; i++) { // Skip any usage attributes, if field usage is forced by the calling method. bool isUsageAttribute = attributes[i] is OptionalAttribute || attributes[i] is RequiredAttribute; if (isForcedUsage && isUsageAttribute) continue; // Get c# compatible attribute text. string attributeText = CommonAttributeTranslator.Translate(attributes[i], attributesData[i], field); if (attributeText != null) result.Add(attributeText); } return result; }
public Texture WriteToR32F(Rectangle area, int numLevels, Usage usage, Pool pool) { // create texture Texture tex = new Texture(device, area.Width, area.Height, numLevels, usage, Format.R32F, pool); // fill with data //TextureLoader.FillTexture(tex, new Fill2DTextureCallback(FillR32FTexture)); if (areaData == null || areaData.Length != area.Width * area.Height) areaData = new double[area.Width * area.Height]; dataSource.Sample(area.Location, area.Size, ref areaData); GraphicsStream gs = tex.LockRectangle(0, LockFlags.None); for (int i = 0; i < areaData.Length; i++) { gs.Write((float)areaData[i]); } tex.UnlockRectangle(0); return tex; }
public IDirect3DVertexBuffer9 CreateVertexBuffer(int sizeInBytes, Usage usage, VertexFormat vertexFormat, Pool pool) { return(CreateVertexBuffer_(sizeInBytes, usage, vertexFormat, pool, IntPtr.Zero)); }
public async Task Create(Usage usage) { }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="buffer">The buffer.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static unsafe CubeTexture CreateFromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; fixed(void *pBuffer = buffer) cubeTexture = CreateFromPointer( device, (IntPtr)pBuffer, buffer.Length, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, imageInformation, palette ); return(cubeTexture); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="pointer">The pointer.</param> /// <param name="sizeInBytes">The size in bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static unsafe CubeTexture CreateFromPointer(Device device, IntPtr pointer, int sizeInBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; D3DX9.CreateCubeTextureFromFileInMemoryEx( device, pointer, sizeInBytes, size, levelCount, (int)usage, format, pool, (int)filter, (int)mipFilter, (Color)colorKey, imageInformation, palette, out cubeTexture); return(cubeTexture); }
public unsafe IDirect3DCubeTexture9 CreateCubeTexture(int edgeLength, int levels, Usage usage, Format format, Pool pool, ref IntPtr sharedHandle) { fixed(void *pSharedHandle = &sharedHandle) { return(CreateCubeTexture_(edgeLength, levels, usage, format, pool, new IntPtr(pSharedHandle))); } }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static CubeTexture FromStream(Device device, Stream stream, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey) { return FromStream(device, stream, 0, size, levelCount, usage, format, pool, filter, mipFilter, colorKey); }
public unsafe IDirect3DVolumeTexture9 CreateVolumeTexture(int width, int height, int depth, int levels, Usage usage, Format format, Pool pool, ref IntPtr sharedHandle) { fixed(void *pSharedHandle = &sharedHandle) { return(CreateVolumeTexture_(width, height, depth, levels, usage, format, pool, new IntPtr(pSharedHandle))); } }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static CubeTexture FromStream(Device device, Stream stream, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey) { return(FromStream(device, stream, 0, size, levelCount, usage, format, pool, filter, mipFilter, colorKey)); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a memory buffer. /// </summary> /// <param name="device">The device.</param> /// <param name="buffer">The buffer.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static unsafe CubeTexture FromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation) { fixed (void* pImageInfo = &imageInformation) return CreateFromMemory(device, buffer, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, null); }
/// <summary> /// Allocates a new render-texture with the specified parameters. /// </summary> public void AllocateCustom(int width, int height, Usage usage, Format format) { _assetCore.Allocate(width, height, usage, format); }
public override Variable Initialize(Access access, Usage usage, string name, Compiler.Scope scope, ScriptTrace trace) => new VarVoid(access, usage, name, scope);
public VarVoid(Access access, Usage usage, string objectName, Compiler.Scope scope) : base(access, usage, objectName, scope) { }
public IDirect3DIndexBuffer9 CreateIndexBuffer(int sizeInBytes, Usage usage, bool sixteenBit, Pool pool) { return(CreateIndexBuffer_(sizeInBytes, usage, sixteenBit ? Format.Index16 : Format.Index32, pool, IntPtr.Zero)); }
/// <summary> /// Retrieve the usage for the account id. (see /// http://aka.ms/azureautomationsdk/usageoperations for more /// information) /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the resource group /// </param> /// <param name='automationAccount'> /// Required. The automation account name. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// The response model for the get usage operation. /// </returns> public async Task <UsageListResponse> ListAsync(string resourceGroupName, string automationAccount, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (automationAccount == null) { throw new ArgumentNullException("automationAccount"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("automationAccount", automationAccount); TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; if (this.Client.ResourceNamespace != null) { url = url + Uri.EscapeDataString(this.Client.ResourceNamespace); } url = url + "/automationAccounts/"; url = url + Uri.EscapeDataString(automationAccount); url = url + "/usages"; List <string> queryParameters = new List <string>(); queryParameters.Add("api-version=2017-05-15-preview"); if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers httpRequest.Headers.Add("Accept", "application/json"); httpRequest.Headers.Add("x-ms-version", "2014-06-01"); // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result UsageListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new UsageListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { Usage usageInstance = new Usage(); result.Usage.Add(usageInstance); JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); usageInstance.Id = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { UsageCounterName nameInstance = new UsageCounterName(); usageInstance.Name = nameInstance; JToken valueValue2 = nameValue["value"]; if (valueValue2 != null && valueValue2.Type != JTokenType.Null) { string valueInstance = ((string)valueValue2); nameInstance.Value = valueInstance; } JToken localizedValueValue = nameValue["localizedValue"]; if (localizedValueValue != null && localizedValueValue.Type != JTokenType.Null) { string localizedValueInstance = ((string)localizedValueValue); nameInstance.LocalizedValue = localizedValueInstance; } } JToken unitValue = valueValue["unit"]; if (unitValue != null && unitValue.Type != JTokenType.Null) { string unitInstance = ((string)unitValue); usageInstance.Unit = unitInstance; } JToken currentValueValue = valueValue["currentValue"]; if (currentValueValue != null && currentValueValue.Type != JTokenType.Null) { double currentValueInstance = ((double)currentValueValue); usageInstance.CurrentValue = currentValueInstance; } JToken limitValue = valueValue["limit"]; if (limitValue != null && limitValue.Type != JTokenType.Null) { long limitInstance = ((long)limitValue); usageInstance.Limit = limitInstance; } JToken throttleStatusValue = valueValue["throttleStatus"]; if (throttleStatusValue != null && throttleStatusValue.Type != JTokenType.Null) { string throttleStatusInstance = ((string)throttleStatusValue); usageInstance.ThrottleStatus = throttleStatusInstance; } } } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }
public IDirect3DVolumeTexture9 CreateVolumeTexture(int width, int height, int depth, int levels, Usage usage, Format format, Pool pool) { return(CreateVolumeTexture_(width, height, depth, levels, usage, format, pool, IntPtr.Zero)); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="sizeBytes">The size bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static unsafe CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette) { palette = new PaletteEntry[256]; fixed(void *pImageInfo = &imageInformation) return(CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette)); }
public IDirect3DCubeTexture9 CreateCubeTexture(int edgeLength, int levels, Usage usage, Format format, Pool pool) { return(CreateCubeTexture_(edgeLength, levels, usage, format, pool, IntPtr.Zero)); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="pointer">The pointer.</param> /// <param name="sizeInBytes">The size in bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static unsafe CubeTexture CreateFromPointer(Device device, IntPtr pointer, int sizeInBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; D3DX9.CreateCubeTextureFromFileInMemoryEx( device, pointer, sizeInBytes, size, levelCount, (int)usage, format, pool, (int)filter, (int)mipFilter, (Color)colorKey, imageInformation, palette, out cubeTexture); return cubeTexture; }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="fileName">Name of the file.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static CubeTexture CreateFromFile(Device device, string fileName, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; D3DX9.CreateCubeTextureFromFileExW( device, fileName, size, levelCount, (int)usage, format, pool, (int)filter, (int)mipFilter, (Color)colorKey, imageInformation, palette, out cubeTexture); return(cubeTexture); }
/// <exception cref="System.Exception"/> public override int Run(string[] args) { // -directlyAccessNodeLabelStore is a additional option for node label // access, so just search if we have specified this option, and remove it IList <string> argsList = new AList <string>(); for (int i = 0; i < args.Length; i++) { if (args[i].Equals("-directlyAccessNodeLabelStore")) { directlyAccessNodeLabelStore = true; } else { argsList.AddItem(args[i]); } } args = Sharpen.Collections.ToArray(argsList, new string[0]); YarnConfiguration yarnConf = GetConf() == null ? new YarnConfiguration() : new YarnConfiguration (GetConf()); bool isHAEnabled = yarnConf.GetBoolean(YarnConfiguration.RmHaEnabled, YarnConfiguration .DefaultRmHaEnabled); if (args.Length < 1) { PrintUsage(string.Empty, isHAEnabled); return(-1); } int exitCode = -1; int i_1 = 0; string cmd = args[i_1++]; exitCode = 0; if ("-help".Equals(cmd)) { if (i_1 < args.Length) { PrintUsage(args[i_1], isHAEnabled); } else { PrintHelp(string.Empty, isHAEnabled); } return(exitCode); } if (Usage.Contains(cmd)) { if (isHAEnabled) { return(base.Run(args)); } System.Console.Out.WriteLine("Cannot run " + cmd + " when ResourceManager HA is not enabled" ); return(-1); } // // verify that we have enough command line parameters // if ("-refreshAdminAcls".Equals(cmd) || "-refreshQueues".Equals(cmd) || "-refreshNodes" .Equals(cmd) || "-refreshServiceAcl".Equals(cmd) || "-refreshUserToGroupsMappings" .Equals(cmd) || "-refreshSuperUserGroupsConfiguration".Equals(cmd)) { if (args.Length != 1) { PrintUsage(cmd, isHAEnabled); return(exitCode); } } try { if ("-refreshQueues".Equals(cmd)) { exitCode = RefreshQueues(); } else { if ("-refreshNodes".Equals(cmd)) { exitCode = RefreshNodes(); } else { if ("-refreshUserToGroupsMappings".Equals(cmd)) { exitCode = RefreshUserToGroupsMappings(); } else { if ("-refreshSuperUserGroupsConfiguration".Equals(cmd)) { exitCode = RefreshSuperUserGroupsConfiguration(); } else { if ("-refreshAdminAcls".Equals(cmd)) { exitCode = RefreshAdminAcls(); } else { if ("-refreshServiceAcl".Equals(cmd)) { exitCode = RefreshServiceAcls(); } else { if ("-getGroups".Equals(cmd)) { string[] usernames = Arrays.CopyOfRange(args, i_1, args.Length); exitCode = GetGroups(usernames); } else { if ("-addToClusterNodeLabels".Equals(cmd)) { if (i_1 >= args.Length) { System.Console.Error.WriteLine(NoLabelErrMsg); exitCode = -1; } else { exitCode = AddToClusterNodeLabels(args[i_1]); } } else { if ("-removeFromClusterNodeLabels".Equals(cmd)) { if (i_1 >= args.Length) { System.Console.Error.WriteLine(NoLabelErrMsg); exitCode = -1; } else { exitCode = RemoveFromClusterNodeLabels(args[i_1]); } } else { if ("-replaceLabelsOnNode".Equals(cmd)) { if (i_1 >= args.Length) { System.Console.Error.WriteLine(NoMappingErrMsg); exitCode = -1; } else { exitCode = ReplaceLabelsOnNodes(args[i_1]); } } else { exitCode = -1; System.Console.Error.WriteLine(Sharpen.Runtime.Substring(cmd, 1) + ": Unknown command" ); PrintUsage(string.Empty, isHAEnabled); } } } } } } } } } } } catch (ArgumentException arge) { exitCode = -1; System.Console.Error.WriteLine(Sharpen.Runtime.Substring(cmd, 1) + ": " + arge.GetLocalizedMessage ()); PrintUsage(cmd, isHAEnabled); } catch (RemoteException e) { // // This is a error returned by hadoop server. Print // out the first line of the error mesage, ignore the stack trace. exitCode = -1; try { string[] content; content = e.GetLocalizedMessage().Split("\n"); System.Console.Error.WriteLine(Sharpen.Runtime.Substring(cmd, 1) + ": " + content [0]); } catch (Exception ex) { System.Console.Error.WriteLine(Sharpen.Runtime.Substring(cmd, 1) + ": " + ex.GetLocalizedMessage ()); } } catch (Exception e) { exitCode = -1; System.Console.Error.WriteLine(Sharpen.Runtime.Substring(cmd, 1) + ": " + e.GetLocalizedMessage ()); } if (null != localNodeLabelsManager) { localNodeLabelsManager.Stop(); } return(exitCode); }
/// <summary> /// Checks texture-creation parameters. /// </summary> /// <param name="device">Device associated with the texture.</param> /// <param name="size">Requested size of the texture. Null if </param> /// <param name="mipLevelCount">Requested number of mipmap levels for the texture.</param> /// <param name="usage">The requested usage for the texture.</param> /// <param name="format">Requested format for the texture.</param> /// <param name="pool">Memory class where the resource will be placed.</param> /// <returns>A value type containing the proposed values to pass to the texture creation functions.</returns> /// <unmanaged>HRESULT D3DXCheckCubeTextureRequirements([In] IDirect3DDevice9* pDevice,[InOut] unsigned int* pSize,[InOut] unsigned int* pNumMipLevels,[In] unsigned int Usage,[InOut] D3DFORMAT* pFormat,[In] D3DPOOL Pool)</unmanaged> public static CubeTextureRequirements CheckRequirements(Device device, int size, int mipLevelCount, Usage usage, Format format, Pool pool) { var result = new CubeTextureRequirements(); D3DX9.CheckCubeTextureRequirements(device, ref result.Size, ref result.MipLevelCount, (int)usage, ref result.Format, pool); return(result); }
/// <summary> /// Create a umat of the specific type. /// </summary> /// <param name="size">Size of the UMat</param> /// <param name="type">Mat element type</param> /// <param name="channels">Number of channels</param> /// <param name="usage">Allocation Usage</param> public UMat(Size size, CvEnum.DepthType type, int channels, Usage usage = Usage.Default) : this(size.Height, size.Width, type, channels, usage) { }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="sizeBytes">The size bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns>A <see cref="CubeTexture"/></returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static unsafe CubeTexture CreateFromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; sizeBytes = sizeBytes == 0 ? (int)(stream.Length - stream.Position) : sizeBytes; if (stream is DataStream) { cubeTexture = CreateFromPointer( device, ((DataStream)stream).PositionPointer, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, imageInformation, palette ); } else { var data = Utilities.ReadStream(stream); fixed(void *pData = data) cubeTexture = CreateFromPointer( device, (IntPtr)pData, data.Length, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, imageInformation, palette ); } stream.Position = sizeBytes; return(cubeTexture); }
/// <summary> /// Allocates new array data if needed. /// </summary> /// <param name="rows">New number of rows.</param> /// <param name="cols">New number of columns.</param> /// <param name="type">New matrix element depth type.</param> /// <param name="channels">New matrix number of channels</param> /// <param name="usage">Allocation Usage</param> public void Create(int rows, int cols, CvEnum.DepthType type, int channels, Usage usage = Usage.Default) { UMatInvoke.cveUMatCreateData(_ptr, rows, cols, CvInvoke.MakeType(type, channels), usage); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="buffer">The buffer.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static unsafe CubeTexture CreateFromMemory(Device device, byte[] buffer, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; fixed (void* pBuffer = buffer) cubeTexture = CreateFromPointer( device, (IntPtr)pBuffer, buffer.Length, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, imageInformation, palette ); return cubeTexture; }
public async Task Edit(Usage usage) { }
public static ITextSegmentMarker CreateUsageMarker(TextEditor editor, Usage usage) { return(editor.TextMarkerFactory.CreateUsageMarker(editor, usage)); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="sizeBytes">The size bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey) { return(CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, IntPtr.Zero, null)); }
/// <summary> /// Initializes a new instance of the <see cref="CubeTexture"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="edgeLength">Length of the edge.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> public CubeTexture(Device device, int edgeLength, int levelCount, Usage usage, Format format, Pool pool = Pool.Managed) : base(IntPtr.Zero) { device.CreateCubeTexture(edgeLength, levelCount, (int)usage, format, pool, this, IntPtr.Zero); }
public static bool writeReport(Usage usage, Dictionary <string, string> failedTests, int passedTests, string testClass) { //Create our File path int reportEpoch = Utility.getEpoch(); var path = Path.Combine(WebConfigurationManager.AppSettings["reportLocation"], DateTime.Now.Date.ToString("yyyy_MM_dd"), string.Format("Language API Test Report_{0}.txt", reportEpoch)); var dir = Path.GetDirectoryName(path); //Check if the directory in our path is created. If not, create it. if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string fileLoc = string.Format(path); //Check if our file is already created. If not, create it. FileStream fs = null; if (!File.Exists(fileLoc)) { using (fs = File.Create(fileLoc)) { } } //Write test result + API usage report. if (File.Exists(fileLoc)) { using (StreamWriter sw = new StreamWriter(fileLoc)) { sw.Write("detectlanguage.com API Test Report\r\n"); sw.Write("----------------------------------\r\n\r\n"); sw.Write("Test Class: {0}\r\n\r\n", testClass); sw.Write("Passed Tests: {0}\r\n\r\n", passedTests); if (failedTests.Count == 0) { sw.Write("There were no failed test cases during this run!\r\n\r\n\r\n"); } else { sw.Write("Failed Test Cases - {0} total:\r\n\r\n", failedTests.Count); foreach (KeyValuePair <string, string> entry in failedTests) { sw.Write("Test Name: {0}\r\n", entry.Key); sw.Write("Error Message: {0}\r\n\r\n", entry.Value); } } sw.Write("API Usage Report for {0}.\r\n\n", usage.date); sw.Write("----------------------------------\r\n"); sw.Write("Plan Type: {0}, Plan Status: {1}\r\n\n", usage.plan, usage.status); sw.Write("We have used {0} of our {1} daily requests.\r\n\n", usage.requests, usage.dailyRequestsLimit); sw.Write("{0} bytes have been used of our available {1} daily bytes.\r\n\n", usage.bytes, usage.dailyBytesLimit); } } return(true); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="usage">The usage.</param> /// <param name="pool">The pool.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static CubeTexture FromStream(Device device, Stream stream, Usage usage, Pool pool) { return FromStream(device, stream, 0, -1, -1, usage, Format.Unknown, pool, Filter.Default, Filter.Default, 0); }
public SlimTex(Stream Memory, Usage num) { this.tex = this.LoadTexture(new Bitmap(Memory), num); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="sizeBytes">The size bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey) { return CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, IntPtr.Zero, null); }
public SlimTex(string fileName, Usage num) { this.tex = this.LoadTexture(new Bitmap(fileName), num); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="sizeBytes">The size bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> public static unsafe CubeTexture FromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, out ImageInformation imageInformation, out PaletteEntry[] palette) { palette = new PaletteEntry[256]; fixed (void* pImageInfo = &imageInformation) return CreateFromStream(device, stream, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, (IntPtr)pImageInfo, palette); }
public SlimTex(Image src, Usage num) { this.tex = this.LoadTexture(src, num); }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> /// <param name="sizeBytes">The size bytes.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns>A <see cref="CubeTexture"/></returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static unsafe CubeTexture CreateFromStream(Device device, Stream stream, int sizeBytes, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; sizeBytes = sizeBytes == 0 ? (int)(stream.Length - stream.Position) : sizeBytes; if (stream is DataStream) { cubeTexture = CreateFromPointer( device, ((DataStream)stream).PositionPointer, sizeBytes, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, imageInformation, palette ); } else { var data = Utilities.ReadStream(stream); fixed (void* pData = data) cubeTexture = CreateFromPointer( device, (IntPtr)pData, data.Length, size, levelCount, usage, format, pool, filter, mipFilter, colorKey, imageInformation, palette ); } stream.Position = sizeBytes; return cubeTexture; }
internal CommandInfo(string className, string methodName, string[] commandNames, Permission permission, Usage usage) { ClassName = className; MethodName = methodName; CommandNames = commandNames; Permission = permission; Usage = usage; }
/// <summary> /// Creates a <see cref="CubeTexture"/> from a stream. /// </summary> /// <param name="device">The device.</param> /// <param name="fileName">Name of the file.</param> /// <param name="size">The size.</param> /// <param name="levelCount">The level count.</param> /// <param name="usage">The usage.</param> /// <param name="format">The format.</param> /// <param name="pool">The pool.</param> /// <param name="filter">The filter.</param> /// <param name="mipFilter">The mip filter.</param> /// <param name="colorKey">The color key.</param> /// <param name="imageInformation">The image information.</param> /// <param name="palette">The palette.</param> /// <returns> /// A <see cref="CubeTexture"/> /// </returns> /// <unmanaged>HRESULT D3DXCreateCubeTextureFromFileInMemoryEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataSize,[In] unsigned int Size,[In] unsigned int MipLevels,[In] unsigned int Usage,[In] D3DFORMAT Format,[In] D3DPOOL Pool,[In] unsigned int Filter,[In] unsigned int MipFilter,[In] D3DCOLOR ColorKey,[Out] D3DXIMAGE_INFO* pSrcInfo,[Out, Buffer] PALETTEENTRY* pPalette,[In] IDirect3DCubeTexture9** ppCubeTexture)</unmanaged> private static CubeTexture CreateFromFile(Device device, string fileName, int size, int levelCount, Usage usage, Format format, Pool pool, Filter filter, Filter mipFilter, int colorKey, IntPtr imageInformation, PaletteEntry[] palette) { CubeTexture cubeTexture; D3DX9.CreateCubeTextureFromFileExW( device, fileName, size, levelCount, (int)usage, format, pool, (int)filter, (int)mipFilter, (Color)colorKey, imageInformation, palette, out cubeTexture); return cubeTexture; }
/// <summary> /// Create a umat of the specific type. /// </summary> /// <param name="rows">Number of rows in a 2D array.</param> /// <param name="cols">Number of columns in a 2D array.</param> /// <param name="type">Mat element type</param> /// <param name="channels">Number of channels</param> /// <param name="usage">Allocation Usage</param> public UMat(int rows, int cols, CvEnum.DepthType type, int channels, Usage usage = Usage.Default) : this() { Create(rows, cols, type, channels, usage); }