Ejemplo n.º 1
0
    public static SatelliteImage ReadSatelliteImage(string path, int width, int height)
    {
        SatelliteImage satelliteImage = new SatelliteImage();

        satelliteImage.width  = width;
        satelliteImage.height = height;

        byte[] imageData;

        try {
            imageData = StreamUtil.ReadAllBytes(path);
        } catch (Exception e) {
            Debug.Log(e.Message);
            Debug.Log("Satellite image at '" + path + "' not found!");

            satelliteImage.texture = null;
            return(satelliteImage);
        }

        Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false);

        texture.filterMode = FilterMode.Point;
        texture.LoadImage(imageData);

        satelliteImage.texture = texture;

        return(satelliteImage);
    }