Package tripleplay.platform

Source Code of tripleplay.platform.IOSImageOverlay$ImageView

//
// Triple Play - utilities for use in PlayN-based games
// Copyright (c) 2011-2014, Three Rings Design, Inc. - All rights reserved.
// http://github.com/threerings/tripleplay/blob/master/LICENSE

package tripleplay.platform;

import playn.core.Image;
import playn.ios.IOSAbstractImage;
import cli.MonoTouch.CoreGraphics.CGContext;
import cli.MonoTouch.UIKit.UIGraphics;
import cli.MonoTouch.UIKit.UIView;
import cli.System.Drawing.RectangleF;

public class IOSImageOverlay extends IOSNativeOverlay
    implements ImageOverlay
{
    public IOSImageOverlay (Image image) {
        super(new ImageView(((IOSAbstractImage)image)));
    }

    @Override public Image image () {
        return ((ImageView)view).image;
    }

    @Override public void repaint () {
        root().SetNeedsDisplay();
    }

    protected static class ImageView extends UIView
    {
        public final IOSAbstractImage image;

        public ImageView (IOSAbstractImage image) {
            this.image = image;
        }

        @Override public void Draw (RectangleF frame) {
            super.Draw(frame);
            CGContext ctx = UIGraphics.GetCurrentContext();
            ctx.DrawImage(frame, image.cgImage());
        }
    }
}
TOP

Related Classes of tripleplay.platform.IOSImageOverlay$ImageView

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.