BitmapRegionDecoderCompat


Source link: https://github.com/bonnyfone/brdcompat

BitmapRegionDecoderCompat

BitmapRegionDecoderCompat ( BRDCompat) is the 'compat' version of the official BitmapRegionDecoder API.

BitmapRegionDecoder can be used to decode a rectangle region from an image; it is particularly useful when an original image is large and you only need parts of the image.

The standard BitmapRegionDecoder (aka BRD) requires API level 10.

BRDCompat extends the compatibility down to API 8 and adds some extra useful methods.

Features

  • Extends compatibility down to API 8 (from 10)
  • Adds new methods like decodeBestRegion(), which extracts the best image sub-region given the specified params (required size, gravity). The best region means the biggest visual portion of the (downsampled) original image given the required gravity and the output sizes/ratio.

Download

Gradle dependency

Add the following 'compile' statement in your build.gradle file (requires jCenter repository):

dependencies {

  //...your dependecies
  compile 'org.bonnyfone:brdcompat:0.1' 
}

How To...

...upgrade from the standard API

If you are already using the BitmapRegionDecoder API, just change the base class name from BitmapRegionDecoder to BitmapRegionDecoderCompat.

//BitmapRegionDecoder brd = BitmapRegionDecoder.newInstance(...);
 BitmapRegionDecoderCompat brd = BitmapRegionDecoderCompat.newInstance(...);

...simulate the fallback for API < 10 on device/emulator running API 10+

For debug purpose only you can force the library to work in backward-compatibility mode by invoking the following static method (be sure to do this before the creation of any instance of BRDCompat):

BitmapRegionDecoderCompat.setForceFallbackImplementation(true);

Example

Check out the demo for a simple usage example.

Contribute

Bug-reports, feedback and pull requests are always welcome ;)

License

Copyright 2015, Stefano Bonetta. Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Android library for getting full information about music track by track title.

Features

  • Parsing of data from ITunes (last.fm, SoundCloud - coming soon)
  • Opportunity using custom parsers

Gradle plugin for disabling animations in global settings before UI tests and reenabling them afterwards.

Gradle plugin providing very minimal release version numbering (Git-specific).

Android SDK for Hotline.

As the official Android Gradle plugin cannot resolve the native dependencies, the .so files would not be copied to the sub-directory of jniLibs. This plugin is aim to solve this problem, in addition to provide file rename and abi filtering utility functions.

A gradle plugin to calculate Android-friendly version names and codes from git tags. If you are tired of manually updating your Android build files for each release, or generating builds that you can't trace back to code, then this plugin is for you!

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes