class

ImageProcessing::Processor(Acc)

Inherits Reference < Object

Abstract class inherited by individual processors. Acc is the accumulator class the processor works with (e.g. Vips::Image or MiniMagick::Tool) — the Crystal equivalent of the Ruby version's accumulator macro and ACCUMULATOR_CLASS constant.

Constructors

new(accumulator : BlockArg)
Source

Class methods

apply_operation(accumulator : BlockArg, operation : Operation)

Delegates to #apply_operation.

Source
call(source : BlockArg, loader : Hash(String, OptValue), operations : Array(Operation), saver : Hash(String, OptValue), destination : String | Nil = nil)
Source
load_image(source : BlockArg, loader : Hash(String, OptValue)) : Acc

Loads the image from source (a path or accumulator object) into the processor's accumulator. Implemented by subclasses.

Source
save_image(image : Acc, path : String, saver : Hash(String, OptValue)) : Nil

Writes the accumulator to the destination path. Implemented by subclasses.

Source
supports_resize_on_load?

Whether the processor supports resizing the image upon loading.

Source

Instance methods

apply_operation(name : String, args : Array(OptValue), block : Block | Nil)

Calls the operation to perform the processing. If the operation is defined on the processor (macro), calls the method (dispatch table generated at compile time from the subclass's public methods). Otherwise calls the operation directly on the accumulator object via #run_operation. This provides a common umbrella above defined macros and direct operations.

Source
custom

Calls the given block with the accumulator object. Useful for when you want to access the accumulator object directly.

Source