use of org.ebookdroid.core.codec.PageLink in project LibreraReader by foobnix.
the class PageImaveView method getPageLink.
public PageLink getPageLink(float x1, float y1) {
List<PageLink> pageLinks = getPageLinks();
if (pageLinks == null) {
return null;
}
RectF tr = new RectF();
imageMatrix().mapRect(tr);
float x = x1 - tr.left;
float y = y1 - tr.top;
float[] f = new float[9];
imageMatrix().getValues(f);
float scaleX = f[Matrix.MSCALE_X];
x = x / scaleX;
y = y / scaleX;
RectF tapRect = new RectF(x, y, x, y);
for (PageLink link : pageLinks) {
if (link == null) {
continue;
}
RectF wordRect = transform(link.sourceRect, 0);
boolean intersects = RectF.intersects(wordRect, tapRect);
if (intersects) {
return link;
}
}
return null;
}
use of org.ebookdroid.core.codec.PageLink in project LibreraReader by foobnix.
the class DjvuPage method getPageLinks1.
public List<PageLink> getPageLinks1() {
TempHolder.lock.lock();
try {
final List<PageLink> links = getPageLinks(docHandle, pageNo);
if (links != null) {
final float width = getWidth();
final float height = getHeight();
for (final PageLink link : links) {
normalize(link.sourceRect, width, height);
if (link.url != null && link.url.startsWith("#")) {
try {
link.targetPage = Integer.parseInt(link.url.substring(1)) - 1;
link.url = null;
} catch (final NumberFormatException ex) {
ex.printStackTrace();
}
}
}
return links;
}
} finally {
TempHolder.lock.unlock();
}
return Collections.emptyList();
}