Image Store and Load using a Cipher

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Functions
Image Store and Load using a Cipher
Eet » Image Store and Load

Most of the Image Store and Load have alternative versions that accounts for ciphers to protect their content. More...

## Functions
EAPI int | eet_data_image_header_read_cipher (Eet_File *ef, const char *name, const char *cipher_key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, Eet_Image_Encoding *lossy)
| Reads just the header data for an image and dont decode the pixels using a cipher.
EAPI void * | eet_data_image_read_cipher (Eet_File *ef, const char *name, const char *cipher_key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, Eet_Image_Encoding *lossy)
| Reads image data from the named key in the eet file using a cipher.
EAPI int | eet_data_image_read_to_surface_cipher (Eet_File *ef, const char *name, const char *cipher_key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, Eet_Image_Encoding *lossy)
| Reads image data from the named key in the eet file using a cipher.
EAPI int | eet_data_image_read_to_cspace_surface_cipher (Eet_File *ef, const char *name, const char *cipher_key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, Eet_Colorspace cspace, int *alpha, int *comp, int *quality, Eet_Image_Encoding *lossy)
| Reads image data from the named key in the eet file using a cipher.
EAPI int | eet_data_image_decode_to_cspace_surface_cipher (const void *data, const char *cipher_key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, Eet_Colorspace cspace, int *alpha, int *comp, int *quality, Eet_Image_Encoding *lossy)
| Reads image data from the named key in the eet file using a cipher.
EAPI int | eet_data_image_write_cipher (Eet_File *ef, const char *name, const char *cipher_key, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, Eet_Image_Encoding lossy)
| Writes image data to the named key in an eet file using a cipher.
EAPI int | eet_data_image_header_decode_cipher (const void *data, const char *cipher_key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, Eet_Image_Encoding *lossy)
| Decodes Image data header only to get information using a cipher.
EAPI void * | eet_data_image_decode_cipher (const void *data, const char *cipher_key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, Eet_Image_Encoding *lossy)
| Decodes Image data into pixel data using a cipher.
EAPI int | eet_data_image_decode_to_surface_cipher (const void *data, const char *cipher_key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, Eet_Image_Encoding *lossy)
| Decodes Image data into pixel data using a cipher.
EAPI void * | eet_data_image_encode_cipher (const void *data, const char *cipher_key, unsigned int w, unsigned int h, int alpha, int compress, int quality, Eet_Image_Encoding lossy, int *size_ret)
| Encodes image data for storage or transmission using a cipher.

## Detailed Description

Most of the Image Store and Load have alternative versions that accounts for ciphers to protect their content.

See also
  Cipher, Identity and Protection Mechanisms

## Function Documentation

## ◆ eet_data_image_header_read_cipher()

