Changeset 1143 for trunk/src/org/expeditee/items/Picture.java
- Timestamp:
- 09/18/18 12:00:17 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Picture.java
r1102 r1143 207 207 String size = getImageSize(); 208 208 209 if (_end. x != 0 || _end.y!= 0)209 if (_end.getX() != 0 || _end.getY() != 0) 210 210 return; 211 211 … … 280 280 public void setStartCrop(Point p) 281 281 { 282 if (p != null) setStartCrop(p. x, p.y);282 if (p != null) setStartCrop(p.getX(), p.getY()); 283 283 } 284 284 … … 291 291 public void setEndCrop(Point p) 292 292 { 293 if (p != null) setEndCrop(p. x, p.y);293 if (p != null) setEndCrop(p.getX(), p.getY()); 294 294 } 295 295 … … 304 304 Point topLeft = getTopLeftCrop(); 305 305 Point bottomRight = getBottomRightCrop(); 306 int startX = getX() + topLeft. x- _highlightThickness;307 int startY = getY() + topLeft. y- _highlightThickness;306 int startX = getX() + topLeft.getX() - _highlightThickness; 307 int startY = getY() + topLeft.getY() - _highlightThickness; 308 308 int border = 2 * _highlightThickness; 309 309 // TODO: Why invalidate specific area just before invalidateAll? cts16 310 310 invalidate(new AxisAlignedBoxBounds(startX, startY, 311 bottomRight. x - topLeft.x + 2 * border, bottomRight.y - topLeft.y+ 2 * border));311 bottomRight.getX() - topLeft.getX() + 2 * border, bottomRight.getY() - topLeft.getY() + 2 * border)); 312 312 invalidateAll(); 313 313 } else { … … 317 317 318 318 public Point getTopLeftCrop() { 319 return new Point(Math.min(_cropStart. x, _cropEnd.x), Math.min(320 _cropStart. y, _cropEnd.y));319 return new Point(Math.min(_cropStart.getX(), _cropEnd.getX()), Math.min( 320 _cropStart.getY(), _cropEnd.getY())); 321 321 } 322 322 323 323 public Point getBottomRightCrop() 324 324 { 325 return new Point(Math.max(_cropStart. x, _cropEnd.x), Math.max(_cropStart.y, _cropEnd.y));325 return new Point(Math.max(_cropStart.getX(), _cropEnd.getX()), Math.max(_cropStart.getY(), _cropEnd.getY())); 326 326 } 327 327 … … 341 341 if (!isBeingCropped()) return true; 342 342 343 int cropWidth = Math.abs(_cropEnd. x - _cropStart.x);344 int cropHeight = Math.abs(_cropEnd. y - _cropStart.y);343 int cropWidth = Math.abs(_cropEnd.getX() - _cropStart.getX()); 344 int cropHeight = Math.abs(_cropEnd.getY() - _cropStart.getY()); 345 345 346 346 return cropWidth < MINIMUM_WIDTH || cropHeight < MINIMUM_WIDTH; … … 371 371 int height = getHeight(); 372 372 373 centre. x = base_x + width / 2;374 centre. y = base_y + height / 2;373 centre.setX(base_x + width / 2); 374 centre.setY(base_y + height / 2); 375 375 376 376 int xdiff = -MARGIN_RIGHT; // -getLeftMargin(); … … 391 391 Point bottomRight = getBottomRightCrop(); 392 392 393 centre. x = base_x + (bottomRight.x - topLeft.x) / 2;394 centre. y = base_y + (bottomRight.y - topLeft.y) / 2;395 396 AxisAlignedBoxBounds clip = new AxisAlignedBoxBounds(topLeft. x+ base_x,397 topLeft. y + base_y, bottomRight.x - topLeft.x,398 bottomRight. y - topLeft.y);393 centre.setX(base_x + (bottomRight.getX() - topLeft.getX()) / 2); 394 centre.setY(base_y + (bottomRight.getY() - topLeft.getY()) / 2); 395 396 AxisAlignedBoxBounds clip = new AxisAlignedBoxBounds(topLeft.getX() + base_x, 397 topLeft.getY() + base_y, bottomRight.getX() - topLeft.getX(), 398 bottomRight.getY() - topLeft.getY()); 399 399 // _poly.addPoint((int) clip.getMinX() - 1, (int) clip.getMinY() - 1); 400 400 // _poly.addPoint((int) clip.getMinX() - 1, (int) clip.getMaxY()); … … 425 425 @Override 426 426 public void setWidth(Integer width) { 427 _scale = width * 1F / (_end. x - _start.x);427 _scale = width * 1F / (_end.getX() - _start.getX()); 428 428 } 429 429 … … 487 487 int offY = (tmp.getHeight() - getHeight()) / 2; 488 488 489 int cropStartX = _start. x;490 int cropEndX = _end. x;489 int cropStartX = _start.getX(); 490 int cropEndX = _end.getX(); 491 491 if(cropEndX > iw) { 492 492 cropEndX = iw; … … 503 503 } 504 504 505 int cropStartY = _start. y;506 int cropEndY = _end. y;505 int cropStartY = _start.getY(); 506 int cropEndY = _end.getY(); 507 507 if(cropEndY > ih) { 508 508 cropEndY = ih; … … 569 569 int base_y = (_anchorTop != null) ? _anchorTop : _source.getY(); 570 570 571 Clip clip = new Clip(new AxisAlignedBoxBounds( base_x + topLeft. x,572 base_y + topLeft. y,573 bottomRight. x - topLeft.x,574 bottomRight. y - topLeft.y));571 Clip clip = new Clip(new AxisAlignedBoxBounds( base_x + topLeft.getX(), 572 base_y + topLeft.getY(), 573 bottomRight.getX() - topLeft.getX(), 574 bottomRight.getY() - topLeft.getY())); 575 575 EnforcedClipKey key = g.pushClip(clip); 576 576 paintImageTiling(); … … 625 625 Point topLeft = getTopLeftCrop(); 626 626 Point bottomRight = getBottomRightCrop(); 627 int startX = Math.round(topLeft. x / _scale) + _start.x;628 int startY = Math.round(topLeft. y / _scale) + _start.y;629 int endX = Math.round(bottomRight. x / _scale + _start.x);630 int endY = Math.round(bottomRight. y / _scale + _start.y);627 int startX = Math.round(topLeft.getX() / _scale) + _start.getX(); 628 int startY = Math.round(topLeft.getY() / _scale) + _start.getY(); 629 int endX = Math.round(bottomRight.getX() / _scale + _start.getX()); 630 int endY = Math.round(bottomRight.getY() / _scale + _start.getY()); 631 631 int width = _image.getWidth(); 632 632 int height = _image.getHeight(); … … 649 649 int base_x = (_anchorLeft!=null) ? _anchorLeft : _source.getX(); 650 650 int base_y = (_anchorTop!=null) ? _anchorTop : _source.getY(); 651 p._source.setPosition(topLeft. x + base_x, topLeft.y+ base_y);651 p._source.setPosition(topLeft.getX() + base_x, topLeft.getY() + base_y); 652 652 } else { 653 653 p._start = new Point(_start); … … 678 678 int ih = _image.getHeight(); 679 679 if(iw > 0 || ih > 0) { 680 while(_start. x>= iw) {681 _start. x -= iw;682 _end. x -= iw;680 while(_start.getX() >= iw) { 681 _start.setX(_start.getX() - iw); 682 _end.setX(_end.getX() - iw); 683 683 } 684 while(_start. y>= ih) {685 _start. y -= ih;686 _end. y -= ih;684 while(_start.getY() >= ih) { 685 _start.setY(_start.getY() - ih); 686 _end.setY(_end.getY() - ih); 687 687 } 688 while(_start. x< 0) {689 _start. x += iw;690 _end. x += iw;688 while(_start.getX() < 0) { 689 _start.setX(_start.getX() + iw); 690 _end.setX(_end.getX() + iw); 691 691 } 692 while(_start. y< 0) {693 _start. y += ih;694 _end. y += ih;692 while(_start.getY() < 0) { 693 _start.setY(_start.getY() + ih); 694 _end.setY(_end.getY() + ih); 695 695 } 696 696 } … … 749 749 } 750 750 751 return Image.createImageAsCroppedCopy(_image, _start. x, _start.y, getUnscaledWidth(), getUnscaledHeight());751 return Image.createImageAsCroppedCopy(_image, _start.getX(), _start.getY(), getUnscaledWidth(), getUnscaledHeight()); 752 752 } 753 753 754 754 public int getUnscaledWidth() { 755 return _end. x - _start.x;755 return _end.getX() - _start.getX(); 756 756 } 757 757 758 758 public int getUnscaledHeight() { 759 return _end. y - _start.y;759 return _end.getY() - _start.getY(); 760 760 } 761 761 … … 764 764 */ 765 765 public boolean isCropped() { 766 return (_end. x != 0 && _end.x != _image.getWidth()) || (_end.y != 0 && _end.y != _image.getHeight()) || _start.y != 0 || _start.x!= 0;766 return (_end.getX() != 0 && _end.getX() != _image.getWidth()) || (_end.getY() != 0 && _end.getY() != _image.getHeight()) || _start.getY() != 0 || _start.getX() != 0; 767 767 } 768 768 … … 888 888 // If the image is cropped add the position for the start and finish of 889 889 // the crop to the soure text 890 if (_start. x > 0 || _start.y > 0 || _end.x!= _image.getWidth()891 || _end. y!= _image.getHeight()) {892 newText.append(" ").append(_start. x).append(" ").append(_start.y);893 newText.append(" ").append(_end. x).append(" ").append(_end.y);890 if (_start.getX() > 0 || _start.getY() > 0 || _end.getX() != _image.getWidth() 891 || _end.getY() != _image.getHeight()) { 892 newText.append(" ").append(_start.getX()).append(" ").append(_start.getY()); 893 newText.append(" ").append(_end.getX()).append(" ").append(_end.getY()); 894 894 } 895 895
Note:
See TracChangeset
for help on using the changeset viewer.