C# Class Bloom.BookThumbNailer

This class is a place to gather the methods that have to do with making thumbnails of pages of books. Three of the methods were previously methods of Book itself, but the fourth (MakeThumbnailOfCover) needed to do too much UI stuff to belong in a model class, so it seemed worth pulling all this out to a new class. In live code there is typically only one instance of this created by the ApplicationServer. In test code they may be created as needed; nothing requires this to be a singleton. Indeed, it could be a static class except that it requires the HtmlThumbNailer.
Mostrar archivo Open project: BloomBooks/BloomDesktop Class Usage Examples

Public Methods

Method Description
BookThumbNailer ( HtmlThumbNailer thumbNailer ) : System
GetThumbNailOfBookCover ( Book book, HtmlThumbNailer thumbnailOptions, Action callback, Action errorCallback, bool async ) : void
GetThumbnailForPage ( Book book, IPage page, bool isLandscape ) : Image

Currently used by the image server to get thumbnails that are used in the add page dialog. Since this dialog can show an enlarged version of the page, we generate these at a higher resolution than usual. Also, to make more realistic views of template pages we insert fake text wherever there is an empty edit block. The result is cached for possible future use so the caller should not dispose of it.

MakeThumbnailOfCover ( Book book, Control invokeTarget ) : void
MakeThumbnailOfCover ( Book book, int height, Control invokeTarget ) : void
RebuildThumbNailAsync ( Book book, HtmlThumbNailer thumbnailOptions, Image>.Action callback, Exception>.Action errorCallback ) : void

Will call either 'callback' or 'errorCallback' UNLESS the thumbnail is readonly, in which case it will do neither.

RebuildThumbNailNow ( Book book, HtmlThumbNailer thumbnailOptions ) : void

Will make a new thumbnail (or throw) UNLESS the thumbnail is readonly, in which case it will do nothing.

Private Methods

Method Description
RebuildThumbNail ( Book book, HtmlThumbNailer thumbnailOptions, Image>.Action callback, Exception>.Action errorCallback, bool async ) : void

Will call either 'callback' or 'errorCallback' UNLESS the thumbnail is readonly, in which case it will do neither.

Method Details

BookThumbNailer() public method

public BookThumbNailer ( HtmlThumbNailer thumbNailer ) : System
thumbNailer HtmlThumbNailer
return System

GetThumbNailOfBookCover() public method

public GetThumbNailOfBookCover ( Book book, HtmlThumbNailer thumbnailOptions, Action callback, Action errorCallback, bool async ) : void
book Bloom.Book.Book
thumbnailOptions HtmlThumbNailer
callback Action
errorCallback Action
async bool
return void

GetThumbnailForPage() public method

Currently used by the image server to get thumbnails that are used in the add page dialog. Since this dialog can show an enlarged version of the page, we generate these at a higher resolution than usual. Also, to make more realistic views of template pages we insert fake text wherever there is an empty edit block. The result is cached for possible future use so the caller should not dispose of it.
public GetThumbnailForPage ( Book book, IPage page, bool isLandscape ) : Image
book Bloom.Book.Book
page IPage
isLandscape bool
return Image

MakeThumbnailOfCover() public method

public MakeThumbnailOfCover ( Book book, Control invokeTarget ) : void
book Bloom.Book.Book
invokeTarget System.Windows.Forms.Control
return void

MakeThumbnailOfCover() public method

public MakeThumbnailOfCover ( Book book, int height, Control invokeTarget ) : void
book Bloom.Book.Book
height int
invokeTarget System.Windows.Forms.Control
return void

RebuildThumbNailAsync() public method

Will call either 'callback' or 'errorCallback' UNLESS the thumbnail is readonly, in which case it will do neither.
public RebuildThumbNailAsync ( Book book, HtmlThumbNailer thumbnailOptions, Image>.Action callback, Exception>.Action errorCallback ) : void
book Bloom.Book.Book
thumbnailOptions HtmlThumbNailer
callback Image>.Action
errorCallback Exception>.Action
return void

RebuildThumbNailNow() public method

Will make a new thumbnail (or throw) UNLESS the thumbnail is readonly, in which case it will do nothing.
public RebuildThumbNailNow ( Book book, HtmlThumbNailer thumbnailOptions ) : void
book Bloom.Book.Book
thumbnailOptions HtmlThumbNailer
return void