Vuo  1.2.8
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. 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.

◆ VuoImageResize_make()

VuoImageResize VuoImageResize_make ( void  )

Create and compile a resize shader for reuse with VuoImage_resizeWithShaderAndContext.

◆ 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().

Variable Documentation

◆ applyScaleFragmentShader

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);
}
)
#define VUOSHADER_GLSL_SOURCE(version, source)
A macro to facilitate defining a GLSL shader in a C source file.
Definition: VuoShader.h:165

Fragment shader that scales and offsets an image.

◆ applyScaleFragmentShaderRect

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);
}
)
#define VUOSHADER_GLSL_SOURCE(version, source)
A macro to facilitate defining a GLSL shader in a C source file.
Definition: VuoShader.h:165

Fragment shader that scales and offsets an image.