Click or drag to resize
Ab4d.SharpEngine logo

GpuImage Class

GpuImage represents an image that is stored in the graphics card's memory.
Inheritance Hierarchy

Namespace: Ab4d.SharpEngine.Core
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public class GpuImage : GpuDeviceComponent, IDisposable

The GpuImage type exposes the following members.

Constructors
Properties
 NameDescription
Public propertyHasTransparentPixels Gets or sets (only at init time) a Boolean that indicates that the GpuImage has some transparent pixels, e. g. pixels with alpha color smaller than 1. This means that to show this GpuImage correctly some alpha-blending technique is required.
Public propertyHeight Height of the image in pixels
Public propertyImage Gets the Vulkan Image.
Public propertyImageMemory Gets the VulkanMemoryInfo that represents the memory location of the buffer
Public propertyImageView Gets the Vulkan ImageView.
Public propertyIsGpuDeviceCached Gets a Boolean that indicates that this GpuImage is cashed by the GpuDevice objects and cannot be disposed by calling Dispose method. This means the GpuImage can be shared without worrying that someone will dispose this GpuImage or that it will be disposed when the Scene is disposed. This flag is set when the GpuImage is cached by calling CacheObject(String, Object) method. By default the Source is used as the cache key. The GpuImage will be disposed when the GpuDevice will be disposed or if it is removed from the cache and then disposed.
Public propertyIsPreMultipliedAlpha Gets or sets (only at init time) a Boolean that indicates that the colors in this GpuImage are alpha-premultiplied. This means that the red, green and blue values are multiplied by the alpha value.
Public propertyIsSceneCached Gets a Boolean that indicates that this GpuImage is cashed by Scene objects and cannot be disposed by calling Dispose method. This means the GpuImage can be shared without worrying that someone will dispose this GpuImage. This flag is set when the GpuImage is cached by calling Scene.CacheObject(String, Object) method. By default the Source is used as the cache key. The GpuImage will be disposed when the Scene will be disposed or if it is removed from the cache and then disposed.
Public propertyMemoryProperties Gets the MemoryPropertyFlags that were used to crate this GpuImage.
Public propertyMemorySize User memory size in bytes
Public propertySource Source can contain file name or other string that defines the source of this GpuImage.
Public propertyWidth Width of the image in pixels
Top
Methods
 NameDescription
Public methodCopyDataFromImage Returns a new RawImageData with data from this image (stored in GPU memory). When the image data cannot be retrieved, then null is returned.
Public methodCopyDataFromImage(Byte, Int64, Int32, Boolean) Copies data from image (stored in GPU memory) to the specified byte array. Returns true when data was copied, otherwise false is returned (when image cannot be copied from GPU memory).
Public methodCopyDataToImage(Byte) Copies the data from the specified byte array to this image.
Public methodCopyDataToImage(Byte, Boolean) Copies the data from the specified byte array to this image.
Public methodCopyDataToImage(Byte, ImageLayout, AccessFlags, PipelineStageFlags) Copies the data from the specified byte array to this image and set the layout of the image to the specified values.
Public methodCopyDataToImageMipMaps Copies the data from the array of byte array to the mip maps of this image.
Public methodDispose 
Protected methodDispose(Boolean) Dispose
(Overrides ComponentBaseDispose(Boolean))
Public methodGetCurrentImageLayoutAndFlags Gets the current image layout
Public methodStatic memberGetImageAspectFlags Returns the ImageAspectFlags for the specified format.
Public methodGetImageLayout Returns information about the layout of the image for the specified mip level.
Public methodGetImageRowStride Returns a row stride (number of bytes in one row of image data) of the image for the specified mip level.
Public methodGetMappedMemoryPtr Returns an IntPtr of the mapped memory. The IntPtr can be used to get the content of this image or to copy new content to that location. After using the memory call UnmapMemory method.
Public methodGetMappedMemoryPtr(Int64, Int64) Returns an IntPtr of the mapped memory with specified offset and size. The IntPtr can be used to get the content of this image or to copy new content to that location. After using the memory call UnmapMemory method.
Public methodGetMappedMemorySpan Returns a Span that can be used to get the content of this image or copy new content to that location. After using the memory call UnmapMemory method.
Public methodGetMappedMemorySpan(Void, Byte) 
Public methodResize Resizes this image
Public methodToString
(Overrides ObjectToString)
Public methodUnmapMemory Unmaps the memory that was mapped by calling GetMappedMemoryPtr.
Top
Fields
 NameDescription
Public fieldStatic memberAlwaysAllowCopyFromGpuImage Gets or sets a static Boolean that specifies if GpuImages are always created with usage mode that allows copying data from the image (using CopyDataFromImage method). Note that when this value is set to false, it will be still possible to copy from most of the GpuImages (from all of those that have generated mip-maps; only images without mip-maps or with predefined mip-maps data will not allow copying of the data). Default value is true.
Public fieldImageCreateInfo Gets the ImageCreateInfo that was used to create this GpuImage
Top
See Also