pods::...eFilter(3pm)

๐Ÿ“ฆ version 2.548, in opensuse-leap 16.0

๐ŸŒธ NAME ๐ŸŒธ

SDL::GFX::ImageFilter โ€” image filtering functions ๐Ÿ’–

And in case you were wondering where you even are: this is a 3pm page, straight out of the User Contributed Perl Documentation, bestie ๐Ÿซถ (the header up top is a whole mouthful of a package path, but SDL::GFX::ImageFilter is the part that matters).


๐ŸŽ€ CATEGORY ๐ŸŽ€

TODO, GFX โœจ

Not me reading TODO in the official category list ๐Ÿ’€ โ€” but there it is, no cap. GFX is the other half.


๐Ÿ’… METHODS ๐Ÿ’…

Okay so this page is long, because it's basically one giant flex of image-filter wrappers ๐Ÿฆ‹. Every single one, in order, with its signature and the exact CODE: line, because we do not skip. Periodt.

Heads up bestie: each of these is a wrapper with a Perl-side name (gfx_image_...) and a C-side name (SDL_imageFilter...). They're not the same spelling, okay? Some have capital letters in weird places. Do not "fix" them. Copy them exactly. iykyk ๐Ÿ˜ญ

๐ŸŒŸ MMX_detect

int gfx_image_MMX_detect()
CODE:
  SDL_imageFilterMMXdetect();

This one's signature is int gfx_image_MMX_detect() and the whole CODE: block is literally just SDL_imageFilterMMXdetect(); โ€” no OUTPUT: section, no RETVAL handed back to you ๐Ÿ™ˆ. It's giving "I'm here, I ran, that's the whole vibe".

๐ŸŒŸ MMX_off

void gfx_image_MMX_off()
CODE:           SDL_imageFilterMMXoff();

Returns void, does SDL_imageFilterMMXoff(). Short and iconic ๐Ÿ‘‘

๐ŸŒŸ MMX_on

void gfx_image_MMX_on()
CODE:           SDL_imageFilterMMXon();

Same deal, void gfx_image_MMX_on(), CODE: is SDL_imageFilterMMXon(); โ€” the on button to the off button above ๐ŸŽ€


โœจ add

Two unsigned char * sources walking in, one unsigned char * dest walking out ๐Ÿ’– โ€” Src1, Src2, Dest, and length.

