Files Class List
AlphaDistribution Class Reference

Detailed Description

An implementation of alpha distribution methods. This implementation only works for textures with 8-bit channels.

Cem Yuksel. 2017. Alpha Distribution for Alpha Testing. PACM on CGIT (I3D 2018). http://www.cemyuksel.com/research/alphadistribution/

#include <cyAlphaDistribution.h>

Public Types

enum  Method { METHOD_ERROR_DIF , METHOD_PYRAMID }
 

Static Public Member Functions

static void FixAlpha (Method method, unsigned char *alpha, int width, int height, int spp=1)
 Fixes the alpha values of an image with the given width and height using the specified method. If the image will be used with alpha-to-coverage, the spp parameter should indicate the number of alpha samples; otherwise, it should be 1.
 
static void FixAlphaRGBA (Method method, unsigned char *image, int width, int height, int spp=1)
 Fixes the alpha values of an RGBA image with the given width and height using the specified method. Only the alpha channel of the image is modified, the RGB values are not altered. If the image will be used with alpha-to-coverage, the spp parameter should indicate the number of alpha samples; otherwise, it should be 1.
 
template<typename SAMPLE_MASK_TYPE = unsigned char>
static void GenerateSampleMaskTexture (SAMPLE_MASK_TYPE *sampleMask, unsigned char const *alpha, int width, int height, int spp)
 Generates a sample mask texture from the alpha values of an image with the given width and height. This sample mask texture can be used with the original texture for handling alpha-to-coverage. The spp parameter is the number of alpha samples that will be used.
 
template<typename SAMPLE_MASK_TYPE = unsigned char>
static void GenerateSampleMaskTextureRGBA (SAMPLE_MASK_TYPE *sampleMask, unsigned char const *image, int width, int height, int spp)
 Generates a sample mask texture from the alpha values of an RGBA image with the given width and height. This sample mask texture can be used with the original texture for handling alpha-to-coverage. The spp parameter is the number of alpha samples that will be used.
 

Member Enumeration Documentation

◆ Method

enum Method
Enumerator
METHOD_ERROR_DIF 

Error diffusion using Floyd–Steinberg dithering.

METHOD_PYRAMID 

Alpha Pyramid.