Sack Library Documentation
ContentsIndexReferenceHome
PreviousUpNext
sack::image::DecodeMemoryToImage Function
C++
__cdecl IMAGE_PROC Image DecodeMemoryToImage(P_8 buf, _32 size);
Image (* DecodeMemoryToImage)(P_8 buf, _32 size);
Parameters 
Description 
P_8 buf 
Pointer to bytes of data to decode 
_32 size 
the size of the buffer to decode 

NULL is returned if the data does not decode as an image

an Image is returned otherwise.

Decodes a block of memory into an image. This is used internally so, LoadImageFile() opens the file and reads it into a buffer, which it then passes to DecodeMemoryToImage(). Images stored in custom user structures may be passed for decoding also.

This pretends that you have a FILE* open to some image already, and that the image is tiny (less than 4k bytes).

char buffer[4096];
int length;
length = fread( buffer, 1, 4096, some_file );
      
Image image = DecodeMemoryToImage( buffer, length );
if( image )
{
   // buffer decoded okay.
}
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!