ximage(3x)
β¨ NAME β¨
okay so bestie, welcome to ximage(3x) β yep, that's the section 3 page from the AfterStep X11 window manager, and it's all about the libAfterImage module that hangs out in libAfterImage/ximage.h. π
ximage β functionality for displaying ASImages on X display
libAfterImage/ximage.h
π NAME β ximage π
ok so this bit defines the whole conversion pipeline both ways: X stuff into ASImages, and ASImages back out into X stuff. Defines conversion to and from XImages and Pixmaps. β¨
π DESCRIPTION π
here's the whole friend group, one by one, and what each of them does:
ximage2asimage()β convert XImage structure into ASImagepixmap2asimage()β convert X11 pixmap into ASImageasimage2ximage()β convert ASImage into XImageasimage2mask_ximage()β convert alpha channel of ASImage into XImageasimage2pixmap()β convert ASImage into Pixmap (possibly using precreated XImage)asimage2mask()β convert alpha channel of ASImage into 1 bit mask Pixmap.
π SEE ALSO π
Other libAfterImage modules, aka the rest of the extended universe π¦:
ascmap.h asfont.h asimage.h asvisual.h blender.h export.h import.h transform.h ximage.h
π AUTHOR π
Sasha Vasko <sasha at aftercode dot net> β the icon who wrote all this, no cap. π«Ά
π libAfterImage/picture_ximage2asimage()
β¨ NAME β¨ β picture_ximage2asimage()
π SYNOPSIS π
ASImage *picture_ximage2asimage ( struct ASVisual *asv,
XImage * xim, XImage *alpha_xim,
unsigned int compression );
π§ INPUTS π§
asvβ pointer to valid ASVisual structureximβ source XImagealpha_ximβ source XImage for Alpha channelcompressionβ degree of compression of resulting ASImage.
π RETURN VALUE π
pointer to newly allocated ASImage, containing encoded data, on success. NULL on failure.
π DESCRIPTION π
picture_ximage2asimage will attempt to create new ASImage with the same dimensions as supplied XImage. If both XImages are supplied β they must have same dimensions. XImage will be decoded based on supplied ASVisual, and resulting scanlines will be encoded into ASImage. β¨
fr fr: if you hand it two XImages, they must match in size. no exceptions, bestie.
π libAfterImage/ximage2asimage()
β¨ NAME β¨ β ximage2asimage()
same as picture_ximage2asimage with alpha_ximage set to NULL. Supplied for compatibility with older versions and for convenience. πΈ
π SYNOPSIS π
ASImage *ximage2asimage ( struct ASVisual *asv, XImage * xim,
unsigned int compression );
π§ INPUTS π§
asvβ pointer to valid ASVisual structureximβ source XImagecompressionβ degree of compression of resulting ASImage.
π RETURN VALUE π
pointer to newly allocated ASImage, containing encoded data, on success. NULL on failure.
π DESCRIPTION π
(no alpha, no drama β it's the streamlined version of the big one up top π«Ά)
π libAfterImage/pixmap2asimage()
β¨ NAME β¨ β pixmap2asimage()
π SYNOPSIS π
ASImage *pixmap2ximage( ASVisual *asv, Pixmap p, int x, int y,
unsigned int width, unsigned int height,
unsigned long plane_mask,
unsigned int compression);
π§ INPUTS π§
asvβ pointer to valid ASVisual structurepβ source Pixmapx,y,width,heightβ rectangle on Pixmap to be encoded into ASImage.plane_maskβ limits color planes to be copied from Pixmap.keep_cacheβ indicates if we should keep XImage, used to copy image data from the X server, and attached it toximagemember of resulting ASImage.compressionβ degree of compression of resulting ASImage.
π RETURN VALUE π
pointer to newly allocated ASImage, containing data in XImage format, on success. NULL on failure.
π DESCRIPTION π
pixmap2ximage will obtain XImage of the requested area of the X Pixmap, and it will attach it to newly created ASImage using alt.ximage member. After that newly created ASImage could be used in any transformations. π₯
π libAfterImage/pixmap2asimage()
β¨ NAME β¨ β pixmap2asimage()
π SYNOPSIS π
ASImage *pixmap2asimage ( struct ASVisual *asv, Pixmap p,
int x, int y,
unsigned int width,
unsigned int height,
unsigned long plane_mask,
Bool keep_cache,
unsigned int compression );
π§ INPUTS π§
asvβ pointer to valid ASVisual structurepβ source Pixmapx,y,width,heightβ rectangle on Pixmap to be encoded into ASImage.plane_maskβ limits color planes to be copied from Pixmap.keep_cacheβ indicates if we should keep XImage, used to copy image data from the X server, and attached it toximagemember of resulting ASImage.compressionβ degree of compression of resulting ASImage.
π RETURN VALUE π
pointer to newly allocated ASImage, containing encoded data, on success. NULL on failure.
π DESCRIPTION π
same as picture2asimage() with alpha pixmap set to None. Supplied for compatibility and convenience. π
π libAfterImage/picture2asimage()
β¨ NAME β¨ β picture2asimage()
π SYNOPSIS π
ASImage *picture2asimage (struct ASVisual *asv,
Pixmap rgb, Pixmap a,
int x, int y,
unsigned int width,
unsigned int height,
unsigned long plane_mask,
Bool keep_cache,
unsigned int compression );
π§ INPUTS π§
asvβ pointer to valid ASVisual structurergbβ source Pixmap for red, green and blue channelsaβ source Pixmap for the alpha channelx,y,width,heightβ rectangle on Pixmap to be encoded into ASImage.plane_maskβ limits color planes to be copied from Pixmap.keep_cacheβ indicates if we should keep XImage, used to copy image data from the X server, and attached it toximagemember of resulting ASImage.compressionβ degree of compression of resulting ASImage.
π RETURN VALUE π
pointer to newly allocated ASImage, containing encoded data, on success. NULL on failure.
π DESCRIPTION π
picture2asimage will obtain XImage of the requested area of the X Pixmap. If alpha channel pixmap is supplied β it will be used to encode ASImage's alpha channel. Alpha channel pixmap must be either 8 or 1 bit deep, and it must have the same dimensions as main Pixmap. π
not me stressing the rules again but: alpha pixmap = 8 or 1 bit deep AND same dimensions as the main Pixmap. that's the vibe check, bestie. β
π libAfterImage/asimage2ximage()
β¨ NAME β¨ β asimage2ximage()
π SYNOPSIS π
XImage *asimage2ximage (struct ASVisual *asv, ASImage *im);
π§ INPUTS π§
asvβ pointer to valid ASVisual structureimβ source ASImage
π RETURN VALUE π
On success returns newly created and encoded XImage of the same colordepth as the supplied ASVisual. NULL on failure.
π DESCRIPTION π
asimage2ximage() creates new XImage of the exact same size as supplied ASImage, and depth of supplied ASVisual. Red, Green and Blue channels of ASImage then gets decoded, and encoded into XImage. Missing scanlines get filled with black color. π€
π NOTES π
Returned pointer to XImage will also be stored in im->alt.ximage, and It will be destroyed when XImage is destroyed, or reused in any subsequent calls to asimage2ximage(). If any other behaviour is desired β make sure you set im->alt.ximage to NULL, to dissociate XImage object from ASImage. β οΈ
the way this sneaky little pointer tucks itself intoim->alt.ximage... if you want your own life, set it toNULL. periodt.
π SEE ALSO π
create_visual_ximage()
π libAfterImage/asimage2alpha_ximage()
β¨ NAME β¨ β asimage2alpha_ximage()
π SYNOPSIS π
XImage *asimage2alpha_ximage (struct ASVisual *asv,
ASImage *im, Bool bitmap);
π§ INPUTS π§
asvβ pointer to valid ASVisual structureimβ source ASImagebitmapβ ifTrueresulting XImage will have depth of 1 bit β traditional X mask; otherwise it will have depth of 8 (useful for XFree86 RENDER extension)
π RETURN VALUE π
On success returns newly created and encoded XImage of the depth 1 or 8. NULL on failure.
π DESCRIPTION π
asimage2alpha_ximage() creates new XImage of the exact same size as supplied ASImage, and depth 1 or 8. Alpha channels of ASImage then gets decoded, and encoded into XImage. In case requested depth is 1 then alpha channel is interpreted like so: 127 or greater is encoded as 1, otherwise as 0. Missing scanlines get filled with 1s as they signify absence of mask. β¨
π NOTES π
Returned pointer to XImage will also be stored in im->alt.mask_ximage, and It will be destroyed when XImage is destroyed, or reused in any subsequent calls to asimage2mask_ximage(). If any other behaviour is desired β make sure you set im->alt.mask_ximage to NULL, to dissociate XImage object from ASImage. π«Ά
π libAfterImage/asimage2mask_ximage()
β¨ NAME β¨ β asimage2mask_ximage()
same as asimage2alpha_ximage(). Supplied for convenience and compatibility with older versions. πΈ
π SYNOPSIS π
XImage *asimage2mask_ximage (struct ASVisual *asv, ASImage *im);
π§ INPUTS π§
asvβ pointer to valid ASVisual structureimβ source ASImage
π RETURN VALUE π
On success returns newly created and encoded XImage of the depth 1. NULL on failure.
π libAfterImage/asimage2pixmap()
β¨ NAME β¨ β asimage2pixmap()
π SYNOPSIS π
Bool asimage2drawable( struct ASVisual *asv, Drawable d, ASImage *im,
GC gc,
int src_x, int src_y, int dest_x, int dest_y,
unsigned int width, unsigned int height,
Bool use_cached);
π§ INPUTS π§
asvβ pointer to valid ASVisual structuredβ destination drawable β Pixmap or Windowimβ source ASImagegcβ precreated GC to use for XImage transfer. IfNULL,asimage2drawable()will useDefaultGC.src_xβ Specifies the offset in X from the left edge of the image defined by the ASImage structure.src_yβ Specifies the offset in Y from the top edge of the image defined by the ASImage structure.dest_x,dest_yβ Specify the x and y coordinates, which are relative to the origin of the drawable and are the coordinates of the subimage.width,heightβ Specify the width and height of the subimage, which define the dimensions of the rectangle.use_cachedβ IfTruewill makeasimage2pixmap()to use XImage attached to ASImage, instead of creating new one. Only works ifASImage->ximagedata member is notNULL.
π RETURN VALUE π
On success returns True.
π DESCRIPTION π
asimage2drawable() creates will copy portion of ASImage onto the X Drawable. It checks if it needs to encode XImage from ASImage data, and calls asimage2ximage() if yes, it has to. It then supplied gc or DefaultGC of the screen to transfer XImage to the server. Missing scanlines get filled with black color. π
π SEE ALSO π
asimage2ximage() asimage2pixmap() create_visual_pixmap()
π libAfterImage/asimage2pixmap()
β¨ NAME β¨ β asimage2pixmap()
π SYNOPSIS π
Pixmap asimage2pixmap ( struct ASVisual *asv, Window root,
ASImage *im, GC gc, Bool use_cached);
β¨ INPUTS β¨
okay so here's the lil shopping list of what you gotta hand over, no substitutions bestie π
asvβ pointer to a validASVisualstructure π«Άrootβ root window of the destination screen πΈimβ the sourceASImage(the pic in question, the moment itself) πgcβ a precreatedGCto use for theXImagetransfer. If it'sNULL,asimage2pixmap()will just useDefaultGCinstead. no biggie β¨use_cachedβ ifTrue, this makesasimage2pixmap()use theXImageattached to theASImageinstead of making a brand new one. β οΈ it only works if theASImage->ximagedata member is notNULLβ so like, check first, don't just yolo it π
π« RETURN VALUE π«
slay on success, it hands you back a newly pixmap with the exact same colordepth as ASVisual. π
and on failure? None. literally nothing. the void. π
π DESCRIPTION π
okay so asimage2pixmap() makes a new pixmap that's exactly the same size as the ASImage you gave it. then it calls asimage2drawable to copy the entire content of the ASImage onto that freshly created pixmap. whole thing. every pixel. no crumbs left behind. β¨
π EXAMPLE π
live footage of it being used irl:
asview.c: ASView.5
π¦ SEE ALSO π¦
go read these too, i'm obsessed with them fr fr:
asimage2ximage()asimage2drawable()create_visual_pixmap()libAfterImage/asimage2mask()
π NAME asimage2mask() π
π SYNOPSIS π
Pixmap asimage2mask ( struct ASVisual *asv, Window root,
ASImage *im, GC gc, Bool use_cached);
π the arg breakdown π
asvβ pointer to a validASVisualstructurerootβ root window of the destination screenimβ sourceASImagegcβ a precreatedGCfor 1 bit deep drawables, used for theXImagetransfer. If it'sNULL,asimage2mask()will create one itself. girlboss behaviour πuse_cachedβ ifTrue,asimage2mask()will use the maskXImageattached to theASImageinstead of creating a new one. β οΈ only works if theASImage->alt.mask_ximagedata member is notNULL.
β RETURN VALUE β
on success you get a newly created pixmap with the colordepth 1. yes queen, one bit and thriving. π
on failure: None. that's it. that's the whole story. π
πΈ DESCRIPTION πΈ
so asimage2mask() creates a new pixmap that is exactly the same size as the ASImage you supplied. then it calls asimage2mask_ximage(). β¨
after that it takes the gc you gave it β or makes a new gc if you didn't β and uses it to transfer the XImage over to the server and put it onto the Pixmap. ππ¨
oh and heads up: missing scanlines get filled with 1s. that's just how it do. no cap. π©Ή
π₯ SEE ALSO π₯
asimage2mask_ximage()
<div align="center">this masterpiece comes to you from the 3rd Berkeley Distribution, riding with AfterStep v.2.2.12, and it's the ximage(3x) page you just read every last crumb of. go forth and mask, bestie π«Άππ§ββοΈ</div>
π¦ where this page comes from
- ubuntu resolute: libafterimage-dev 2.2.12-19 Β· GPL-2.0-or-later
- ubuntu stonking: libafterimage-dev 2.2.12-19 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms