Skip to content

Instantly share code, notes, and snippets.

@equinox2k
equinox2k / RoundCornersProcessor.cs
Last active October 9, 2019 06:36
RoundCornersProcessor for ImageSharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using SixLabors.Shapes;
namespace EQL.ImageSharp
{
public static class RoundCornersProcessor
{
@equinox2k
equinox2k / SquircleProcessor.cs
Last active October 9, 2019 06:36
SquircleProcessor for ImageSharp
using System;
using System.Collections.Generic;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using SixLabors.Shapes;
namespace EQL.ImageSharp
{
@equinox2k
equinox2k / PNGOptimizer.cs
Created September 20, 2019 18:20
PNG Optimization
using SixLabors.ImageSharp;
using System;
using System.IO;
using System.Linq;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Advanced;
namespace TestCatalog
{
@equinox2k
equinox2k / IcoEncoder.cs
Last active September 9, 2019 20:46
Ico Image Encoder
using System;
using System.Linq;
using System.IO;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Advanced;
namespace EQL.IconAutosizer.ImageEncoders
{
@equinox2k
equinox2k / ICNSEncoder.cs
Last active September 9, 2019 20:56
Example ICNS encoder using ImageSharp
using System;
using System.Linq;
using System.IO;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;
namespace EQL.IconAutosizer.ImageEncoders
{
//https://en.wikipedia.org/wiki/Apple_Icon_Image_format
This file has been truncated, but you can view the full file.
Comment - !PS-Adobe-3.1 EPSF-3.0
Comment - ADO_DSC_Encoding: Windows Roman
Comment - %Title: FOIL_front_layout1-01.eps
Comment - %Creator: Adobe Illustrator(R) 21.0
Comment - %For: Bernard Hee
Comment - %CreationDate: 1/10/2019
Comment - %BoundingBox: 0 0 370 522
Comment - %HiResBoundingBox: 0 0 369.3600 522
Comment - %CropBox: 0 0 369.3600 522
Comment - %LanguageLevel: 2
@equinox2k
equinox2k / gist:7319939bf0e2d390bff0720f8e4990bd
Last active February 5, 2019 15:41
ImageSharpNormalMap.cs
using System;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.Numerics;
namespace TestNormal
{
class Program
{
Texture2D ShaderTexture : register(t0);
SamplerState Sampler : register(s0);
cbuffer PerObject: register(b0)
{
float4x4 ViewMatrix;
float2 TextureSize;
int Emboss;
float Unused1;
};
struct VertexShaderInput
Texture2D ShaderTexture : register(t0);
SamplerState Sampler : register(s0);
cbuffer PerObject: register(b0)
{
float4x4 ViewMatrix;
float2 TextureSize;
int Emboss;
float Unused1;
};
struct VertexShaderInput
Texture2D ShaderTexture : register(t0);
SamplerState Sampler : register(s0);
cbuffer PerObject: register(b0)
{
float4x4 ViewMatrix;
float2 TextureSize;
float Bias;
float InvertR;
float InvertG;
float Unused1;