// Copyright (c) Wojciech Figat. All rights reserved. namespace FlaxEngine { unsafe partial struct PixelFormatSampler { /// /// Element format. /// public PixelFormat Format; /// /// Element size in bytes. /// public int PixelSize; /// /// Read data function. /// public delegate* unmanaged Read; /// /// Write data function. /// public delegate* unmanaged Write; /// /// Tries to get a sampler tool for the specified format to read pixels. /// /// The format. /// The sampler object or empty when cannot sample the given format. /// True if got sampler, otherwise false. public static bool Get(PixelFormat format, out PixelFormatSampler sampler) { PixelFormatExtensions.Internal_GetSamplerInternal(format, out var pixelSize, out var read, out var write); sampler = new PixelFormatSampler { Format = format, PixelSize = pixelSize, Read = (delegate* unmanaged)read.ToPointer(), Write = (delegate* unmanaged)write.ToPointer(), }; return pixelSize != 0; } } }