Skip to content

Instantly share code, notes, and snippets.

View matthewrdev's full-sized avatar
🧗

Matthew Robbins matthewrdev

🧗
View GitHub Profile
@matthewrdev
matthewrdev / NullableDatePicker.cs
Last active August 25, 2022 23:58
A Xamarin.Forms date picker implementation that allows for nullable DateTime values.
using System;
using System.Collections.Generic;
using System.Windows.Input;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace MyApp.Controls
{
public class NullableDateChangedEventArgs : EventArgs
{
@matthewrdev
matthewrdev / NullableTimePicker.cs
Last active August 26, 2022 00:05
A Xamarin.Forms time picker implementation that allows for a nullable TimeSpan values.
using System;
using System.Windows.Input;
using Xamarin.Forms;
namespace MyApp.Controls
{
public class NullableTimeChangedEventArgs : EventArgs
{
public NullableTimeChangedEventArgs(TimeSpan? newValue, TimeSpan? oldValue)
{
@matthewrdev
matthewrdev / show_opencv_image_in_opengl.cpp
Created November 10, 2022 03:49 — forked from insaneyilin/show_opencv_image_in_opengl.cpp
Show opencv cv::Mat image in an OpenGL window(use GLFW)
/*
# Released under MIT License
Copyright (c) 2017 insaneyilin.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@matthewrdev
matthewrdev / InterceptBackButtonNavigationPageRenderer.Android.cs
Last active February 1, 2023 17:08
Intercepts the "soft" back button events from the Android toolbar and forwards them to the Page.OnBackButtonPressed for handling.
using System.Reflection;
using System.Threading.Tasks;
using Android.Content;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.AppCompat;
using AToolbar = AndroidX.AppCompat.Widget.Toolbar;
[assembly: ExportRenderer(typeof(NavigationPage), typeof(MyApp.Droid.Renderers.InterceptBackButtonNavigationPageRenderer))]
namespace MyApp.Droid.Renderers
{
@matthewrdev
matthewrdev / VideoFrameDecoderHelper
Created April 5, 2023 04:03
Copies an OpenCV Mat frame from BGR format into an RGBA buffer.
using System;
using System.Diagnostics;
using OpenCvSharp;
namespace MyApp
{
public static class VideoFrameDecoderHelper
{
/// <summary>
/// Performs a pointer arithmetic based decoding operation from the <paramref name="frame"/> into the frame buffer.
@matthewrdev
matthewrdev / SkiaVideoFrameRenderer
Created April 5, 2023 04:06
Renders an OpenCV frame via SkiaSharp.
using System;
using System.Diagnostics;
using System.Text;
using Microsoft.Extensions.Primitives;
using Microsoft.Maui.ApplicationModel;
using OpenCvSharp;
using SkiaSharp;
using static System.Net.Mime.MediaTypeNames;
namespace MyApp