Vuo  1.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
VuoImageResize.c File Reference

Description

VuoImageResize implementation.

Classes

struct  VuoImageResize_internal
 VuoImageResize state data. More...
 

Functions

void VuoImageResize_free (void *ir)
 Frees VuoImageResize state data.
 
VuoImageResize VuoImageResize_make (void)
 Create and compile a resize shader for reuse with VuoImage_resizeWithShaderAndContext.
 
VuoImage VuoImageResize_resize (VuoImage image, VuoImageResize ir, VuoImageRenderer renderer, VuoSizingMode sizingMode, VuoInteger width, VuoInteger height)
 Returns a new image resized from image.
 

Variables

static const char * applyScaleFragmentShader
 Fragment shader that scales and offsets an image.
 
static const char * applyScaleFragmentShaderRect
 Fragment shader that scales and offsets an image.
 

Class Documentation

struct VuoImageResize_internal
Class Members
VuoShader shader
VuoShader shaderRect

Function Documentation

void VuoImageResize_free ( void *  ir)

Frees VuoImageResize state data.

VuoImageResize VuoImageResize_make ( void  )

Create and compile a resize shader for reuse with VuoImage_resizeWithShaderAndContext.

VuoImage VuoImageResize_resize ( VuoImage  image,
VuoImageResize  ir,
VuoImageRenderer  renderer,
VuoSizingMode  sizingMode,
VuoInteger  width,
VuoInteger  height 
)

Returns a new image resized from image.

Use with VuoImageResize_make().

Variable Documentation

const char* applyScaleFragmentShader
static
Initial value:
include(VuoGlslAlpha)
varying vec4 fragmentTextureCoordinate;
uniform sampler2D texture;
uniform vec2 scale;
uniform vec2 offset;
bool outOfBounds(vec2 coord)
{
return coord.x < 0 || coord.x > 1 || coord.y < 0 || coord.y > 1;
}
void main(void)
{
vec2 uv = (fragmentTextureCoordinate.xy - offset) * scale;
gl_FragColor = outOfBounds(uv) ? vec4(0.,0.,0.,0.) : VuoGlsl_sample(texture, uv);
}
)

Fragment shader that scales and offsets an image.

const char* applyScaleFragmentShaderRect
static
Initial value:
include(VuoGlslAlpha)
varying vec4 fragmentTextureCoordinate;
uniform sampler2DRect texture;
uniform vec2 scale;
uniform vec2 offset;
uniform vec2 textureSize;
bool outOfBounds(vec2 coord)
{
return coord.x < 0 || coord.x > 1 || coord.y < 0 || coord.y > 1;
}
void main(void)
{
vec2 uv = (fragmentTextureCoordinate.xy - offset) * scale;
gl_FragColor = outOfBounds(uv) ? vec4(0.,0.,0.,0.) : VuoGlsl_sampleRect(texture, uv * textureSize);
}
)

Fragment shader that scales and offsets an image.