mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-23 03:55:33 +00:00
Added BlendPictureBox
This commit is contained in:
52
PCK-Studio/Classes/ToolboxItems/BlendPictureBox.cs
Normal file
52
PCK-Studio/Classes/ToolboxItems/BlendPictureBox.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.ToolboxItems
|
||||
{
|
||||
internal class BlendPictureBox : PictureBoxWithInterpolationMode
|
||||
{
|
||||
[DefaultValue(false)]
|
||||
[Category("Blending")]
|
||||
public bool UseBlendColor
|
||||
{
|
||||
get => _useBlendColor;
|
||||
set => _useBlendColor = value;
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "Color.White")]
|
||||
[Category("Blending")]
|
||||
public Color BlendColor
|
||||
{
|
||||
get => _blendColor;
|
||||
set
|
||||
{
|
||||
UseBlendColor = value != Color.White;
|
||||
_blendColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(BlendMode), "BlendMode.Add")]
|
||||
[Category("Blending")]
|
||||
public BlendMode BlendMode
|
||||
{
|
||||
get => _blendMode;
|
||||
set => _blendMode = value;
|
||||
}
|
||||
|
||||
private bool _useBlendColor = false;
|
||||
private Color _blendColor = Color.White;
|
||||
private BlendMode _blendMode = BlendMode.Add;
|
||||
|
||||
public new Image Image
|
||||
{
|
||||
get => base.Image;
|
||||
set => base.Image = UseBlendColor ? value.Blend(BlendColor, BlendMode) : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,9 @@
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Classes\ToolboxItems\BlendPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Classes\ToolboxItems\PictureBoxWithInterpolationMode.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -768,57 +771,49 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
|
||||
<Target Name="GetGitInfo" BeforeTargets="WriteGitInfo" Condition="'$(BuildHash)' == ''">
|
||||
<!-- write hash and branch to console.-->
|
||||
<Exec Condition="'$(Configuration)' == 'Debug'" Command="git -C $(ProjectDir) describe --always" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitHash" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) branch --show-current" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch" />
|
||||
</Exec>
|
||||
<PropertyGroup>
|
||||
<BuildHash Condition="'$(Configuration)' == 'Debug'">$(GitHash)</BuildHash>
|
||||
<BuildBranch>$(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
<Target Name="WriteGitInfo" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../GitAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<GitAssemblyInfoFile>$(IntermediateOutputPath)GitAssemblyInfo.cs</GitAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the GitAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(GitAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata" Condition="'$(Configuration)' == 'Debug'">
|
||||
<_Parameter1>GitHash</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the GitAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(GitAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Delete PDBs" AfterTargets="Build" Condition=" '$(Configuration)' != 'Debug' ">
|
||||
<Exec Command="del $(OutputPath)*.pdb" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ZipOutputPath" AfterTargets="Build" Condition="'$(Configuration)' == 'Beta'">
|
||||
<PropertyGroup>
|
||||
<StringDate>$([System.DateTime]::Now.ToString('yyyy-MM-dd'))</StringDate>
|
||||
</PropertyGroup>
|
||||
<ZipDirectory
|
||||
SourceDirectory="$(OutputPath)"
|
||||
DestinationFile="$(OutputPath)\..\$(AssemblyName)_$(Configuration)_$(StringDate).zip"
|
||||
Overwrite="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="GetGitInfo" BeforeTargets="WriteGitInfo" Condition="'$(BuildHash)' == ''">
|
||||
<!-- write hash and branch to console.-->
|
||||
<Exec Condition="'$(Configuration)' == 'Debug'" Command="git -C $(ProjectDir) describe --always" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitHash" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) branch --show-current" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch" />
|
||||
</Exec>
|
||||
<PropertyGroup>
|
||||
<BuildHash Condition="'$(Configuration)' == 'Debug'">$(GitHash)</BuildHash>
|
||||
<BuildBranch>$(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
<Target Name="WriteGitInfo" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../GitAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<GitAssemblyInfoFile>$(IntermediateOutputPath)GitAssemblyInfo.cs</GitAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the GitAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(GitAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata" Condition="'$(Configuration)' == 'Debug'">
|
||||
<_Parameter1>GitHash</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the GitAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(GitAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
<Target Name="Delete PDBs" AfterTargets="Build" Condition=" '$(Configuration)' != 'Debug' ">
|
||||
<Exec Command="del $(OutputPath)*.pdb" />
|
||||
</Target>
|
||||
<Target Name="ZipOutputPath" AfterTargets="Build" Condition="'$(Configuration)' == 'Beta'">
|
||||
<PropertyGroup>
|
||||
<StringDate>$([System.DateTime]::Now.ToString('yyyy-MM-dd'))</StringDate>
|
||||
</PropertyGroup>
|
||||
<ZipDirectory SourceDirectory="$(OutputPath)" DestinationFile="$(OutputPath)\..\$(AssemblyName)_$(Configuration)_$(StringDate).zip" Overwrite="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user