17 |
implements org.nongnu.libvob.lava.placeable.Placeable { |
implements org.nongnu.libvob.lava.placeable.Placeable { |
18 |
|
|
19 |
public static boolean dbg = false; |
public static boolean dbg = false; |
20 |
private void pa(String s) { System.out.println(s); } |
private void p(String s) { System.out.println("PageSpanLayout:: "+s); } |
21 |
|
|
22 |
public static final float scale = 72 * 6; |
public static final float scale = 72 * 6; |
23 |
|
|
75 |
xywh[4*p + 2] = psps[p].getX(d_p.width); |
xywh[4*p + 2] = psps[p].getX(d_p.width); |
76 |
xywh[4*p + 3] = psps[p].getY(d_p.height); |
xywh[4*p + 3] = psps[p].getY(d_p.height); |
77 |
|
|
78 |
if(dbg) pa("Page "+p+" "+ |
if(dbg) p("Page "+p+" "+ |
79 |
xywh[4*p+0]+" "+ |
xywh[4*p+0]+" "+ |
80 |
xywh[4*p+1]+" "+ |
xywh[4*p+1]+" "+ |
81 |
xywh[4*p+2]+" "+ |
xywh[4*p+2]+" "+ |
82 |
xywh[4*p+3]+" "+ |
xywh[4*p+3]+" "+ |
83 |
pages[p]); |
pages[p]); |
84 |
|
|
85 |
w += scale * xywh[4*p + 2]; |
w += scale * xywh[4*p + 2]; |
86 |
if(h < scale * xywh[4*p + 3]) |
if(h < scale * xywh[4*p + 3]) |
146 |
psps[p].getY(l_c.y) - xywh[4*p + 1]); |
psps[p].getY(l_c.y) - xywh[4*p + 1]); |
147 |
xywh_out[3] = scale * psps[p].getY(d_c.height); |
xywh_out[3] = scale * psps[p].getY(d_c.height); |
148 |
|
|
149 |
if(dbg) pa("Center found: "+p+" "+pages[p]+" "+ |
if(dbg) p("Center found: "+p+" "+pages[p]+" "+ |
150 |
xywh_out[0] + " " + xywh_out[1] + " " + |
xywh_out[0] + " " + xywh_out[1] + " " + |
151 |
xywh_out[2] + " " + xywh_out[3] + " " ); |
xywh_out[2] + " " + xywh_out[3] + " " ); |
152 |
|
|
153 |
return xywh_out; |
return xywh_out; |
154 |
} |
} |
222 |
float importanceAt, |
float importanceAt, |
223 |
float importanceOutside, |
float importanceOutside, |
224 |
float pixelscale) { |
float pixelscale) { |
225 |
if(dbg) pa("Request: "+x+" "+y+" "+radius); |
if(dbg) p("Request: "+x+" "+y+" "+radius); |
226 |
float curx = 0; |
float curx = 0; |
227 |
for(int p = 0; p < npages; p++) { |
for(int p = 0; p < npages; p++) { |
228 |
float dx = Math.abs((curx + .5f * scale * xywh[4*p+2]) - x) - .5f*scale * xywh[4*p+2]; |
float dx = Math.abs((curx + .5f * scale * xywh[4*p+2]) - x) - .5f*scale * xywh[4*p+2]; |
229 |
float dy = Math.abs((.5f * scale * xywh[4*p+3]) - y) - .5f*scale * xywh[4*p+3]; |
float dy = Math.abs((.5f * scale * xywh[4*p+3]) - y) - .5f*scale * xywh[4*p+3]; |
230 |
if(dbg) pa("RequestCoords: "+xywh[4*p+0]+" "+xywh[4*p+1]+" "+ |
if(dbg) p("RequestCoords: "+xywh[4*p+0]+" "+xywh[4*p+1]+" "+ |
231 |
xywh[4*p+2]+" "+xywh[4*p+3]); |
xywh[4*p+2]+" "+xywh[4*p+3]); |
232 |
float dist = Math.max(dx, dy); |
float dist = Math.max(dx, dy); |
233 |
if(dist < 0) { |
if(dist < 0) { |
234 |
psps[p].request(importanceAt, pixelscale); |
psps[p].request(importanceAt, pixelscale); |
235 |
} else if(dist < radius) { |
} else if(dist < radius) { |
236 |
if(dbg) pa("Request DO: "+dx+" "+dy); |
if(dbg) p("Request DO: "+dx+" "+dy); |
237 |
psps[p].request(importanceOutside * (1-dist/radius), |
psps[p].request(importanceOutside * (1-dist/radius), |
238 |
pixelscale); |
pixelscale); |
239 |
} |
} |