Java Pixel Convert To pixelXYToTileXY(int pixelX, int pixelY)

Here you can find the source of pixelXYToTileXY(int pixelX, int pixelY)

Description

Converts pixel XY coordinates into tile XY coordinates of the tile containing the specified pixel.

License

Open Source License

Parameter

Parameter Description
pixelX Pixel X coordinate.
pixelY Pixel Y coordinate.

Return

tileX: Output parameter receiving the tile X coordinate. tileY: Output parameter receiving the tile Y coordinate.

Declaration

public static int[] pixelXYToTileXY(int pixelX, int pixelY) 

Method Source Code

//package com.java2s;
/*/*  w ww.j a  v a 2 s.c  om*/
 * Copyright (c) 2004-2016 Universidade do Porto - Faculdade de Engenharia
 * Laborat?rio de Sistemas e Tecnologia Subaqu?tica (LSTS)
 * All rights reserved.
 * Rua Dr. Roberto Frias s/n, sala I203, 4200-465 Porto, Portugal
 *
 * This file is part of Neptus, Command and Control Framework.
 *
 * Commercial Licence Usage
 * Licencees holding valid commercial Neptus licences may use this file
 * in accordance with the commercial licence agreement provided with the
 * Software or, alternatively, in accordance with the terms contained in a
 * written agreement between you and Universidade do Porto. For licensing
 * terms, conditions, and further information contact lsts@fe.up.pt.
 *
 * European Union Public Licence - EUPL v.1.1 Usage
 * Alternatively, this file may be used under the terms of the EUPL,
 * Version 1.1 only (the "Licence"), appearing in the file LICENCE.md
 * included in the packaging of this file. You may not use this work
 * except in compliance with the Licence. Unless required by applicable
 * law or agreed to in writing, software distributed under the Licence is
 * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the Licence for the specific
 * language governing permissions and limitations at
 * http://ec.europa.eu/idabc/eupl.html.
 *
 * For more information please see <http://lsts.fe.up.pt/neptus>.
 *
 * Author: Paulo Dias
 * 30 de Set de 2011
 */

public class Main {
    /**
     * Converts pixel XY coordinates into tile XY coordinates of the tile containing the specified pixel.
     * 
     * @param pixelX Pixel X coordinate.
     * @param pixelY Pixel Y coordinate.
     * @return tileX: Output parameter receiving the tile X coordinate. tileY: Output parameter receiving the tile Y coordinate.
     */
    public static int[] pixelXYToTileXY(int pixelX, int pixelY) {// TODO change to double ?
        int tileX, tileY;
        tileX = pixelX / 256;
        tileY = pixelY / 256;
        return new int[] { tileX, tileY };
    }
}

Related

  1. pixelsToPoint(int pixels, int dpi)
  2. PixelsToPoints(float value, int dpi)
  3. pixelsToYears(double dim, int chartWidth, int firstChartYear, int lastChartYear)
  4. pixelToEmu(int pixels, int dpi)
  5. pixelToRGB(int pixel, int[] prgb)