transform(3x)
π NAME π
transform β transformations available for ASImages, living in libAfterImage/transform.h. This is part of the AfterStep X11 window manager family, bestie, so if you see transform(3x) on a shelf somewhere, that's her π.
(fun fact: the raw page literally has a little NAMEtransform hiccup right after this and honestly? she's slaying regardless π)
β¨ SYNOPSIS β¨
Defines transformations that could be performed on ASImage.
π¦ DESCRIPTION π¦
Ok so. Transformations can be performed with different degrees of quality, and that's not a throwaway line β it's the whole vibe.
The internal engine uses 24.8 bits per channel per pixel. The result? No precision loss while you're out here performing complex calculations. And error diffusion algorithms could be used to transform it back into 8 bit without any quality loss either. Obsessed, honestly π .
Here's the cute part: any Transformation could be performed with the result written directly into XImage, so it could be displayed faster. Main character shortcut energy β¨.
Complex interpolation algorithms are used to perform scaling operations β which is the fancy way of saying the quality is very good. And all the transformations are performed in integer math, which gives you greater speeds. On top of that, optional MMX inline assembly has been incorporated into some procedures, and it lets you achieve considerably better performance on compatible CPUs π₯.
π SEE ALSO π
Transformations:
scale_asimage()tile_asimage()merge_layers()make_gradient()flip_asimage()mirror_asimage()pad_asimage()blur_asimage_gauss()fill_asimage()adjust_asimage_hsv()
Other libAfterImage modules:
ascmap.hasfont.hasimage.hasvisual.hblender.hexport.himport.htransform.hximage.h
πΈ AUTHOR πΈ
Sasha Vasko <sasha at aftercode dot net> π
π§ NAME β scale_asimage() π§
libAfterImage/transform/scale_asimage() β scales source ASImage into a new image of requested dimensions. Glow-up machine, no cap.
β SYNOPSIS β
ASImage *scale_asimage( struct ASVisual *asv,
ASImage *src,
unsigned int to_width,
unsigned int to_height,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
π INPUTS π
asvβ pointer to a validASVisualstructuresrcβ the sourceASImageto_widthβ desired width of the resulting imageto_heightβ desired height of the resulting imageout_formatβ optionally describes an alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of the resulting image, in range0-100.qualityβ output quality
π«Ά RETURN VALUE π«Ά
returns newly created and encoded ASImage on success, NULL of failure.
β¨ DESCRIPTION β¨
If the size has to be reduced, then several neighboring pixels will be averaged into a single pixel. If the size has to be increased, then new pixels will be interpolated based on the values of four neighboring pixels. Either way she's eating π.
π EXAMPLE π
ASScale
π NAME β tile_asimage() π
libAfterImage/transform/tile_asimage() β tiles/crops ASImage to the desired size, while optionally tinting it at the same time. Multitasking queen π.
β SYNOPSIS β
ASImage *tile_asimage ( struct ASVisual *asv,
ASImage *src,
int offset_x,
int offset_y,
unsigned int to_width,
unsigned int to_height,
ARGB32 tint,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
π INPUTS π
asvβ pointer to a validASVisualstructuresrcβ the sourceASImageoffset_xβ left clip marginoffset_yβ right clip marginto_widthβ desired width of the resulting imageto_heightβ desired height of the resulting imagetintβ anARGB32value describing the tinting color.out_formatβ optionally describes an alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of the resulting image, in range0-100.qualityβ output quality
π«Ά RETURN VALUE π«Ά
returns newly created and encoded ASImage on success, NULL of failure.
β¨ DESCRIPTION β¨
offset_x and offset_y define the origin on the source image from which tiling will start. Here's the tea: if offset_x or offset_y is outside of the image boundaries, then it will be reduced by a whole number of image sizes to fit inside the image. And at the time of tiling, the image will be tinted unless tint == 0 β so don't come crying when nothing gets tinted, it's literally in the contract π.
π EXAMPLE π
ASTile
π¦ NAME β merge_layers() π¦
libAfterImage/transform/merge_layers() β the layering girlie β¨
β SYNOPSIS β
ASImage *merge_layers ( struct ASVisual *asv,
ASImageLayer *layers, int count,
unsigned int dst_width,
unsigned int dst_height,
ASAltImFormats out_format,
unsigned int compression_out, int quality);
π INPUTS π
asvβ pointer to a validASVisualstructurelayersβ array ofASImageLayerstructures that will be rendered one on top of another. The first element corresponds to the bottommost layer.dst_widthβ desired width of the resulting imagedst_heightβ desired height of the resulting imageout_formatβ optionally describes an alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of the resulting image, in range0-100.qualityβ output quality
π«Ά RETURN VALUE π«Ά
returns newly created and encoded ASImage on success, NULL of failure.
β¨ DESCRIPTION β¨
merge_layers() will create a new ASImage of the requested size. Then it will go through all the layers and fill the image with the composition. The bottommost layer will be used unchanged, and the layers above will be superimposed onto it, using the algorithm specified in the ASImageLayer structure of the overlaying layer.
Layers may have a smaller size than the destination image, and may be placed in arbitrary locations. Each layer will be padded to fit the width of the destination image with all 0, which effectively makes it transparent. Stacking them like stickers on a laptop lid, fr fr π
.
π
NAME β make_gradient() π
libAfterImage/transform/make_gradient() β renders a linear gradient into a new ASImage. Smooth like butter π§.
β SYNOPSIS β
ASImage *make_gradient ( struct ASVisual *asv,
struct ASGradient *grad,
unsigned int width,
unsigned int height,
ASFlagType filter,
ASAltImFormats out_format,
unsigned int compression_out, int quality);
π INPUTS π
asvβ pointer to a validASVisualstructuregradβASGradientstructure defining how the gradient should be drawnwidthβ desired width of the resulting imageheightβ desired height of the resulting imagefilterβ only channels corresponding to set bits will be rendered.out_formatβ optionally describes an alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of the resulting image, in range0-100.qualityβ output quality
π«Ά RETURN VALUE π«Ά
returns newly created and encoded ASImage on success, NULL of failure.
β¨ DESCRIPTION β¨
make_gradient() will create a new image of the requested size and it will fill it with the gradient described in the structure pointed to by grad. Different dithering techniques will be applied to produce nicer-looking gradients. It's giving β¨aestheticβ¨.
π NAME β flip_asimage() π
libAfterImage/transform/flip_asimage() β rotates ASImage in 90 degree increments. Spin her around π«.
β SYNOPSIS β
ASImage *flip_asimage ( struct ASVisual *asv,
ASImage *src,
int offset_x, int offset_y,
unsigned int to_width,
unsigned int to_height,
int flip, ASAltImFormats out_format,
unsigned int compression_out, int quality );
π INPUTS π
asvβ pointer to a validASVisualstructuresrcβ the sourceASImageoffset_xβ left clip marginoffset_yβ right clip marginto_widthβ desired width of the resulting imageto_heightβ desired height of the resulting imageflipβ flip flags determining the degree of rotation.out_formatβ optionally describes an alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of the resulting image, in range0-100.qualityβ output quality
π«Ά RETURN VALUE π«Ά
returns newly created and encoded ASImage on success, NULL of failure.
β¨ DESCRIPTION β¨
flip_asimage() will create a new image of the requested size, then it will tile the source image based on offset_x, offset_y, and the destination size, and then it will rotate it based on the flip value. Three rotation angles are supported: 90, 180 and 270 degrees. That's it, no in-between angles, don't ask π.
π NAME β mirror_asimage() π
libAfterImage/transform/mirror_asimage() β mirror mirror on the wall πͺβ¨
β SYNOPSIS β
ASImage *mirror_asimage ( struct ASVisual *asv,
ASImage *src,
int offset_x, int offset_y,
unsigned int to_width,
unsigned int to_height,
Bool vertical, ASAltImFormats out_format,
unsigned int compression_out, int quality );
π INPUTS π
asvβ pointer to a validASVisualstructuresrcβ the sourceASImageoffset_xβ left clip marginoffset_yβ right clip marginto_widthβ desired width of the resulting imageto_heightβ desired height of the resulting imageverticalβ mirror in vertical direction.out_formatβ optionally describes an alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of the resulting image, in range0-100.qualityβ output quality
π«Ά RETURN VALUE π«Ά
returns newly created and encoded ASImage on success, NULL of failure.
β¨ DESCRIPTION β¨
mirror_asimage() will create a new image of the requested size, it will then tile the source image based on offset_x, offset_y, and the destination size, and then it will mirror it in the vertical or horizontal direction. Flip the whole vibe π¦.
π NAME β pad_asimage() π
libAfterImage/transform/pad_asimage() β enlarges ASImage, padding it with a specified color on each side in accordance with the requested geometry. Personal space, but make it pixels π
.
β SYNOPSIS β
ASImage *pad_asimage( ASVisual *asv, ASImage *src,
int dst_x, int dst_y,
unsigned int to_width,
unsigned int to_height,
ARGB32 color,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
β¦and that's exactly where part 1 taps out, bestie π part 2 is already loading β³β¨
β¨ INPUTS β¨
okay bestie, here's what you're feeding into pad_asimage(), no cap:
asvβ pointer to validASVisualstructure πsrcβ sourceASImageπdst_x,dst_yβ placement of the source image relative to the origin of destination image πto_widthβ width of the destination imageto_heightβ height of the destination imagecolorβARGB32color value to pad with πout_formatβ optionally describes alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc. β¨compression_outβ compression level of resulting image in range0-100π₯qualityβ output quality π
π RETURN VALUE π
returns newly created and encoded ASImage on success, NULL on failure. π
libAfterImage/transform/blur_asimage_gauss()
β¨ NAME: blur_asimage_gauss() β¨
Performs Gaussian blurr of the image ( useful for drop shadows and the likes ). π¦β¨
π SYNOPSIS π
ASImage* blur_asimage_gauss( ASVisual* asv, ASImage* src,
double horz, double vert,
ASAltImFormats out_format,
unsigned int compression_out,
int quality );
π INPUTS π
asvβ pointer to validASVisualstructuresrcβ sourceASImagehorzβ horizontal radius of the blurrvertβ vertical radius of the blurrout_formatβ optionally describes alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of resulting image in range0-100qualityβ output quality
π RETURN VALUE π
returns newly created and encoded ASImage on success, NULL on failure.
libAfterImage/transform/fill_asimage()
β¨ NAME: fill_asimage() β¨
Fills rectangle within the existing ASImage with specified color. π¨
π SYNOPSIS π
Bool fill_asimage( ASVisual *asv, ASImage *im,
int x, int y, int width, int height,
ARGB32 color );
π INPUTS π
asvβ pointer to validASVisualstructureimβASImageto fill with the colorx,yβ left-top corner of the rectangle to fill.width,heightβ size of the rectangle to fill.colorβARGB32color value to fill rectangle with.
π RETURN VALUE π
True on success, False on failure. π
libAfterImage/transform/adjust_asimage_hsv()
β¨ NAME: adjust_asimage_hsv() β¨
adjusts image color properties in HSV colorspace π
π SYNOPSIS π
ASImage *adjust_asimage_hsv( ASVisual *asv, ASImage *src,
int offset_x, int offset_y,
unsigned int to_width,
unsigned int to_height,
unsigned int affected_hue,
unsigned int affected_radius,
int hue_offset, int saturation_offset,
int value_offset,
ASAltImFormats out_format,
unsigned int compression_out, int quality);
π INPUTS π
asvβ pointer to validASVisualstructuresrcβASImageto adjust colors of.offset_x,offset_yβ position on infinite surface tiled with original image, of the left-top corner of the area to be used for new image.to_width,to_heightβ size of the area of the original image to be used for new image.affected_hueβ hue in degrees in range0-360. This allows one to limit impact of color adjustment to affect only limited range of hues. π―affected_radiusβ Sets the diapason of the range of affected hues.hue_offsetβ value by which to change hues in affected range.saturation_offsetβ value by which to change saturation of the pixels in affected hue range.value_offsetβ value by which to change Value(brightness) of pixels in affected hue range.out_formatβ optionally describes alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of resulting image in range0-100.qualityβ output quality.
π RETURN VALUE π
returns newly created and encoded ASImage on success, NULL on failure.
π« DESCRIPTION π«
This function will tile original image to specified size with offsets requested, and then it will go though it and adjust hue, saturation and value of those pixels that have specific hue, set by affected_hue/affected_radius parameters. When affected_radius is greater then 180 entire image will be adjusted. Note that since grayscale colors have no hue β the will not get adjusted. Only saturation and value will be adjusted in gray pixels. Hue is measured as an angle on a 360 degree circle, The following is relationship of hue values to regular color names : red - 0 yellow - 60 green - 120 cyan - 180 blue - 240 magenta - 300 red - 360
All the hue values in parameters will be adjusted to fall within 0-360 range. π
libAfterImage/transform/colorize_asimage_vector()
β¨ NAME: colorize_asimage_vector() β¨
creates ASImage from double precision indexed image data - useful for scientific visualisation. π¬
π SYNOPSIS π
Bool colorize_asimage_vector( ASVisual *asv, ASImage *im,
ASVectorPalette *palette,
ASAltImFormats out_format,
int quality );
π INPUTS π
asvβ pointer to validASVisualstructureimβASImageto update.paletteβ palette to be used in conversion of double precision values into colors.out_formatβ optionally describes alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.qualityβ output quality
π RETURN VALUE π
True on success, False on failure.
π« DESCRIPTION π«
This function will try to convert double precision indexed image data into actuall color image using palette. Original data should be attached to ASImage using vector member. Operation is relatively fast and allows representation of scientific data as color image with dynamically changing palette. π§ͺ
libAfterImage/transform/create_asimage_from_vector()
β¨ NAME: create_asimage_from_vector() β¨
convenience function allowing one to create new ASImage, set its vector data and colorize it using palette - all in one step. πͺ
π SYNOPSIS π
ASImage *create_asimage_from_vector( ASVisual *asv, double *vector,
unsigned int width,
unsigned int height,
ASVectorPalette *palette,
ASAltImFormats out_format,
unsigned int compression,
int quality );
π INPUTS π
asvβ pointer to validASVisualstructurevectorβ data to be attached to newASImageand used to generate RGB imagewidth,heightβ size of the new image.paletteβ palette to be used in conversion of double precision values into colors.out_formatβ optionally describes alternativeASImageformat that should be produced as the result βXImage,ARGB32, etc.compression_outβ compression level of resulting image in range0-100.qualityβ output quality
π RETURN VALUE π
New ASImage on success, NULL on failure.
π SEE ALSO π
colorize_asimage_vector(), create_asimage(), set_asimage_vector()
libAfterImage/transform/slice_asimage2()
β¨ NAME: slice_asimage2() β¨
slice ASImage leaving its corners intact, and scaling the middle part. π§©
π SYNOPSIS π
ASImage* slice_asimage2( ASVisual *asv, ASImage *src,
int slice_x_start, int slice_x_end,
int slice_y_start, int slice_y_end,
int to_width,
int to_height,
Bool scaled,
ASAltImFormats out_format,
unsigned int compression_out, int quality );
π INPUTS π
asvβ pointer to validASVisualstructuresrcβ sourceASImage.slice_x_startβ ending of the left cornersslice_x_endβ beginning of the right cornersslice_y_startβ ending of the top cornersslice_y_endβ beginning of the bottom cornersto_widthβ width of the generated image;to_heightβ height of the generated image;scaledβ ifTrue- middle part of the image will be scaled, otherwise - tiled;out_formatβ optionally describes alternativeASImageformat that should be produced as the result -XImage,ARGB32, etc.;compression_outβ compression level of resulting image in range0-100;qualityβ output quality.
π RETURN VALUE π
New ASImage on success, NULL on failure.
π SEE ALSO π
scale_asimage(), tile_asimage()
and that's the whole vibe, bestie π
β¨ this page is from the 3rd Berkeley Distribution, it's for AfterStep v.2.2.12, and it's the transform(3x) manual β no date on the footer, but the energy is lowkey timeless ππ¦
π¦ 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