libguac  0.9.12-incubating
Functions
hash.h File Reference

Provides functions and structures for producing likely-to-be-unique hash values for images. More...

Go to the source code of this file.

Functions

unsigned int guac_hash_surface (cairo_surface_t *surface)
 Produces a 24-bit hash value from all pixels of the given surface. More...
 
int guac_surface_cmp (cairo_surface_t *a, cairo_surface_t *b)
 Given two Cairo surfaces, returns zero if the data contained within each is identical, and a positive or negative value if the value of the first is found to be lexically greater or less than the second respectively. More...
 

Detailed Description

Provides functions and structures for producing likely-to-be-unique hash values for images.

Function Documentation

unsigned int guac_hash_surface ( cairo_surface_t *  surface)

Produces a 24-bit hash value from all pixels of the given surface.

The surface provided must be RGB or ARGB with each pixel stored in 32 bits. The hashing algorithm used is a variant of the cyclic polynomial rolling hash.

Parameters
surfaceThe Cairo surface to hash.
Returns
An arbitrary 24-bit unsigned integer value intended to be well distributed across different images.
int guac_surface_cmp ( cairo_surface_t *  a,
cairo_surface_t *  b 
)

Given two Cairo surfaces, returns zero if the data contained within each is identical, and a positive or negative value if the value of the first is found to be lexically greater or less than the second respectively.

Parameters
aThe first Cairo surface to compare.
bThe Cairo surface to compare the first surface against.
Returns
Zero if the data contained within each is identical, and a positive or negative value if the value of the first is found to be lexically greater or less than the second respectively.