EAPI int eet_data_image_header_read_cipher | ( | Eet_File * | ef,
|  | const char * | name,
|  | const char * | cipher_key,
|  | unsigned int * | w,
|  | unsigned int * | h,
|  | int * | alpha,
|  | int * | compress,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Reads just the header data for an image and dont decode the pixels using a cipher.

Parameters

  ef | A valid eet file handle opened for reading.
  name | Name of the entry. eg: "/base/file_i_want".
  cipher_key | The key to use as cipher.
  w | A pointer to the unsigned int to hold the width in pixels.
  h | A pointer to the unsigned int to hold the height in pixels.
  alpha | A pointer to the int to hold the alpha flag.
  compress | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  `1` on successful decode, `0` otherwise

This function reads an image from an eet file stored under the named key in the eet file and return a pointer to the decompressed pixel data.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns `1` indicating the header was read and decoded properly, or `0` on failure.

See also
  eet_data_image_header_read()

Since
  1.0.0

References eet_data_image_header_decode(), eet_read_cipher(), and eet_read_direct().

Referenced by eet_data_image_header_read().

## ◆ eet_data_image_read_cipher()

EAPI void * eet_data_image_read_cipher | ( | Eet_File * | ef,
|  | const char * | name,
|  | const char * | cipher_key,
|  | unsigned int * | w,
|  | unsigned int * | h,
|  | int * | alpha,
|  | int * | compress,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Reads image data from the named key in the eet file using a cipher.

Parameters

  ef | A valid eet file handle opened for reading.
  name | Name of the entry. eg: "/base/file_i_want".
  cipher_key | The key to use as cipher.
  w | A pointer to the unsigned int to hold the width in pixels.
  h | A pointer to the unsigned int to hold the height in pixels.
  alpha | A pointer to the int to hold the alpha flag.
  compress | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  The image pixel data decoded

This function reads an image from an eet file stored under the named key in the eet file and return a pointer to the decompressed pixel data.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns a pointer to the image data decoded. The calling application is responsible for calling free() on the image data when it is done with it. On failure NULL is returned and the parameter values may not contain any sensible data.

See also
  eet_data_image_read()

Since
  1.0.0

References eet_data_image_decode(), eet_read_cipher(), and eet_read_direct().

Referenced by eet_data_image_read().

## ◆ eet_data_image_read_to_surface_cipher()

EAPI int eet_data_image_read_to_surface_cipher | ( | Eet_File * | ef,
|  | const char * | name,
|  | const char * | cipher_key,
|  | unsigned int | src_x,
|  | unsigned int | src_y,
|  | unsigned int * | d,
|  | unsigned int | w,
|  | unsigned int | h,
|  | unsigned int | row_stride,
|  | int * | alpha,
|  | int * | compress,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Reads image data from the named key in the eet file using a cipher.

Parameters

  ef | A valid eet file handle opened for reading.
  name | Name of the entry. eg: "/base/file_i_want".
  cipher_key | The key to use as cipher.
  src_x | The starting x coordinate from where to dump the stream.
  src_y | The starting y coordinate from where to dump the stream.
  d | A pointer to the pixel surface.
  w | The expected width in pixels of the pixel surface to decode.
  h | The expected height in pixels of the pixel surface to decode.
  row_stride | The length of a pixels line in the destination surface.
  alpha | A pointer to the int to hold the alpha flag.
  compress | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  `1` on success, `0` otherwise.

This function reads an image from an eet file stored under the named key in the eet file and store the decompressed pixel data in the provided surface with an `EET_COLORSPACE_ARGB8888` colorspace.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns 1, and 0 on failure. On failure the parameter values may not contain any sensible data.

See also
  eet_data_image_read_to_surface()
  eet_data_image_decode_to_cspace_surface_cipher()

Since
  1.0.2

References eet_data_image_read_to_cspace_surface_cipher().

Referenced by eet_data_image_read_to_surface().

## ◆ eet_data_image_read_to_cspace_surface_cipher()

EAPI int eet_data_image_read_to_cspace_surface_cipher | ( | Eet_File * | ef,
|  | const char * | name,
|  | const char * | cipher_key,
|  | unsigned int | src_x,
|  | unsigned int | src_y,
|  | unsigned int * | d,
|  | unsigned int | w,
|  | unsigned int | h,
|  | unsigned int | row_stride,
|  | Eet_Colorspace | cspace,
|  | int * | alpha,
|  | int * | comp,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Reads image data from the named key in the eet file using a cipher.

Parameters

  ef | A valid eet file handle opened for reading.
  name | Name of the entry. eg: "/base/file_i_want".
  cipher_key | The key to use as cipher.
  src_x | The starting x coordinate from where to dump the stream.
  src_y | The starting y coordinate from where to dump the stream.
  d | A pointer to the pixel surface.
  w | The expected width in pixels of the pixel surface to decode.
  h | The expected height in pixels of the pixel surface to decode.
  row_stride | The length of a pixels line in the destination surface.
  cspace | The color space of the pixels surface.
  alpha | A pointer to the int to hold the alpha flag.
  comp | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  `1` on success, `0` otherwise.

This function reads an image from an eet file stored under the named key in the eet file and store the decompressed pixel data in the provided surface colorspace.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns 1, and 0 on failure. On failure the parameter values may not contain any sensible data.

See also
  eet_data_image_read_to_surface()
  eet_data_image_decode_to_cspace_surface_cipher()
  eet_data_image_read_to_surface_cipher()

Since
  1.10.0

References eet_data_image_decode_to_cspace_surface_cipher(), eet_read_cipher(), and eet_read_direct().

Referenced by eet_data_image_read_to_surface_cipher().

## ◆ eet_data_image_decode_to_cspace_surface_cipher()

EAPI int eet_data_image_decode_to_cspace_surface_cipher | ( | const void * | data,
|  | const char * | cipher_key,
|  | int | size,
|  | unsigned int | src_x,
|  | unsigned int | src_y,
|  | unsigned int * | d,
|  | unsigned int | w,
|  | unsigned int | h,
|  | unsigned int | row_stride,
|  | Eet_Colorspace | cspace,
|  | int * | alpha,
|  | int * | comp,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Reads image data from the named key in the eet file using a cipher.

Parameters

  data | The encoded pixel data.
  cipher_key | The key to use as cipher.
  size | The size, in bytes, of the encoded pixel data.
  src_x | The starting x coordinate from where to dump the stream.
  src_y | The starting y coordinate from where to dump the stream.
  d | A pointer to the pixel surface.
  w | The expected width in pixels of the pixel surface to decode.
  h | The expected height in pixels of the pixel surface to decode.
  row_stride | The length of a pixels line in the destination surface.
  cspace | The color space of the pixel surface
  alpha | A pointer to the int to hold the alpha flag.
  comp | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  `1` on success, `0` otherwise.

This function reads an image from an eet file stored under the named key in the eet file and store the decompressed pixels in the specified color space inside the given surface.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns 1, and 0 on failure. On failure the parameter values may not contain any sensible data.

See also
  eet_data_image_read_to_surface()
  eet_data_image_read_to_surface_cipher()

Since
  1.10.0

Referenced by eet_data_image_decode_to_surface_cipher(), and eet_data_image_read_to_cspace_surface_cipher().

## ◆ eet_data_image_write_cipher()

EAPI int eet_data_image_write_cipher | ( | Eet_File * | ef,
|  | const char * | name,
|  | const char * | cipher_key,
|  | const void * | data,
|  | unsigned int | w,
|  | unsigned int | h,
|  | int | alpha,
|  | int | compress,
|  | int | quality,
|  | Eet_Image_Encoding | lossy
| ) |  |

Writes image data to the named key in an eet file using a cipher.

Parameters

  ef | A valid eet file handle opened for writing.
  name | Name of the entry. eg: "/base/file_i_want".
  cipher_key | The key to use as cipher.
  data | A pointer to the image pixel data.
  w | The width of the image in pixels.
  h | The height of the image in pixels.
  alpha | The alpha channel flag.
  compress | The compression amount.
  quality | The quality encoding amount.
  lossy | The lossiness flag.

Returns
  Success if the data was encoded and written or not.

This function takes image pixel data and encodes it in an eet file stored under the supplied name key, and returns how many bytes were actually written to encode the image data.

The data expected is the same format as returned by eet_data_image_read. If this is not the case weird things may happen. Width and height must be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning the alpha values are not useful and 1 meaning they are). Compress can be from 0 to 9 (0 meaning no compression, 9 meaning full compression). This is only used if the image is not lossily encoded. Quality is used on lossy compression and should be a value from 0 to 100. The lossy flag can be 0 or 1. 0 means encode losslessly and 1 means to encode with image quality loss (but then have a much smaller encoding).

On success this function returns the number of bytes that were required to encode the image data, or on failure it returns 0.

See also
  eet_data_image_write()

Since
  1.0.0

References eet_data_image_encode(), and eet_write_cipher().

Referenced by eet_data_image_write().

## ◆ eet_data_image_header_decode_cipher()

EAPI int eet_data_image_header_decode_cipher | ( | const void * | data,
|  | const char * | cipher_key,
|  | int | size,
|  | unsigned int * | w,
|  | unsigned int * | h,
|  | int * | alpha,
|  | int * | compress,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Decodes Image data header only to get information using a cipher.

Parameters

  data | The encoded pixel data.
  cipher_key | The key to use as cipher.
  size | The size, in bytes, of the encoded pixel data.
  w | A pointer to the unsigned int to hold the width in pixels.
  h | A pointer to the unsigned int to hold the height in pixels.
  alpha | A pointer to the int to hold the alpha flag.
  compress | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  `1` on success, `0` on failure.

This function takes encoded pixel data and decodes it into raw RGBA pixels on success.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns 1 indicating the header was read and decoded properly, or 0 on failure.

See also
  eet_data_image_header_decode()

Since
  1.0.0

Referenced by eet_data_image_header_decode().

## ◆ eet_data_image_decode_cipher()

EAPI void * eet_data_image_decode_cipher | ( | const void * | data,
|  | const char * | cipher_key,
|  | int | size,
|  | unsigned int * | w,
|  | unsigned int * | h,
|  | int * | alpha,
|  | int * | compress,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Decodes Image data into pixel data using a cipher.

Parameters

  data | The encoded pixel data.
  cipher_key | The key to use as cipher.
  size | The size, in bytes, of the encoded pixel data.
  w | A pointer to the unsigned int to hold the width in pixels.
  h | A pointer to the unsigned int to hold the height in pixels.
  alpha | A pointer to the int to hold the alpha flag.
  compress | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  The image pixel data decoded

This function takes encoded pixel data and decodes it into raw RGBA pixels on success.

The other parameters of the image (width, height etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns a pointer to the image data decoded. The calling application is responsible for calling free() on the image data when it is done with it. On failure NULL is returned and the parameter values may not contain any sensible data.

See also
  eet_data_image_decode()

Since
  1.0.0

References eet_data_image_header_decode().

Referenced by eet_data_image_decode().

## ◆ eet_data_image_decode_to_surface_cipher()

EAPI int eet_data_image_decode_to_surface_cipher | ( | const void * | data,
|  | const char * | cipher_key,
|  | int | size,
|  | unsigned int | src_x,
|  | unsigned int | src_y,
|  | unsigned int * | d,
|  | unsigned int | w,
|  | unsigned int | h,
|  | unsigned int | row_stride,
|  | int * | alpha,
|  | int * | compress,
|  | int * | quality,
|  | Eet_Image_Encoding * | lossy
| ) |  |

Decodes Image data into pixel data using a cipher.

Parameters

  data | The encoded pixel data.
  cipher_key | The key to use as cipher.
  size | The size, in bytes, of the encoded pixel data.
  src_x | The starting x coordinate from where to dump the stream.
  src_y | The starting y coordinate from where to dump the stream.
  d | A pointer to the pixel surface.
  w | The expected width in pixels of the pixel surface to decode.
  h | The expected height in pixels of the pixel surface to decode.
  row_stride | The length of a pixels line in the destination surface.
  alpha | A pointer to the int to hold the alpha flag.
  compress | A pointer to the int to hold the compression amount.
  quality | A pointer to the int to hold the quality amount.
  lossy | A pointer to the int to hold the lossiness flag.

Returns
  `1` on success, `0` otherwise.

This function takes encoded pixel data and decodes it into raw RGBA pixels on success.

The other parameters of the image (alpha, compress etc.) are placed into the values pointed to (they must be supplied). The pixel data is a linear array of pixels starting from the top-left of the image scanning row by row from left to right. Each pixel is a 32bit value, with the high byte being the alpha channel, the next being red, then green, and the low byte being blue. The width and height are measured in pixels and will be greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes that the alpha channel is not used. 1 denotes that it is significant. Compress is filled with the compression value/amount the image was stored with. The quality value is filled with the quality encoding of the image file (0 - 100). The lossy flags is either 0 or 1 as to if the image was encoded lossily or not.

On success the function returns 1, and 0 on failure. On failure the parameter values may not contain any sensible data.

See also
  eet_data_image_decode_to_surface()

Since
  1.0.2

References eet_data_image_decode_to_cspace_surface_cipher().

Referenced by eet_data_image_decode_to_surface().

## ◆ eet_data_image_encode_cipher()

EAPI void * eet_data_image_encode_cipher | ( | const void * | data,
|  | const char * | cipher_key,
|  | unsigned int | w,
|  | unsigned int | h,
|  | int | alpha,
|  | int | compress,
|  | int | quality,
|  | Eet_Image_Encoding | lossy,
|  | int * | size_ret
| ) |  |

Encodes image data for storage or transmission using a cipher.

Parameters

  data | A pointer to the image pixel data.
  cipher_key | The key to use as cipher.
  size_ret | A pointer to an int to hold the size of the returned data.
  w | The width of the image in pixels.
  h | The height of the image in pixels.
  alpha | The alpha channel flag.
  compress | The compression amount.
  quality | The quality encoding amount.
  lossy | The lossiness flag.

Returns
  The encoded image data.

This function stakes image pixel data and encodes it with compression and possible loss of quality (as a trade off for size) for storage or transmission to another system.

The data expected is the same format as returned by eet_data_image_read. If this is not the case weird things may happen. Width and height must be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning the alpha values are not useful and 1 meaning they are). Compress can be from 0 to 9 (0 meaning no compression, 9 meaning full compression). This is only used if the image is not lossily encoded. Quality is used on lossy compression and should be a value from 0 to 100. The lossy flag can be 0 or 1. 0 means encode losslessly and 1 means to encode with image quality loss (but then have a much smaller encoding).

On success this function returns a pointer to the encoded data that you can free with free() when no longer needed.

See also
  eet_data_image_encode()

Since
  1.0.0

Referenced by eet_data_image_encode().