Main Page Alphabetical List Data Structures File List Data Fields Globals

# player.c File Reference

## Functions
wmf_error_t | wmf_player_init (wmfAPI *API)
wmf_error_t | wmf_scan (wmfAPI *API, unsigned long flags, wmfD_Rect *d_r)
wmf_error_t | wmf_size (wmfAPI *API, float *width, float *height)
wmf_error_t | wmf_display_size (wmfAPI *API, unsigned int *width, unsigned int *height, double res_x, double res_y)
wmf_error_t | wmf_play (wmfAPI *API, unsigned long flags, wmfD_Rect *d_r)

## Function Documentation

wmf_error_t wmf_display_size | ( | wmfAPI * | API,
|  | unsigned int * | width,
|  | unsigned int * | height,
|  | double | res_x,
|  | double | res_y
| ) |

  | Get estimate of image display size. Parameters:
  API | the API handle
  width | width return
  height | height return
  res_x | x-resolution of display
  res_y | y-resolution of display
wmf_display_size() returns image width in `*width` and image height in `*height`. wmf_size() is used to get the calculated/estimate width and height of the image, and these values are converted to integer width and height estimates for display. Returns: Returns the library error state (wmf_E_None on success). Possible library error state of wmf_E_Glitch (the metafile has not been scanned).

wmf_error_t wmf_play | ( | wmfAPI * | API,
|  | unsigned long | flags,
|  | wmfD_Rect * | d_r
| ) |

  | Play the metafile. Parameters:
  API | the API handle
  flags | (unused)
  d_r | for bounding-box return
Before the metafile can be played, it must be scanned - see wmf_scan(). The first time (and only the first time) the metafile is played, it first calls device_open() for the device layer specified (and initialized) in wmf_api_create(). Then, and also each subsequent time the metafile is played, it calls device_begin(), plays the metafile (with calls to various other device layer functions), and finally it calls device_end(). device_close() is only ever called via wmf_api_destroy(). `d_r` is recomputed, but should not change. Returns: Returns the library error state (wmf_E_None on success).

wmf_error_t wmf_player_init | ( | wmfAPI * |  | ) |

| Initializes the metafile player (called by wmf_api_create())

wmf_error_t wmf_scan | ( | wmfAPI * | API,
|  | unsigned long | flags,
|  | wmfD_Rect * | d_r
| ) |

  | Scan the metafile. Parameters:
  API | the API handle
  flags | (unused)
  d_r | for bounding-box return
Before the metafile can be played, it must be scanned. This is because metafile headers do not always provide image size information. Although the device layer (the graphics exporter) is initialized in wmf_api_create(), the output device is not opened until after the metafile is scanned. By scanning, therefore, the device layer can be provided on opening not only with size information but also a list of colors to expect (not including those in raster images) and of other required resources, if necessary. Finally, if scanning fails, then there's certainly no point in playing the metafile. The bounding box, in device coordinates, is returned in `*d_r`. Returns: Returns the library error state (wmf_E_None on success).

wmf_error_t wmf_size | ( | wmfAPI * | API,
|  | float * | width,
|  | float * | height
| ) |

  | Get image size. Parameters:
  API | the API handle
  width | width return
  height | height return
wmf_size() returns image width in `*width` and image height in `*height`. If supplied, the metafile header values are used, otherwise the width and height found by wmf_scan() are used. Returns: Returns the library error state (wmf_E_None on success). Possible library error state of wmf_E_Glitch (the metafile has not been scanned).