Skip to content

Instantly share code, notes, and snippets.

View rdelrosario's full-sized avatar

Rendy Del Rosario rdelrosario

View GitHub Profile
@rdelrosario
rdelrosario / Filter.cs
Created June 16, 2017 02:56
Filter Model
using System;
using PropertyChanged;
using System.ComponentModel;
using ImageFilterSample.Helpers;
namespace ImageFilterSample.Models
{
public class Filter : INotifyPropertyChanged
{
public FilterType Type { get; set; }
@rdelrosario
rdelrosario / FilterImage.cs
Last active June 16, 2017 03:46
Filter Image Control
using System;
using System.Windows.Input;
using FFImageLoading.Forms;
using ImageFilterSample.Helpers;
using Xamarin.Forms;
namespace ImageFilterSample.Controls
{
public class FilterImage : CachedImage
{
@rdelrosario
rdelrosario / MainPage.xaml
Created June 16, 2017 03:55
Filter Image Sample Page XAML
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ImageFilterSample.MainPage"
xmlns:controls="clr-namespace:ImageFilterSample.Controls"
Title="Filter Image Sample">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand" Spacing="0">
<AbsoluteLayout VerticalOptions="FillAndExpand">
@rdelrosario
rdelrosario / MainViewModel.cs
Created June 16, 2017 03:56
Filter Image Sample View Model
using System;
using System.Collections.ObjectModel;
using System.Windows.Input;
using ImageFilterSample.Helpers;
using ImageFilterSample.Models;
using Xamarin.Forms;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Linq;
@rdelrosario
rdelrosario / FilterImageRenderer.cs
Created June 16, 2017 03:58
Filter Image Renderer - Android
using FFImageLoading.Forms.Droid;
using FFImageLoading.Forms;
using Xamarin.Forms;
using ImageFilterSample.Controls;
using ImageFilterSample.Droid.Renderers;
using Android.Graphics;
using ImageFilterSample.Helpers;
using Xamarin.Forms.Platform.Android;
using System.Threading.Tasks;
using Android.Widget;
@rdelrosario
rdelrosario / FilterImageRenderer.cs
Created June 16, 2017 03:59
Filter Image Renderer - iOS
using FFImageLoading.Forms.Touch;
using FFImageLoading.Forms;
using Xamarin.Forms;
using ImageFilterSample.Controls;
using ImageFilterSample.iOS.Renderers;
using ImageFilterSample.Helpers;
using UIKit;
using Xamarin.Forms.Platform.iOS;
using System.Threading.Tasks;
using CoreImage;
@rdelrosario
rdelrosario / Apply Filter Android.cs
Last active June 16, 2017 14:16
Apply Filter Android
async void ApplyFilter(FilterType filterType)
{
if (currentFilterType == filterType)
return;
var filterImage = Element as FilterImage;
//originalBitmap = await GetBitmapAsync(filterImage.OriginalSource);
using (Bitmap originalBitmap = await GetBitmapAsync(filterImage.OriginalSource))
{
var oldFilteredBitmap = filteredBitmap;
async void ApplyFilter(FilterType filterType)
{
if (currentFilterType == filterType)
return;
var filterImage = Element as FilterImage;
var handler = GetHandler(filterImage.OriginalSource);
using (UIImage originalImage = await handler.LoadImageAsync(filterImage.OriginalSource))
{
switch (filterType)
@rdelrosario
rdelrosario / ZoomScrollViewRenderer.cs
Last active August 2, 2017 00:11
Zoomable ScrollView Android Renderer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
@rdelrosario
rdelrosario / ZoomScrollViewRenderer.cs
Created August 1, 2017 23:45
Zoomable ScrollView iOS Renderer
using ZoomableApp.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using System.Linq;
[assembly: ExportRenderer(typeof(ScrollView), typeof(ZoomScrollViewRenderer))]
namespace ZoomableApp.iOS.Renderers
{
public class ZoomScrollViewRenderer : ScrollViewRenderer