This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nullable enable | |
using PaintDotNet.ComponentModel; | |
using PaintDotNet.Runtime; | |
using System; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
namespace PaintDotNet.Interop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////////// | |
// paint.net // | |
// Copyright (C) dotPDN LLC, Rick Brewster, and contributors. // | |
// All Rights Reserved. // | |
///////////////////////////////////////////////////////////////////////////////// | |
#nullable enable | |
using System; | |
using System.Runtime.CompilerServices; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Guid("8A5E0B48-E799-45d2-B714-3A48F48C2615")] | |
internal unsafe struct IFxObjectRef | |
: IFxObjectRef.Interface | |
{ | |
public interface Interface | |
: IUnknown.Interface | |
{ | |
unsafe HRESULT GetObject(GCHandle* gcHandle); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Idea 1: SHELLEXECUTEINFOW with nested structs, Windows is flat | |
public static class SHELLEXECUTEINFOW | |
{ | |
[StructLayout(..., Pack = 1)] | |
public struct X86 { ... } | |
[StructLayout(...)] | |
public struct X64 { ... } | |
[StructLayout(...)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary>Provides a thread-safe collection that contains objects of a type specified by the generic parameter as elements.</summary> | |
/// <typeparam name="T">The type of object contained as items in the thread-safe collection.</typeparam> | |
[ComVisible(false)] | |
public class SynchronizedCollection<T> | |
: IList<T>, | |
ICollection<T>, | |
IEnumerable<T>, | |
IEnumerable, | |
IList, | |
ICollection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
@rem %1 is the package name, e.g. Microsoft.NETCore.App.Host.win-x64 | |
@rem %2 is the package version, e.g. 5.0.* | |
@rem %3 is the TargetFramework, e.g. net5.0 | |
@rem %4 is the target folder, e.g. d:\src\pdn\src\lib\, which will not include the version and will have the package name appended to it, e.g. d:\src\pdn\src\lib\Microsoft.NETCore.App.Host.win-x64 | |
rem This uses a dummy project to retrieve the Microsoft.NETCore.App.Host nuget project, | |
rem which is needed for hostfxr.h, libnethost.lib, and nethost.h. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////////// | |
// paint.net // | |
// Copyright (C) dotPDN LLC, Rick Brewster, and contributors. // | |
// All Rights Reserved. // | |
///////////////////////////////////////////////////////////////////////////////// | |
using Microsoft.Toolkit.HighPerformance.Helpers; | |
using System; | |
using System.Diagnostics; | |
using System.Numerics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PLATFORM_ID_INVALID -1 | |
#define PLATFORM_ID_X86 0 | |
#define PLATFORM_ID_X64 1 | |
#define PLATFORM_ID_ARM 2 | |
#define PLATFORM_ID_ARM64 3 | |
// returns S_OK if the OS version check passes, S_FALSE if it doesn't, or a negative value on failure | |
HRESULT VerifyWindowsVersion(DWORD dwMajor, DWORD dwMinor, DWORD dwBuild, WORD wServicePack) noexcept | |
{ | |
if (dwMajor < 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Load32bpp_Scalar_Fn | |
{ | |
public: | |
static __forceinline uint32_t invoke(const uint32_t* p) | |
{ | |
return *p; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static unsafe void FillStencilFromPoint<TBitVector2D, TCheckColorFn>( | |
IRenderer<ColorBgra> sampleSource, | |
TBitVector2D stencilBuffer, | |
Point2Int32 startPt, | |
byte tolerance, | |
TCheckColorFn checkColorFn, | |
ICancellationToken cancelToken, | |
out RectInt32 bounds) | |
where TBitVector2D : IBitVector2D | |
where TCheckColorFn : IFunc<ColorBgra, ColorBgra, byte, bool> |
NewerOlder