-/* Similarity search tree... will be changed */
-struct image_tree {
- uns count; /* Number of images in the tree */
- uns depth; /* Tree depth */
- struct image_bbox bbox; /* Bounding box containing all the */
- struct image_node *nodes; /* Internal nodes */
- struct image_leaf *leaves; /* Leaves */
+struct image *image_new(struct image_context *ctx, uns cols, uns rows, uns flags, struct mempool *pool);
+struct image *image_clone(struct image_context *ctx, struct image *src, uns flags, struct mempool *pool);
+void image_destroy(struct image *img);
+void image_clear(struct image_context *ctx, struct image *img);
+struct image *image_init_matrix(struct image_context *ctx, struct image *img, byte *pixels, uns cols, uns rows, uns row_size, uns flags);
+struct image *image_init_subimage(struct image_context *ctx, struct image *img, struct image *src, uns left, uns top, uns cols, uns rows);
+
+static inline int
+image_dimensions_valid(uns cols, uns rows)
+{
+ return cols && rows && cols <= image_max_dim && rows <= image_max_dim;
+}
+/* scale.c */
+
+int image_scale(struct image_context *ctx, struct image *dest, struct image *src);
+void image_dimensions_fit_to_box(uns *cols, uns *rows, uns max_cols, uns max_rows, uns upsample);
+
+/* image-io.c */
+
+enum image_format {
+ IMAGE_FORMAT_UNDEFINED,
+ IMAGE_FORMAT_JPEG,
+ IMAGE_FORMAT_PNG,
+ IMAGE_FORMAT_GIF,
+ IMAGE_FORMAT_MAX