Vuo  2.3.2
Classes | Functions | Variables
VuoImageResize.c File Reference

Description

VuoImageResize implementation.

Definition in file VuoImageResize.c.

Go to the source code of this file.

Classes

struct  VuoImageResize_internal
 VuoImageResize state data. More...
 

Functions

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

Variables

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

Class Documentation

◆ VuoImageResize_internal

struct VuoImageResize_internal
Class Members
VuoShader shader
VuoShader shaderRect

Function Documentation

◆ VuoImageResize_free()

void VuoImageResize_free ( void *  ir)

Frees VuoImageResize state data.

Definition at line 85 of file VuoImageResize.c.

◆ VuoImageResize_make()

VuoImageResize VuoImageResize_make ( void  )

Create and compile a resize shader for reuse with VuoImage_resizeWithShaderAndContext.

Definition at line 96 of file VuoImageResize.c.

◆ VuoImageResize_resize()

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

Returns a new image resized from image.

Use with VuoImageResize_make().

Definition at line 115 of file VuoImageResize.c.

Variable Documentation

◆ applyScaleFragmentShader

const char* applyScaleFragmentShader
static
Initial value:
\n#include "VuoGlslAlpha.glsl"
varying vec2 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 - offset) * scale;
gl_FragColor = outOfBounds(uv) ? vec4(0.,0.,0.,0.) : VuoGlsl_sample(texture, uv);
}
)

Fragment shader that scales and offsets an image.

Definition at line 29 of file VuoImageResize.c.

◆ applyScaleFragmentShaderRect

const char* applyScaleFragmentShaderRect
static
Initial value:
\n#include "VuoGlslAlpha.glsl"
varying vec2 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 - offset) * scale;
gl_FragColor = outOfBounds(uv) ? vec4(0.,0.,0.,0.) : VuoGlsl_sampleRect(texture, uv * textureSize);
}
)

Fragment shader that scales and offsets an image.

Definition at line 52 of file VuoImageResize.c.