Saves a previously loaded FreeImage bitmap to a stream.
The stream must be set to the correct position before calling SaveToStream.
Namespace:
FreeImageAPIAssembly: FreeImageNET (in FreeImageNET.dll)
Syntax
C# |
---|
public static bool SaveToStream( ref FIBITMAP dib, Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_SAVE_FLAGS flags, FREE_IMAGE_COLOR_DEPTH colorDepth, bool unloadSource ) |
Visual Basic (Declaration) |
---|
Public Shared Function SaveToStream ( _ ByRef dib As FIBITMAP, _ stream As Stream, _ format As FREE_IMAGE_FORMAT, _ flags As FREE_IMAGE_SAVE_FLAGS, _ colorDepth As FREE_IMAGE_COLOR_DEPTH, _ unloadSource As Boolean _ ) As Boolean |
Visual C++ |
---|
public: static bool SaveToStream( FIBITMAP% dib, Stream^ stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_SAVE_FLAGS flags, FREE_IMAGE_COLOR_DEPTH colorDepth, bool unloadSource ) |
Parameters
- dib
- Type:
FreeImageAPI..::.FIBITMAP
%
Handle to a FreeImage bitmap.
- stream
- Type: System.IO..::.Stream
The stream to write to.
- format
- Type: FreeImageAPI..::.FREE_IMAGE_FORMAT
Format of the image.
- flags
- Type: FreeImageAPI..::.FREE_IMAGE_SAVE_FLAGS
Flags to enable or disable plugin-features.
- colorDepth
- Type: FreeImageAPI..::.FREE_IMAGE_COLOR_DEPTH
The new color depth of the bitmap. Set to FICD_AUTO if SaveToStream should take the best suitable color depth. If a color depth is selected that the provided format cannot write an error-message will be thrown.
- unloadSource
- Type: System..::.Boolean
When true the structure will be unloaded on success.
Return Value
Returns true on success, false on failure.
Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | dib or stream is null. |
System..::.ArgumentException | stream cannot write. |