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 / 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
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
@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;
<?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="ZoomScrollViewSample.MainPage"
BackgroundColor="Black">
<ContentPage.Content>
<ScrollView>
<StackLayout>
<Image Margin="0,30,0,0" Source="monkey" HeightRequest="60" HorizontalOptions="Center"/>
<Label Margin="40" FontSize="10" VerticalTextAlignment="Center" TextColor="White" Text="Monkeys are haplorhine primates, a group generally possessing tails and consisting of about 260 known living species. There are two distinct lineages of monkeys: New World Monkeys and catarrhines. Apes emerged within the catarrhines with the Old World monkeys as a sister group, so cladistically they are monkeys as well. However, traditionally apes are not considered monkeys, rendering this grouping paraphyletic. The equivalent monophyletic clade are the simians. Many monkey species are tr