public void saveToPhotosAlbum(VoidBlock2<UIImage, NSError> callback) { if (callback != null) { long context = id.getAndIncrement(); CallbackWrapper l = new CallbackWrapper(callback, context); saveToPhotosAlbum(l, didFinishSaving, context); } else { saveToPhotosAlbum(null, null, 0); } } /*<methods>*/
public UIImage(NSData data) { super((SkipInit) null); initObject(init(data)); } /**
public UIImage(File file) { super((SkipInit) null); initObject(initWithFile(file.getAbsolutePath())); } /*<properties>*/
@Override public void setError(Throwable error) { this.error = error; this.image = new UIImage().getCGImage(); // TODO: create error image callbacks = Callbacks.dispatchFailureClear(callbacks, error); }
using MonoTouch.UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; [assembly:ExportRenderer( typeof(NamespaceOfApp.MySearchBar), typeof(NamespaceOfApp.iOS.SearchBarWithNoBarRenderer_iOS))] namespace NamespaceOfApp.iOS { public class SearchBarWithNoBarRenderer_iOS : SearchBarRenderer { protected override void OnElementChanged( ElementChangedEventArgs<SearchBar> args ) { base.OnElementChanged( args ); UISearchBar bar = (UISearchBar)this.Control; //set background to empty image bar.SetBackgroundImage (new UIImage (), UIBarPosition.TopAttached, UIBarMetrics.Default); } } }
@Override public void setImage(UIImage uiImage, Scale scale) { this.image = uiImage.getCGImage(); this.scale = scale; callbacks = Callbacks.dispatchSuccessClear(callbacks, this); }
/** * @Deprecated use {@link #getImage(String)} instead. */ @Deprecated public static UIImage create(String name) { return UIImage.getImage(name); } /**
public static UIImage getImage(File file) { return getImageWithContentsOfFile(file.getAbsolutePath()); } /*<methods>*/
@Override public Image transform(BitmapTransformer xform) { UIImage ximage = new UIImage(((RoboBitmapTransformer) xform).transform(cgImage())); return new RoboImage(ctx, ximage.getCGImage(), scale); }
/** * Creates a {@code UIImage} based on our underlying image data. This is useful when you need to * pass PlayN images to iOS APIs. */ public UIImage toUIImage() { return new UIImage(cgImage()); }
@Override protected Image createStaticImage(UIImage uiImage, Scale scale) { return new RoboImage(platform.graphics().ctx, uiImage.getCGImage(), scale); }
@Override protected ImageImpl.Data load (String path) throws Exception { Exception error = null; for (Scale.ScaledResource rsrc : plat.graphics().scale().getScaledResources(path)) { File fullPath = resolvePath(rsrc.path); if (!fullPath.exists()) continue; // plat.log().debug("Loading image: " + fullPath); UIImage img = UIImage.getImage(fullPath); if (img != null) return toData(rsrc.scale, img); // note this error if this is the lowest resolution image, but fall back to lower resolution // images if not; in the Java backend we'd fail here, but this is a production backend, so we // want to try to make things work plat.log().warn("Failed to load image '" + fullPath + "'."); error = new Exception("Failed to load " + fullPath); } if (error == null) { File fullPath = resolvePath(path); plat.log().warn("Missing image '" + fullPath + "'."); error = new FileNotFoundException(fullPath.toString()); } throw error; }
public static UIImage getImage(File file) { return getImageWithContentsOfFile(file.getAbsolutePath()); } /*<methods>*/
public UIImage(CGImage cgImage) { super((SkipInit) null); initObject(init(cgImage)); } /**
public UIImage(File file) { super((SkipInit) null); initObject(initWithFile(file.getAbsolutePath())); } /*<properties>*/
@Override public Image transform(BitmapTransformer xform) { UIImage ximage = new UIImage(((RoboBitmapTransformer) xform).transform(cgImage())); return new RoboImage(gfx, scale, ximage.getCGImage(), source); }
/** Creates a {@code UIImage} based on our underlying image data. This is useful when you need to * pass PlayN images to iOS APIs. */ public UIImage toUIImage() { return new UIImage(cgImage()); }
public void saveToPhotosAlbum(VoidBlock2<UIImage, NSError> callback) { if (callback != null) { long context = id.getAndIncrement(); CallbackWrapper l = new CallbackWrapper(callback, context); saveToPhotosAlbum(l, didFinishSaving, context); } else { saveToPhotosAlbum(null, null, 0); } }
private ImageImpl.Data toData (Scale scale, UIImage image) { CGImage bitmap = image.getCGImage(); return new ImageImpl.Data(scale, bitmap, (int)bitmap.getWidth(), (int)bitmap.getHeight()); }
/** * @since Available in iOS 4.0 and later. */ public UIImage(CGImage cgImage, @MachineSizedFloat double scale, UIImageOrientation orientation) { super((SkipInit) null); initObject(init(cgImage, scale, orientation)); } /**