CoverService

Provides an easy access to a bitmap version of the publication cover.

While at first glance, getting the cover could be seen as a helper, the implementation actually depends on the publication format:

  • Some might allow vector images or even HTML pages, in which case they need to be converted to bitmaps.

  • Others require to render the cover from a specific file format, e.g. PDF.

Furthermore, a reading app might want to use a custom strategy to choose the cover image, for example by:

  • iterating through the images collection for a publication parsed from an OPDS 2 feed

  • generating a bitmap from scratch using the publication's title

  • using a cover selected by the user.

Inheritors

Functions

Link copied to clipboard
open override fun close()

Closes any opened file handles, removes temporary files, etc.

Link copied to clipboard
abstract suspend fun cover(): Bitmap?

Returns the publication cover as a Bitmap at its maximum size.

Link copied to clipboard
open suspend fun coverFitting(maxSize: Size): Bitmap?

Returns the publication cover as a Bitmap, scaled down to fit the given maxSize.