# FixImage Documentation

Back to summary

## C API

### Types

`typedef void (*ImageFreeFunc)(void *data);`
  Used for freeing both the pixels (must be referenced in the user data) and the user data associated with the image.
`typedef void (*MulticoreFunc)(int from, int to, void *data);`
  Used for running the code on multiple cores.

### Functions

`Value image_create_from_pixels(Heap *heap, int width, int height, int stride, uint32_t *pixels, ImageFreeFunc free_func, void *user_data);`
  Creates a new image from given pixels. You must deallocate the pixels and the user data in case of a failure.
`Value image_create_painter(Heap *heap, Value img, int offset_x, int offset_y);`
  Creates a new painter for given image.
`int image_get_data(Heap *heap, Value img, int *width, int *height, int *stride, uint32_t **pixels, void **user_data);`
  Returns the data for given image. All output parameters are optional.
`int image_get_painter_data(Heap *heap, Value p, float *tr, int *clip, Value *image);`
  Returns the data for given painter. All output parameters are optional.
`void register_image_functions(Heap *heap);`
  Registers image functions to given heap.
`void fiximage_multicore_run(int from, int to, int min_iters, MulticoreFunc func, void *data);`
  Runs the code on multiple cores.