crop

Crop the image IMAGE to the dimensions of the currently generated image (shadron_Dimensions). ALIGN specifies the texture coordinate that should stay fixed in place. Use CROP_CENTER to fix the center of the image.

template <IMAGE, ALIGN>
vec4 crop(vec2 pos);

Alternatively, the dimensions of the input and output image size can be set explicitly. This can be useful for example if the function is not used directly to generate an image.

template <IMAGE, OLD_SIZE, NEW_SIZE, ALIGN>
vec4 crop(vec2 pos);

Example

image Input = file();
image Cropped = glsl(crop<Input, CROP_CENTER>, NEW_SIZE);