/*
  ArtToSpr Artworks/Draw to Sprite convertor
  Copyright (c) 1998 Tony Houghton

  This source is distributed under the GPL. Please see the file
  "COPYING" for details.
*/

#ifndef __picture_h
#define __picture_h
/* Abstract interface for handling a picture, whether Artworks or Draw */

#ifndef __wimp_h
#include "wimp.h"
#endif

#ifndef __opts_h
#include "opts.h"
#endif

typedef struct {
  int a, b, c, d, e, f;
} picture_matrix;

typedef struct picture_ picture;

typedef _kernel_oserror *(*picture_render)(picture *, const picture_matrix *,
	const BBox *clip);
typedef _kernel_oserror *(*picture_bbox)(picture *, const picture_matrix *,
	BBox *result);

struct picture_ {
  void *data;
  picture_render render;
  picture_bbox bounds;
  options *opts;
};

extern bool picture_load(picture *, const char *filename,
	int *filetype, int *filesize, char *stamp);
extern void picture_free(picture *);
extern void picture_init(picture *);

/* Using OS units for width, height and margin */
/* picture_matrix starts off with no translation,
   gets filled in to plot at (0, 0) plus margin */
extern bool picture_sprite_size(picture *, picture_matrix *,
	int margin, int *width, int *height);

/* picture_matrix as above plus starts off with angle only,
   scaling is filled in.
   aspect is ComponentId of bottom set of radios.
   width and height may be changed if aspect is TRIM.
*/
extern bool picture_scale_to_fit(picture *, picture_matrix *,
	int margin, int *width, int *height, bool preserve_aspect,
	int aspect);

#endif
