Changeset 1428 for trunk


Ignore:
Timestamp:
08/08/19 10:28:52 (5 years ago)
Author:
bln4
Message:

Fixed bug with background color click on images that had been scaled.

Location:
trunk/src/org/expeditee
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gio/swing/SwingImageManager.java

    r1427 r1428  
    284284
    285285        @Override
    286         public Colour[] getPixels(org.expeditee.core.Image image, int x, int y, int width, int height)
    287         {
     286        public Colour[] getPixels(org.expeditee.core.Image image, int x, int y, int width, int height) {
    288287                // Make sure we have a valid image
    289288                java.awt.Image swingImage = getInternalImage(image);
     
    295294                // Make sure the given coordinate are within the bounds of the image
    296295                AxisAlignedBoxBounds selectedArea = new AxisAlignedBoxBounds(x, y, width, height);
    297                 if (!image.getBounds().completelyContains(selectedArea)) return null;
     296                AxisAlignedBoxBounds bounds = image.getBounds();
     297                if (!bounds.completelyContains(selectedArea)) {
     298                        return null;
     299                }
    298300               
    299301                // Create an pixel grabber to get the pixel values
  • trunk/src/org/expeditee/gio/swing/SwingInputManager.java

    r1415 r1428  
    3535import org.expeditee.gio.input.InputEvent.InputType;
    3636import org.expeditee.gio.input.KBMInputEvent;
    37 import org.expeditee.gio.input.KBMInputEvent.Key;
    38 import org.expeditee.gio.input.StandardInputEventListeners;
    3937import org.expeditee.gui.Popup;
    4038import org.expeditee.gui.PopupManager;
  • trunk/src/org/expeditee/items/Picture.java

    r1427 r1428  
    974974                int x = mouseX - base_x;
    975975                int y = mouseY - base_y;
    976                
    977                 Colour c = _image.getPixel(x, y);
    978 
     976                int xInverseScale = Math.round(x / _scale);
     977                int yInverseScale = Math.round(y / _scale);
     978               
     979                Colour c = _image.getPixel(xInverseScale, yInverseScale);
     980                int c_alpha  = c.getAlpha255();
     981                if (c_alpha == 0) {
     982                        return true;
     983                }
     984               
    979985                int c_red    = c.getRed255();
    980986                int c_green  = c.getGreen255();
Note: See TracChangeset for help on using the changeset viewer.