logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

import - functionality for reading images from files libAfterImage/import.h

Author

       Sasha Vasko <sasha at aftercode dot net>
       libAfterImage/gamma

Description

       file2pixmap() will attempt to open specified file and autodetect its format. If format is known  it  will
       load  it  into  ASImage  first, and then convert it into X Pixmap. In case image has alpha channel - mask
       Pixmap will be produced if mask_out is not NULL.

3rd Berkeley Distribution                      AfterStep v.2.2.12                                     import(3x)

Example

       asview.c: ASView.2
       libAfterImage/import/get_asimage()

Inputs

       asv    - pointer to valid ASVisual structure.

       root   - root window ID for the destination screen.

       realfilename
              - full image file's name with path.

Name

import - functionality for reading images from files libAfterImage/import.h

Nameasimagefiletypes

       - List of known image file formats.

Nameasimagelistentry

       - entry in linked list of images loaded from single directory.

Namefile2Asimage()

       - load ASImage from file.

Namefile2Pixmap()

       - convenience function to load file into X Pixmap.

Nameget_Asimage()

       - increment reference counter if file is already loaded, or load image from file.

Nameimport

       - Image file format autodetection, reading and decoding routines.

Namescreen_Gamma

       - Defines default value for screen gamma correction.

Return Value

       Pixmap  ID  of the X Pixmap filled with loaded image. If mask_out is not NULL it will point to image mask
       Pixmap ID if there is an alpha channel in image, None otherwise.  On failure None will be returned.

See Also

       file2ASImage()
       libAfterImage/import/file2pixmap()

Source

           typedef  struct  ASImageListEntryBuffer { #define ASILEB_Dirty        (0x01<<0) #define ASILEB_Binary
           (0x01<<1)

               ASFlagType flags ;

               size_t size ;
               char  *data ;

           }ASImageListEntryBuffer;

           typedef struct ASImageListEntry  {  #define  MAGIC_ASIMAGE_LIST_ENTRY             0xA3A311E4  #define
           IS_ASIMAGE_LIST_ENTRY(e)  (((e)!=NULL)&&((e)->magic==MAGIC_ASIMAGE_LIST_ENTRY)&&((e)->ref_count>0))

               unsigned long magic ;
               struct ASImageListEntry *prev, *next ;
               char   *name ;
               char   *fullfilename ;

               ASImageFileTypes    type;
               ASImage            *preview;

           #ifndef _WIN32
               mode_t d_mode; #endif
               time_t d_mtime;
               off_t  d_size;      /* total size, in bytes */

               ASImageListEntryBuffer *buffer ;

               int ref_count; }ASImageListEntry;

       libAfterImage/import/file2ASImage()

Synopsis

       Pixmap file2pixmap( struct ASVisual *asv, Window root,
                           const char *realfilename,
                           Pixmap *mask_out);

See Also