use of org.ebookdroid.core.codec.CodecPageInfo in project LibreraReader by foobnix.
the class MuPdfDocument method normalizeLinkTargetRect.
static void normalizeLinkTargetRect(final long docHandle, final int targetPage, final RectF targetRect, final int flags) {
if ((flags & 0x0F) == 0) {
targetRect.right = targetRect.left = 0;
targetRect.bottom = targetRect.top = 0;
return;
}
final CodecPageInfo cpi = new CodecPageInfo();
try {
TempHolder.lock.lock();
MuPdfDocument.getPageInfo(docHandle, targetPage, cpi);
} finally {
TempHolder.lock.unlock();
}
final float left = targetRect.left;
final float top = targetRect.top;
if (((cpi.rotation / 90) % 2) != 0) {
targetRect.right = targetRect.left = left / cpi.height;
targetRect.bottom = targetRect.top = 1.0f - top / cpi.width;
} else {
targetRect.right = targetRect.left = left / cpi.width;
targetRect.bottom = targetRect.top = 1.0f - top / cpi.height;
}
}
use of org.ebookdroid.core.codec.CodecPageInfo in project LibreraReader by foobnix.
the class DocumentModel method initPages.
public void initPages(final IActivityController base, final IProgressIndicator task) {
recyclePages();
final BookSettings bs = SettingsManager.getBookSettings();
if (base == null || bs == null || context == null || decodeService == null) {
return;
}
final IView view = base.getView();
final CodecPageInfo defCpi = new CodecPageInfo();
defCpi.width = (view.getWidth());
defCpi.height = (view.getHeight());
int viewIndex = 0;
try {
final ArrayList<Page> list = new ArrayList<Page>();
final CodecPageInfo[] infos = retrievePagesInfo(base, bs, task);
for (int docIndex = 0; docIndex < infos.length; docIndex++) {
if (TempHolder.get().loadingCancelled) {
return;
}
if (!AppState.get().isCut) {
CodecPageInfo cpi = infos[docIndex] != null ? infos[docIndex] : defCpi;
final Page page = new Page(base, new PageIndex(docIndex, viewIndex++), PageType.FULL_PAGE, cpi);
list.add(page);
} else {
final Page page1 = new Page(base, new PageIndex(docIndex, viewIndex++), PageType.LEFT_PAGE, infos[docIndex]);
final Page page2 = new Page(base, new PageIndex(docIndex, viewIndex++), PageType.RIGHT_PAGE, infos[docIndex]);
if (AppState.get().isCutRTL) {
list.add(page2);
list.add(page1);
} else {
list.add(page1);
list.add(page2);
}
}
}
pages = list.toArray(new Page[list.size()]);
} finally {
}
}
Aggregations