Logo Search packages:      
Sourcecode: adesklets version File versions

Imlib_Image imlib_load_image_with_error_return ( const char *  file,
Imlib_Load_Error *  error_return 
)

Parameters:
file Image file.
error_return The returned error.
Returns:
An image handle.
Loads an image at the path file on disk. If it succeeds it returns a valid image handle, if not NULL is returned and error_return is set to the detail of the error.

Definition at line 1763 of file imlib2.c.

{
   Imlib_Image         im = NULL;
   ImlibLoadError      er;
   Imlib_Image         prev_ctxt_image;

   if (!ctx)
      ctx = imlib_context_new();
   CHECK_PARAM_POINTER_RETURN("imlib_load_image_with_error_return", "file",
                              file, NULL);
   if (!__imlib_FileExists(file))
     {
        *error_return = IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST;
        return NULL;
     }
   if (__imlib_FileIsDir(file))
     {
        *error_return = IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY;
        return NULL;
     }
   if (!__imlib_FileCanRead(file))
     {
        *error_return = IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ;
        return NULL;
     }
   prev_ctxt_image = ctx->image;
   im = (Imlib_Image) __imlib_LoadImage(file,
                                        (ImlibProgressFunction)
                                        ctx->progress_func,
                                        ctx->progress_granularity, 1, 0, &er);
   ctx->image = prev_ctxt_image;
   if (im)
      *error_return = IMLIB_LOAD_ERROR_NONE;
   else
     {
        if (er == IMLIB_LOAD_ERROR_NONE)
           *error_return = IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT;
        else
           *error_return = (Imlib_Load_Error) er;
     }
   return im;
}


Generated by  Doxygen 1.6.0   Back to index