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.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> πŸ’Œ



🧚 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 valid ASVisual structure
  • src β€” the source ASImage
  • to_width β€” desired width of the resulting image
  • to_height β€” desired height of the resulting image
  • out_format β€” optionally describes an alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of the resulting image, in range 0-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 valid ASVisual structure
  • src β€” the source ASImage
  • offset_x β€” left clip margin
  • offset_y β€” right clip margin
  • to_width β€” desired width of the resulting image
  • to_height β€” desired height of the resulting image
  • tint β€” an ARGB32 value describing the tinting color.
  • out_format β€” optionally describes an alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of the resulting image, in range 0-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 valid ASVisual structure
  • layers β€” array of ASImageLayer structures that will be rendered one on top of another. The first element corresponds to the bottommost layer.
  • dst_width β€” desired width of the resulting image
  • dst_height β€” desired height of the resulting image
  • out_format β€” optionally describes an alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of the resulting image, in range 0-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 valid ASVisual structure
  • grad β€” ASGradient structure defining how the gradient should be drawn
  • width β€” desired width of the resulting image
  • height β€” desired height of the resulting image
  • filter β€” only channels corresponding to set bits will be rendered.
  • out_format β€” optionally describes an alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of the resulting image, in range 0-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 valid ASVisual structure
  • src β€” the source ASImage
  • offset_x β€” left clip margin
  • offset_y β€” right clip margin
  • to_width β€” desired width of the resulting image
  • to_height β€” desired height of the resulting image
  • flip β€” flip flags determining the degree of rotation.
  • out_format β€” optionally describes an alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of the resulting image, in range 0-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 valid ASVisual structure
  • src β€” the source ASImage
  • offset_x β€” left clip margin
  • offset_y β€” right clip margin
  • to_width β€” desired width of the resulting image
  • to_height β€” desired height of the resulting image
  • vertical β€” mirror in vertical direction.
  • out_format β€” optionally describes an alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of the resulting image, in range 0-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 valid ASVisual structure πŸ’…
  • src β€” source ASImage πŸŽ€
  • dst_x, dst_y β€” placement of the source image relative to the origin of destination image πŸ“
  • to_width β€” width of the destination image
  • to_height β€” height of the destination image
  • color β€” ARGB32 color value to pad with 🌈
  • out_format β€” optionally describes alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc. ✨
  • compression_out β€” compression level of resulting image in range 0-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 valid ASVisual structure
  • src β€” source ASImage
  • horz β€” horizontal radius of the blurr
  • vert β€” vertical radius of the blurr
  • out_format β€” optionally describes alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of resulting image in range 0-100
  • quality β€” 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 valid ASVisual structure
  • im β€” ASImage to fill with the color
  • x, y β€” left-top corner of the rectangle to fill.
  • width, height β€” size of the rectangle to fill.
  • color β€” ARGB32 color 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 valid ASVisual structure
  • src β€” ASImage to 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 range 0-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 alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of resulting image in range 0-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 valid ASVisual structure
  • im β€” ASImage to update.
  • palette β€” palette to be used in conversion of double precision values into colors.
  • out_format β€” optionally describes alternative ASImage format 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 valid ASVisual structure
  • vector β€” data to be attached to new ASImage and used to generate RGB image
  • width, height β€” size of the new image.
  • palette β€” palette to be used in conversion of double precision values into colors.
  • out_format β€” optionally describes alternative ASImage format that should be produced as the result β€” XImage, ARGB32, etc.
  • compression_out β€” compression level of resulting image in range 0-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 valid ASVisual structure
  • src β€” source ASImage.
  • slice_x_start β€” ending of the left corners
  • slice_x_end β€” beginning of the right corners
  • slice_y_start β€” ending of the top corners
  • slice_y_end β€” beginning of the bottom corners
  • to_width β€” width of the generated image;
  • to_height β€” height of the generated image;
  • scaled β€” if True - middle part of the image will be scaled, otherwise - tiled;
  • out_format β€” optionally describes alternative ASImage format that should be produced as the result - XImage, ARGB32, etc.;
  • compression_out β€” compression level of resulting image in range 0-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