Android image processing

Source: Internet
Author: User

Eclipse_xu's Course "Android image processing" was read on IMOOC, Divert wrote a demo:
Take a look:

Core code:

 Packagecom.zms.imageprocess;Importandroid.app.Activity;ImportAndroid.graphics.Bitmap;ImportAndroid.graphics.BitmapFactory;ImportAndroid.os.Bundle;ImportAndroid.view.View;ImportAndroid.view.WindowManager;ImportAndroid.widget.Button;ImportAndroid.widget.ImageView;ImportAndroid.widget.SeekBar;/** * Created by Administrator on 2015/4/1. * * Public  class primarycoloractivity extends Activity {    PrivateImageView ImageView;PrivateSeekBar Seekbarhue, seekbarsaturation, seekbarluminance;Private floatMhue =0.0FPrivate floatMsaturation =1.0FPrivate floatMluminance =1.0FPrivate Static intMax_value =255;Private Static intMid_value =127;PrivateBitmap Bitmap;PrivateButton btnreset;Private intImageflag =0;@Override    protected void onCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate);        Setcontentview (R.layout.primary_color);        Bitmap = Bitmapfactory.decoderesource (Getresources (), r.drawable.map);        ImageView = (ImageView) Findviewbyid (R.id.imageview);        Imageview.setimagebitmap (bitmap); Imageview.setonclicklistener (NewMyonclicklistener ());        Btnreset = (Button) Findviewbyid (R.id.btnreset); Btnreset.setonclicklistener (NewMyonclicklistener ());        Seekbarhue = (SeekBar) Findviewbyid (R.id.seekbarhue);        Seekbarhue.setmax (Max_value);        Seekbarhue.setprogress (Mid_value); Seekbarhue.setonseekbarchangelistener (NewMyonseekbarchangelistener ());        Seekbarsaturation = (SeekBar) Findviewbyid (r.id.seekbarsaturation);        Seekbarsaturation.setmax (Max_value);        Seekbarsaturation.setprogress (Mid_value); Seekbarsaturation.setonseekbarchangelistener (NewMyonseekbarchangelistener ());        Seekbarluminance = (SeekBar) Findviewbyid (r.id.seekbarluminance);        Seekbarluminance.setmax (Max_value);        Seekbarluminance.setprogress (Mid_value); Seekbarluminance.setonseekbarchangelistener (NewMyonseekbarchangelistener ()); } class Myonseekbarchangelistener implements Seekbar.onseekbarchangelistener {@Override         Public void onprogresschanged(SeekBar SeekBar,intProgressBooleanFromuser) {Switch(Seekbar.getid ()) { CaseR.id.seekbarhue:mhue = (progress-mid_value) *1.0F/mid_value * the; Break; CaseR.id.seekbarsaturation:msaturation = Progress *1.0F/mid_value; Break; CaseR.id.seekbarluminance:mluminance = Progress *1.0F/mid_value; Break;        } imageview.setimagebitmap (Imagehelper.imageeffect (Bitmap, Mhue, Msaturation, mluminance)); }@Override         Public void Onstarttrackingtouch(SeekBar SeekBar) {        }@Override         Public void Onstoptrackingtouch(SeekBar SeekBar) {}} class Myonclicklistener implements View.onclicklistener {@Override         Public void OnClick(View v) {Switch(V.getid ()) { CaseR.id.imageview:if(Imageflag = =0) {bitmap = Bitmapfactory.decoderesource (Getresources (), R.drawable.aya);                        Imageview.setimagebitmap (bitmap); Imageflag =1; }Else if(Imageflag = =1) {bitmap = Bitmapfactory.decoderesource (Getresources (), r.drawable.map);                        Imageview.setimagebitmap (bitmap); Imageflag =0; } Break; CaseR.id.btnreset:imageview.setimagebitmap (Imagehelper.imageeffect (Bitmap,0.0F1.0F1.0f));                    Seekbarhue.setprogress (Mid_value);                    Seekbarsaturation.setprogress (Mid_value); Seekbarluminance.setprogress (Mid_value); Break; }        }    }}

I'm in these places: CSDN GitHub Weibo

Android image processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.