import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
-import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.ImageUtils;
import be.nikiroo.utils.ui.UIUtils;
/**
private Date lastClick;
private List<BookActionListener> listeners;
+ private Reader reader;
private MetaData meta;
private boolean cached;
/**
* Create a new {@link GuiReaderBook} item for the given {@link Story}.
*
+ * @param reader
+ * the associated reader
* @param meta
* the story {@link MetaData}
* @param cached
* @param seeWordCount
* TRUE to see word counts, FALSE to see authors
*/
- public GuiReaderBook(MetaData meta, boolean cached, boolean seeWordCount) {
+ public GuiReaderBook(Reader reader, MetaData meta, boolean cached,
+ boolean seeWordCount) {
+ this.reader = reader;
this.cached = cached;
this.meta = meta;
InputStream in = Instance.getCache().getFromCache(id);
if (in != null) {
try {
- resizedImage = IOUtils.toImage(in);
+ resizedImage = ImageUtils.fromStream(in);
in.close();
in = null;
} catch (IOException e) {
if (resizedImage == null) {
try {
- BufferedImage cover = Instance.getLibrary().getCover(
+ BufferedImage cover = reader.getLibrary().getCover(
meta.getLuid());
resizedImage = new BufferedImage(SPINE_WIDTH + COVER_WIDTH,