int gfx_image_add(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterAdd(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

RETVAL comes back out, so you get the int return, slay โœจ

โœจ mean

int gfx_image_mean(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterMean(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

Same four args, Src1 and Src2 plus Dest plus length, and it's SDL_imageFilterMean under the hood ๐Ÿงš

โœจ sub

int gfx_image_sub(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterSub(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

Yes bestie the Perl method is called sub ๐Ÿคก โ€” it's a method name, not the Perl keyword, and it maps to SDL_imageFilterSub. Src1, Src2, Dest, length, RETVAL out.

โœจ abs_diff

int gfx_image_abs_diff(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterAbsDiff(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

Four args, SDL_imageFilterAbsDiff, RETVAL returned ๐ŸŒˆ

โœจ mult

int gfx_image_mult(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterMult(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

mult, not mult_nor โ€” this is the plain one, SDL_imageFilterMult ๐Ÿ’œ

โœจ mult_nor

int gfx_image_mult_nor(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterMultNor(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

Heads up: the Perl name is lowercase mult_nor but the C name is SDL_imageFilterMultNor with a capital N ๐Ÿ˜ญ do not lowercase it, do not camel-case the Perl one. Two different casing universes, both valid.

โœจ mult_div_by_2

int gfx_image_mult_div_by_2(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterMultDivby2(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

Perl: mult_div_by_2. C: SDL_imageFilterMultDivby2 โ€” the by is lowercase there ๐Ÿ˜ฎโ€๐Ÿ’จ keep the underscores and the capitals exactly where they are.

โœจ mult_div_by_4

int gfx_image_mult_div_by_4(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterMultDivby4(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

The 4 version of the above, SDL_imageFilterMultDivby4 ๐Ÿ”ฅ

โœจ bit_and

int gfx_image_bit_and(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterBitAnd(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

SDL_imageFilterBitAnd, four args, RETVAL ๐ŸŽ€

โœจ bit_or

int gfx_image_bit_or(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterBitOr(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

SDL_imageFilterBitOr, same shape as its bit_and sibling ๐Ÿ’ซ

โœจ div

int gfx_image_div(Src1, Src2, Dest, length)
unsigned char *Src1
unsigned char *Src2
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterDiv(Src1, Src2, Dest, length);
OUTPUT:           RETVAL

Src1, Src2, Dest, length โ†’ SDL_imageFilterDiv โ†’ RETVAL ๐ŸŒธ

โœจ bit_negation

int gfx_image_bit_negation(Src1, Dest, length)
unsigned char *Src1
unsigned char *Dest
int length
CODE:           RETVAL = SDL_imageFilterBitNegation(Src1, Dest, length);
OUTPUT:           RETVAL

Oh this one's different โ€” only one source ๐Ÿ’… Src1, Dest, length, no Src2 anywhere. SDL_imageFilterBitNegation it is.

โœจ add_byte

int gfx_image_add_byte(Src1, Dest, length, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char C
CODE:           RETVAL = SDL_imageFilterAddByte(Src1, Dest, length, C);
OUTPUT:           RETVAL

Single source plus a scalar: Src1, Dest, length, and C which is an unsigned char โœจ

โœจ add_uint

int gfx_image_add_uint(Src1, Dest, length, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned int C
CODE:           RETVAL = SDL_imageFilterAddUint(Src1, Dest, length, C);
OUTPUT:           RETVAL

Same shape as add_byte, but C is an unsigned int here, not an unsigned char ๐Ÿ‘€ do not mix them up, fr fr. C side: SDL_imageFilterAddUint.

โœจ add_byte_to_half

int gfx_image_add_byte_to_half(Src1, Dest, length, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char C
CODE:           RETVAL = SDL_imageFilterAddByteToHalf(Src1, Dest, length, C);
OUTPUT:           RETVAL

unsigned char C again, and the C function is SDL_imageFilterAddByteToHalf ๐Ÿฆ‹

โœจ sub_byte

int gfx_image_sub_byte(Src1, Dest, length, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char C
CODE:           RETVAL = SDL_imageFilterSubByte(Src1, Dest, length, C);
OUTPUT:           RETVAL

SDL_imageFilterSubByte, C as unsigned char, RETVAL returned ๐Ÿ’€

โœจ sub_uint

int gfx_image_sub_uint(Src1, Dest, length, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned int C
CODE:           RETVAL = SDL_imageFilterSubUint(Src1, Dest, length, C);
OUTPUT:           RETVAL

And this one's unsigned int C, C function SDL_imageFilterSubUint ๐Ÿ“

โœจ shift_right

int gfx_image_shift_right(Src1, Dest, length, N)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char N
CODE:           RETVAL = SDL_imageFilterShiftRight(Src1, Dest, length, N);
OUTPUT:           RETVAL

Fourth arg is named N here, not C, and it's an unsigned char โ€” SDL_imageFilterShiftRight โญ

โœจ shift_right_uint

int gfx_image_shift_right_uint(Src1, Dest, length, N)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char N
CODE:           RETVAL = SDL_imageFilterShiftRightUint(Src1, Dest, length, N);
OUTPUT:           RETVAL

Yes, shift_right_uint with the uint in the name, but N is still typed unsigned char in the signature โ€” that's literally what the page says, so that's what you get ๐Ÿ™ˆ

โœจ mult_by_byte

int gfx_image_mult_by_byte(Src1, Dest, length, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char C
CODE:           RETVAL = SDL_imageFilterMultByByte(Src1, Dest, length, C);
OUTPUT:           RETVAL

Scalar arg is C, unsigned char, C function SDL_imageFilterMultByByte ๐Ÿ’–

โœจ shift_right_and_mult_by_byte

int gfx_image_shift_right_and_mult_by_byte(Src1, Dest, length, N, C)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char N
unsigned char C
CODE:           RETVAL = SDL_imageFilterShiftRightAndMultByByte(Src1, Dest, length, N, C);
OUTPUT:           RETVAL

Two scalars bestie!! ๐Ÿคฏ N and C, both unsigned char, both passed into SDL_imageFilterShiftRightAndMultByByte. The name is a whole sentence and it ate.

โœจ shift_left_byte

int gfx_image_shift_left_byte(Src1, Dest, length, N)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char N
CODE:           RETVAL = SDL_imageFilterShiftLeftByte(Src1, Dest, length, N);
OUTPUT:           RETVAL

Perl: shift_left_byte. C: SDL_imageFilterShiftLeftByte. N is unsigned char ๐Ÿงš

โœจ shift_left_uint

int gfx_image_shift_left_uint(Src1, Dest, length, N)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char N
CODE:           RETVAL = SDL_imageFilterShiftLeftUint(Src1, Dest, length, N);
OUTPUT:           RETVAL

SDL_imageFilterShiftLeftUint, and again N is declared unsigned char ๐ŸŒˆ

โœจ shift_left

int gfx_image_shift_left(Src1, Dest, length, N)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char N
CODE:           RETVAL = SDL_imageFilterShiftLeft(Src1, Dest, length, N);
OUTPUT:           RETVAL

The plain shift_left โ€” no byte, no uint, just SDL_imageFilterShiftLeft โœจ

โœจ binarize_using_threshold

int gfx_image_binarize_using_threshold(Src1, Dest, length, T)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char T
CODE:           RETVAL = SDL_imageFilterBinarizeUsingThreshold(Src1, Dest, length, T);
OUTPUT:           RETVAL

Fourth arg is T this time (not C, not N ๐ŸŽ€), unsigned char, C side SDL_imageFilterBinarizeUsingThreshold.

โœจ clip_to_range

int gfx_image_clip_to_range(Src1, Dest, length, Tmin, Tmax)
unsigned char *Src1
unsigned char *Dest
int length
unsigned char Tmin
unsigned char Tmax
CODE:           RETVAL = SDL_imageFilterClipToRange(Src1, Dest, length, Tmin, Tmax);
OUTPUT:           RETVAL

Two thresholds, Tmin and Tmax, both unsigned char ๐Ÿ‘‘ and yes, the C name is SDL_imageFilterClipToRange.

โœจ normalize_linear

int gfx_image_normalize_linear(Src1, Dest, length, Cmin, Cmax, Nmin, Nmax)
unsigned char *Src1
unsigned char *Dest
int length
int Cmin
int Cmax
int Nmin
int Nmax
CODE:           RETVAL = SDL_imageFilterNormalizeLinear(Src1, Dest, length, Cmin, Cmax, Nmin, Nmax);
OUTPUT:           RETVAL

Okay this one's the long arg list and I'm obsessed ๐Ÿ˜ญ โ€” Cmin, Cmax, Nmin, Nmax, and all four are plain int, not unsigned char like the threshold friends above. Do not get cute with the types. SDL_imageFilterNormalizeLinear, RETVAL out ๐Ÿ’œ


๐Ÿฆ‹ convolve_kernel_3x3_divide

int gfx_image_convolve_kernel_3x3_divide(Src, Dest, rows, columns, Kernel, Divisor)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char Divisor
CODE:           RETVAL = SDL_imageFilterConvolveKernel3x3Divide(Src, Dest, rows, columns, Kernel, Divisor);
OUTPUT:           RETVAL

Welcome to convolve town, population: complicated ๐Ÿซถ Note the arg names โ€” it's Src here, not Src1, and there's no length at all. Instead you've got rows, columns, a Sint16 *Kernel (capital S, bestie โ€” Sint16), and Divisor as an unsigned char.

๐Ÿฆ‹ convolve_kernel_5x5_divide

int gfx_image_convolve_kernel_5x5_divide(Src, Dest, rows, columns, Kernel, Divisor)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char Divisor
CODE:           RETVAL = SDL_imageFilterConvolveKernel5x5Divide(Src, Dest, rows, columns, Kernel, Divisor);
OUTPUT:           RETVAL

Same six args, same types, SDL_imageFilterConvolveKernel5x5Divide โ€” the 5x5 is right there in the C name too ๐Ÿ”ฅ

๐Ÿฆ‹ convolve_kernel_7x7_divide

int gfx_image_convolve_kernel_7x7_divide(Src, Dest, rows, columns, Kernel, Divisor)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char Divisor
CODE:           RETVAL = SDL_imageFilterConvolveKernel7x7Divide(Src, Dest, rows, columns, Kernel, Divisor);
OUTPUT:           RETVAL

Seven-by-seven, Sint16 *Kernel, unsigned char Divisor, RETVAL returned โญ

๐Ÿฆ‹ convolve_kernel_9x9_divide

int gfx_image_convolve_kernel_9x9_divide(Src, Dest, rows, columns, Kernel, Divisor)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char Divisor
CODE:           RETVAL = SDL_imageFilterConvolveKernel9x9Divide(Src, Dest, rows, columns, Kernel, Divisor);
OUTPUT:           RETVAL

The big one, 9x9, C function SDL_imageFilterConvolveKernel9x9Divide ๐Ÿ’ซ

๐Ÿฆ‹ convolve_kernel_3x3_shift_right

int gfx_image_convolve_kernel_3x3_shift_right(Src, Dest, rows, columns, Kernel, NRightShift)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char NRightShift
CODE:           RETVAL = SDL_imageFilterConvolveKernel3x3ShiftRight(Src, Dest, rows, columns, Kernel, NRightShift);
OUTPUT:           RETVAL

Okay the _shift_right variants swap Divisor for NRightShift (still unsigned char) โ€” everything else stays: Src, Dest, rows, columns, Sint16 *Kernel ๐ŸŒธ

๐Ÿฆ‹ convolve_kernel_5x5_shift_right

int gfx_image_convolve_kernel_5x5_shift_right(Src, Dest, rows, columns, Kernel, NRightShift)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char NRightShift
CODE:           RETVAL = SDL_imageFilterConvolveKernel5x5ShiftRight(Src, Dest, rows, columns, Kernel, NRightShift);
OUTPUT:           RETVAL

SDL_imageFilterConvolveKernel5x5ShiftRight, with the NRightShift in place of the divisor, periodt ๐Ÿ’…

๐Ÿฆ‹ convolve_kernel_7x7_shift_right

int gfx_image_convolve_kernel_7x7_shift_right(Src, Dest, rows, columns, Kernel, NRightShift)
unsigned char *Src
unsigned char *Dest
int rows
int columns
Sint16 *Kernel
unsigned char NRightShift
CODE:           RETVAL = SDL_imageFilterConvolveKernel7x7ShiftRight(Src, Dest, rows, columns, Kernel, NRightShift);
OUTPUT:           RETVAL

7x7 version, SDL_imageFilterConvolveKernel7x7ShiftRight, RETVAL comes back out ๐ŸŽ€

๐ŸŒˆ convolve_kernel_9x9_shift_right

okay so this one is the 9x9 convolution but with a right-shift baked in โ€” the big sibling energy of the whole kernel family โœจ

int gfx_image_convolve_kernel_9x9_shift_right(Src, Dest, rows, columns, Kernel, NRightShift)

the args, bestie, in order:

  • unsigned char *Src โ€” your source pixels, the main characters ๐Ÿ’–
  • unsigned char *Dest โ€” where the glow-up lands ๐ŸŽ€
  • int rows
  • int columns
  • Sint16 *Kernel โ€” the 9x9 kernel itself, lowkey the blueprint of the whole vibe
  • unsigned char NRightShift โ€” how far right we're shifting, no cap

and the actual lifting:

RETVAL = SDL_imageFilterConvolveKernel9x9ShiftRight(Src, Dest, rows, columns, Kernel, NRightShift);

OUTPUT: RETVAL โ€” literally the return value, that's it, that's the output ๐Ÿซถ


๐ŸŒธ sobel_x

the Sobel X edge detector!! it's giving "find the vertical edges" and honestly? obsessed ๐Ÿ’…

int gfx_image_sobel_x(Src, Dest, rows, columns)
  • unsigned char *Src โ€” pixels in ๐ŸŒˆ
  • unsigned char *Dest โ€” edges out โœจ
  • int rows
  • int columns

the call:

RETVAL = SDL_imageFilterSobelX(Src, Dest, rows, columns);

OUTPUT: RETVAL โ€” just the return value, periodt ๐Ÿ’œ


๐Ÿฆ‹ sobel_x_shift_right

same Sobel X energy but with that shift-right twist ๐ŸŽ€

int gfx_image_sobel_x_shift_right(Src, Dest, rows, columns, NRightShift)
  • unsigned char *Src โ€” source pixels ๐Ÿ“
  • unsigned char *Dest โ€” destination pixels ๐Ÿ’–
  • int rows
  • int columns
  • unsigned char NRightShift โ€” the right-shift amount, iykyk

the one-liner doing all the work:

RETVAL = SDL_imageFilterSobelXShiftRight(Src, Dest, rows, columns, NRightShift);

OUTPUT: RETVAL โ€” yep, the return value ๐Ÿ™ˆ


๐Ÿงš align_stack

no return value, no args, no drama โ€” it just aligns the stack, bestie ๐Ÿ’ซ

void gfx_image_align_stack()
SDL_imageFilterAlignStack();

(no OUTPUT section here โ€” because there's literally nothing to output, it's a void function fr fr ๐Ÿ’€)


โญ restore_stack

the matching half of align_stack โ€” puts the stack back the way it was. the way these two ate ๐Ÿซถ

void gfx_image_restore_stack()
SDL_imageFilterRestoreStack();

(also void, also no output, also iconic ๐Ÿ’…)


๐Ÿ‘‘ AUTHORS

See "AUTHORS" in SDL. that's the whole thing, they said go read the SDL AUTHORS file and honestly, respect for keeping it short ๐ŸŒŸ


and that's the page, bestie!! ๐ŸŽ‰ source/version vibes: this is pods::...eFilter(3pm) from perl v5.42.0, dated 2024-05-01 โ€” write that down, cite it in your group chat, slay ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from