Coder Social home page Coder Social logo

softeq / subsamplingscaleimageview-xamarin-android Goto Github PK

View Code? Open in Web Editor NEW
2.0 9.0 0.0 2.54 MB

Binding of SubsamplingScaleImageView Android library for Xamarin / .NET6 / MAUI

Home Page: https://github.com/davemorrissey/subsampling-scale-image-view

License: MIT License

xamarin xamarin-android xamarin-android-binding image image-zooming csharp library android dotnet6 maui

subsamplingscaleimageview-xamarin-android's Introduction

Subsampling Scale Image View

Build Status NuGet Badge

Xamarin binding library for SubsamplingScaleImageView Android library.


A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) without OutOfMemoryErrors. Includes pinch to zoom, panning, rotation and animation support, and allows easy extension so you can add your own overlays and touch event detection.

The view optionally uses subsampling and tiles to support very large images - a low resolution base layer is loaded and as you zoom in, it is overlaid with smaller high resolution tiles for the visible area. This avoids holding too much data in memory. It's ideal for displaying large images while allowing you to zoom in to the high resolution details. You can disable tiling for smaller images and when displaying a bitmap object. There are some advantages and disadvantages to disabling tiling so to decide which is best, see the original wiki.

Installation

NuGet:

Install-Package SubsamplingScaleImageViewBinding

The minimum SDK is now 14.

Usage

1) Add the view to your layout XML.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</LinearLayout>

2) Now, in your fragment or activity, set the image resource, asset name or file path.

var imageView = view.FindViewById<SubsamplingScaleImageView>(Resource.Id.imageView);

imageView.SetImage(ImageSource.ForResource(Resource.Drawable.swissroad));

Integration

FFImageLoading

Use FFImageLoading custom ViewTarget declaration:

public class SubsamplingScaleImageViewTarget : ViewTarget<SubsamplingScaleImageView>
{
    public SubsamplingScaleImageViewTarget(SubsamplingScaleImageView imageView)
        : base(imageView)
    {
    }

    public override void Set(IImageLoaderTask task, SelfDisposingBitmapDrawable image,
        bool animated)
    {
        var source = ImageSource.ForBitmap(image.Bitmap);
        Control.SetImage(source);
    }
}
var target = new SubsamplingScaleImageViewTarget(_imageView);

ImageService.Instance.LoadUrl("image-url").IntoAsync(target);

About

This project is maintained by Softeq Development Corp.

We specialize in developing mobile applications using Xamarin and native technology stack.

License

SubsamplingScaleImageViewBinding library for android is released under the MIT license. See LICENSE for details.

The original SubsamplingScaleImageView project was created by Dave Morrissey under a different license (Apache License 2.0)

subsamplingscaleimageview-xamarin-android's People

Contributors

wcoder avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

subsamplingscaleimageview-xamarin-android's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.