Exemplo n.º 1
0
 public void OnBitmapLoaded(Bitmap p0, Picasso.LoadedFrom p1)
 {
     try
     {
         if (!File.Exists(PathURL))
         {
             using (var os = new System.IO.FileStream(PathURL, System.IO.FileMode.CreateNew))
             {
                 p0.Compress(Bitmap.CompressFormat.Jpeg, 50, os);
                 os.Close();
             }
         }
     }
     catch (FileNotFoundException e)
     {
         // e.printStackTrace();
     }
 }
            public void OnBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom @from)
            {
                var scaledBitmap = Bitmap.CreateScaledBitmap(bitmap, _width, (int)(bitmap.Height / ((float)bitmap.Width / _width)), true);

                if (_playIcon != null)
                {
                    _playIcon.SetBounds((int)(scaledBitmap.Width * .35), (int)(scaledBitmap.Height * .3),
                                        (int)(scaledBitmap.Width * .65), (int)(scaledBitmap.Height * .7));
                    _playIcon.Draw(new Canvas(scaledBitmap));
                }

                var drawable = new BitmapDrawable(Application.Context.Resources, scaledBitmap);

                drawable.SetBounds(0, 0, drawable.IntrinsicWidth, drawable.IntrinsicHeight);

                var imageSpan = new ImageSpan(drawable, SpanAlign.Baseline);

                _spannable.SetSpan(imageSpan, _start, _end,
                                   SpanTypes.InclusiveExclusive);
            }
Exemplo n.º 3
0
        public void OnBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom p1)
        {
            var file     = url.Split('/');
            var filename = file[file.Length - 1];

            if (!StartImageShared.GetImg(this).Equals(filename))
            {
                FileStream fstr = null;
                var        path = this.CacheDir.Path;
                try
                {
                    fstr = new FileStream(System.IO.Path.Combine(path, filename), FileMode.OpenOrCreate, FileAccess.Write);

                    bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, fstr);

                    StartImageShared.Update(this, new StartImageModel()
                    {
                        img = filename, text = text
                    });
                }
                catch (Exception e)
                {
                    File.Delete(System.IO.Path.Combine(path, filename));
                }
                finally
                {
                    if (fstr != null)
                    {
                        fstr.Flush();
                        fstr.Close();
                    }
                }
            }
            else
            {
                OnDestroy();
            }
        }
Exemplo n.º 4
0
        public void OnBitmapLoaded(Bitmap p0, Picasso.LoadedFrom p1)
        {
            var size = Math.Min(Math.Max(p0.Height, p0.Width), 50);

            var    result = Bitmap.CreateBitmap(size, size, Bitmap.Config.Argb8888);
            Canvas canvas = new Canvas(result);

            Paint paint = new Paint();
            Rect  rect  = new Rect(0, 0, size, size);

            var width  = Math.Min(p0.Width, size);
            var heigth = Math.Min(p0.Height, size);

            p0 = Bitmap.CreateScaledBitmap(p0, width, heigth, false);

            var radius = size / 2;

            canvas.DrawCircle(radius, radius, radius, paint);
            paint.SetXfermode(new PorterDuffXfermode(PorterDuff.Mode.SrcIn));
            canvas.DrawBitmap(p0, rect, rect, paint);

            Marker.SetIcon(BitmapDescriptorFactory.FromBitmap(result));
            Marker.Alpha = Alpha;
        }
Exemplo n.º 5
0
 public void OnBitmapLoaded(Bitmap p0, Picasso.LoadedFrom p1)
 {
     _profileImage.SetImageBitmap(p0);
 }
Exemplo n.º 6
0
        public void OnBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom)
        {
            Drawable bitmapDrawable = new BitmapDrawable(mImageCardView.Context.Resources, bitmap);              //TODO get proper context

            mImageCardView.MainImage = bitmapDrawable;
        }
Exemplo n.º 7
0
 public void OnBitmapLoaded(Bitmap p0, Picasso.LoadedFrom p1)
 {
     _avatar.SetImageBitmap(p0);
 }
Exemplo n.º 8
0
        public void OnBitmapLoaded(Bitmap p0, Picasso.LoadedFrom p1)
        {
            Drawable drawable = new BitmapDrawable(MainActivity.instance.Resources, p0);

            MainActivity.instance.menu.FindItem(Resource.Id.settings).SetIcon(drawable);
        }
 public void OnBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom)
 {
     this.mBackgroundManager.SetBitmap(bitmap);
 }
Exemplo n.º 10
0
        public async void OnBitmapLoaded(Bitmap p0, Picasso.LoadedFrom p1)
        {
            await _mediaPerformer.PrepareBufferAsync(p0.Copy(Bitmap.Config.Argb8888, true));

            _mediaPerformer.DrawBuffer();
        }
Exemplo n.º 11
0
 public void OnBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom)
 {
     imageBackground.SetBackgroundDrawable(new BitmapDrawable(bitmap));
 }