Mercurial > hg > digilib-old
comparison common/src/main/java/digilib/image/ImageLoaderDocuImage.java @ 912:cbfc94584d3b
reset imgSize in operations that change size.
author | robcast |
---|---|
date | Wed, 08 Jun 2011 17:49:01 +0200 |
parents | 28d007673346 |
children | 776347921bec |
comparison
equal
deleted
inserted
replaced
911:0cea7e608080 | 912:cbfc94584d3b |
---|---|
327 } | 327 } |
328 // read image | 328 // read image |
329 logger.debug("loading.."); | 329 logger.debug("loading.."); |
330 img = reader.read(0, readParam); | 330 img = reader.read(0, readParam); |
331 logger.debug("loaded"); | 331 logger.debug("loaded"); |
332 // invalidate image size | |
333 imageSize = null; | |
332 /* downconversion of highcolor images seems not to work | 334 /* downconversion of highcolor images seems not to work |
333 if (img.getColorModel().getComponentSize(0) > 8) { | 335 if (img.getColorModel().getComponentSize(0) > 8) { |
334 logger.debug("converting to 8bit"); | 336 logger.debug("converting to 8bit"); |
335 BufferedImage dest = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR); | 337 BufferedImage dest = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR); |
336 dest.createGraphics().drawImage(img, null, 0, 0); | 338 dest.createGraphics().drawImage(img, null, 0, 0); |
412 AffineTransformOp scaleOp = new AffineTransformOp( | 414 AffineTransformOp scaleOp = new AffineTransformOp( |
413 AffineTransform.getScaleInstance(scaleX, scaleY), renderHint); | 415 AffineTransform.getScaleInstance(scaleX, scaleY), renderHint); |
414 img = scaleOp.filter(img, null); | 416 img = scaleOp.filter(img, null); |
415 logger.debug("scaled to " + img.getWidth() + "x" + img.getHeight() | 417 logger.debug("scaled to " + img.getWidth() + "x" + img.getHeight() |
416 + " img=" + img); | 418 + " img=" + img); |
419 // invalidate image size | |
420 imageSize = null; | |
417 } | 421 } |
418 | 422 |
419 public void blur(int radius) throws ImageOpException { | 423 public void blur(int radius) throws ImageOpException { |
420 logger.debug("blur: " + radius); | 424 logger.debug("blur: " + radius); |
421 // minimum radius is 2 | 425 // minimum radius is 2 |
452 throws ImageOpException { | 456 throws ImageOpException { |
453 // setup Crop | 457 // setup Crop |
454 img = img.getSubimage(x_off, y_off, width, height); | 458 img = img.getSubimage(x_off, y_off, width, height); |
455 logger.debug("CROP:" + img.getWidth() + "x" | 459 logger.debug("CROP:" + img.getWidth() + "x" |
456 + img.getHeight()); | 460 + img.getHeight()); |
461 // invalidate image size | |
462 imageSize = null; | |
457 } | 463 } |
458 | 464 |
459 public void rotate(double angle) throws ImageOpException { | 465 public void rotate(double angle) throws ImageOpException { |
460 logger.debug("rotate: " + angle); | 466 logger.debug("rotate: " + angle); |
461 // setup rotation | 467 // setup rotation |
478 rotOp = new AffineTransformOp(trafo, renderHint); | 484 rotOp = new AffineTransformOp(trafo, renderHint); |
479 } | 485 } |
480 // transform image | 486 // transform image |
481 img = rotOp.filter(img, null); | 487 img = rotOp.filter(img, null); |
482 logger.debug("rotated: "+img); | 488 logger.debug("rotated: "+img); |
489 // invalidate image size | |
490 imageSize = null; | |
483 } | 491 } |
484 | 492 |
485 public void mirror(double angle) throws ImageOpException { | 493 public void mirror(double angle) throws ImageOpException { |
486 logger.debug("mirror: " + angle); | 494 logger.debug("mirror: " + angle); |
487 // setup mirror | 495 // setup mirror |
509 return; | 517 return; |
510 } | 518 } |
511 AffineTransformOp mirOp = new AffineTransformOp(new AffineTransform(mx, | 519 AffineTransformOp mirOp = new AffineTransformOp(new AffineTransform(mx, |
512 0, 0, my, tx, ty), renderHint); | 520 0, 0, my, tx, ty), renderHint); |
513 img = mirOp.filter(img, null); | 521 img = mirOp.filter(img, null); |
522 // invalidate image size | |
523 imageSize = null; | |
514 } | 524 } |
515 | 525 |
516 public void enhance(float mult, float add) throws ImageOpException { | 526 public void enhance(float mult, float add) throws ImageOpException { |
517 RescaleOp op = null; | 527 RescaleOp op = null; |
518 logger.debug("enhance: img=" + img); | 528 logger.debug("enhance: img=" + img); |