229 |
Enfilade1D enf = null; |
Enfilade1D enf = null; |
230 |
|
|
231 |
// Go into page where selection starts |
// Go into page where selection starts |
232 |
for (; p<pages.length; p++) |
for (; p<pages.length; p++) { |
233 |
if (x < xywh[4*p + 2] + w) break; |
if (x < pages[p].getSize().width + w) break; |
234 |
|
w += pages[p].getSize().width; |
235 |
|
} |
236 |
|
|
237 |
|
w = 0; |
238 |
for (; p<pages.length; p++) { |
for (; p<pages.length; p++) { |
239 |
// check y |
// check y |
240 |
if (y > xywh[4*p + 3]) throw new Error("Selection out of page,"+p+", y:"+y); |
if (y > pages[p].getSize().height) throw new Error("Selection out of page,"+p+", y:"+y); |
241 |
// check height |
// check height |
242 |
if (height > xywh[4*p + 3]) throw new Error("Selection out of page,"+p+", h:"+height); |
if ((y + height) > pages[p].getSize().height) throw new Error("Selection out of page,"+p+", h:"+height); |
243 |
|
|
244 |
// everything ok, so get a clip from page for returning enfilade. |
// everything ok, so get a clip from page for returning enfilade. |
245 |
if (enf == null) { |
if (enf == null) { |
246 |
w = (int)Math.min(wLeft, xywh[4*p + 2] - x); |
w = (int)Math.min(wLeft, pages[p].getSize().width - x); |
247 |
enf = new Enfilade1DImpl(pages[p].subArea(x,y, w, height)); |
enf = new Enfilade1DImpl(pages[p].subArea(x,y, w, height)); |
248 |
} else { |
} else { |
249 |
w = (int)Math.min(wLeft, xywh[4*p + 2]); |
w = (int)Math.min(wLeft, pages[p].getSize().width); |
250 |
Enfilade1D.Maker m = enf.getMaker(); |
Enfilade1D.Maker m = enf.getMaker(); |
251 |
enf.plus(m.makeEnfilade(pages[p].subArea(0,y, w, height))); |
enf.plus(m.makeEnfilade(pages[p].subArea(0,y, w, height))); |
252 |
} |
} |