mirror of
https://github.com/CTCaer/jc_toolkit
synced 2026-11-26 09:08:07 +08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99af931d0d | ||
|
|
66154cf365 | ||
|
|
23f9f8047b |
No files matched your search
@@ -1,20 +1,16 @@
|
||||
# Joy-Con Toolkit
|
||||
|
||||

|
||||
This image is for reference.
|
||||
Joy-Con Toolkit
|
||||
|
||||
## Prerequisites:
|
||||
|
||||
**Microsoft Visual C++ 2017 (x86) Redistributable** (All Windows versions)
|
||||
|
||||
**Microsoft .NET Framework 4.7.1** (for Windows lower than Windows 10)
|
||||
Needs .NET Framework 4.5.2
|
||||
|
||||
## References:
|
||||
|
||||
**Official forum** and **Binary releases**: https://gbatemp.net/threads/tool-joy-con-toolkit-v1-0.478560/
|
||||
Official forum: https://gbatemp.net/threads/tool-joy-con-toolkit-v1-0.478560/
|
||||
|
||||
**Protocol reverse engineering**: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering
|
||||
Protocol reverse engineering: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering
|
||||
|
||||
**Protocol and hidapi usage in Linux**: https://github.com/shinyquagsire23/HID-Joy-Con-Whispering
|
||||
Protocol and hidapi usage in Linux: https://github.com/shinyquagsire23/HID-Joy-Con-Whispering
|
||||
|
||||
**In windows**: https://github.com/shuffle2/nxpad
|
||||
In windows: https://github.com/shuffle2/nxpad
|
||||
@@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jctool", "jctool\jctool.vs2017.vcxproj", "{DF218734-A810-4FFF-8164-638680773512}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jcColorDialog", "jctool\jc_colorpicker\jcColorDialog.vs2017.csproj", "{22E08F67-4E40-4A92-876B-410FFD49B20E}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jctool", "jctool\jctool.vcxproj", "{DF218734-A810-4FFF-8164-638680773512}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -14,8 +12,6 @@ Global
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DF218734-A810-4FFF-8164-638680773512}.Release|x86.ActiveCfg = Release|Win32
|
||||
{DF218734-A810-4FFF-8164-638680773512}.Release|x86.Build.0 = Release|Win32
|
||||
{22E08F67-4E40-4A92-876B-410FFD49B20E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{22E08F67-4E40-4A92-876B-410FFD49B20E}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<!--Values are in BGR not in RGB-->
|
||||
<!--Bodycolor for JoyCon-->
|
||||
<bodycolors>
|
||||
<bodycolors_v key="CustomColor" value="828282" />
|
||||
<bodycolors_v key="CustomColor" value="E6B90A" />
|
||||
<bodycolors_v key="CustomColor" value="283CFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFE6" />
|
||||
<bodycolors_v key="CustomColor" value="7832FF" />
|
||||
<bodycolors_v key="CustomColor" value="DC1E" />
|
||||
<bodycolors_v key="CustomColor" value="000FE1" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
</bodycolors>
|
||||
<!--Body color for Pro Controller-->
|
||||
<bodycolors_pro>
|
||||
<bodycolors_pro_v key="CustomColor" value="323232" />
|
||||
<bodycolors_pro_v key="CustomColor" value="323231" />
|
||||
<bodycolors_pro_v key="CustomColor" value="828282" />
|
||||
<bodycolors_pro_v key="CustomColor" value="E6B90A" />
|
||||
<bodycolors_pro_v key="CustomColor" value="283CFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFE6" />
|
||||
<bodycolors_pro_v key="CustomColor" value="7832FF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="DC1E" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
</bodycolors_pro>
|
||||
<!--Button color for Pro Controller-->
|
||||
<buttoncolors>
|
||||
<buttoncolors_v key="CustomColor" value="F0F0F" />
|
||||
<buttoncolors_v key="CustomColor" value="1E1E00" />
|
||||
<buttoncolors_v key="CustomColor" value="A0A1E" />
|
||||
<buttoncolors_v key="CustomColor" value="2814" />
|
||||
<buttoncolors_v key="CustomColor" value="1E0028" />
|
||||
<buttoncolors_v key="CustomColor" value="2800" />
|
||||
<buttoncolors_v key="CustomColor" value="0A0A28" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
</buttoncolors>
|
||||
</configuration>
|
||||
+3598
-6591
File diff suppressed because it is too large.
Load diff
+11
-2
@@ -117,6 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="colorDialog2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>138, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>259, 17</value>
|
||||
</metadata>
|
||||
@@ -170,9 +176,12 @@ Click to change between Celsius and Fahrenheit </value>
|
||||
<value>Make a backup first!
|
||||
If you lose your serial number, bad things will happen!
|
||||
|
||||
If you currently have the stock S/N, this will create a backup of it inside SPI.
|
||||
If you currently have the stock S/N, this will also create a backup of it inside the SPI.
|
||||
|
||||
Restore it either here from the SPI backed up S/N or through Restore option.</value>
|
||||
Restore it either here from the SPI backed up S/N or through Restore option from your SPI backup.
|
||||
|
||||
|
||||
Maximum 15 ASCII characters.</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
+82
-77
@@ -1,87 +1,92 @@
|
||||
#pragma once
|
||||
namespace Overrides {
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Drawing;
|
||||
public ref class TestColorTable : ProfessionalColorTable
|
||||
{
|
||||
public: property Color ToolStripDropDownBackground
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemSelected
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color MenuBorder
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemBorder
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(70, 70, 70);
|
||||
}
|
||||
}
|
||||
|
||||
public ref class TestColorTable : ProfessionalColorTable {
|
||||
public: property Color ToolStripDropDownBackground
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemPressedGradientBegin
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemSelected
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemPressedGradientEnd
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color ImageMarginGradientBegin
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuBorder
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color ImageMarginGradientEnd
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemBorder
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(70, 70, 70);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemSelectedGradientBegin
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemSelectedGradientEnd
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public: property Color MenuItemPressedGradientBegin
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public ref class OverrideTSSR : ToolStripSystemRenderer
|
||||
{
|
||||
public: OverrideTSSR() { }
|
||||
|
||||
public: property Color MenuItemPressedGradientEnd
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color ImageMarginGradientBegin
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color ImageMarginGradientEnd
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemSelectedGradientBegin
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemSelectedGradientEnd
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public ref class OverrideTSSR : ToolStripSystemRenderer {
|
||||
public: OverrideTSSR() {}
|
||||
|
||||
protected: virtual void OnRenderToolStripBorder(ToolStripRenderEventArgs^ e) override {
|
||||
// Do nothing
|
||||
}
|
||||
};
|
||||
protected: virtual void OnRenderToolStripBorder(ToolStripRenderEventArgs^ e) override
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- Per Monitor V1 [OS >= Windows 8.1]
|
||||
Values: False, True, Per-monitor, True/PM -->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<!-- Per Monitor V1 [OS >= Windows 10 Anniversary Update (1607, 10.0.14393, Redstone 1)]
|
||||
Values: Unaware, System, PerMonitor -->
|
||||
<!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)]
|
||||
Value: PerMonitorV2 -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
@@ -65,7 +65,6 @@ extern "C" {
|
||||
|
||||
|
||||
#include "hidapi.h"
|
||||
#include "hidapi_log.h"
|
||||
|
||||
#undef MIN
|
||||
#define MIN(x,y) ((x) < (y)? (x): (y))
|
||||
@@ -613,15 +612,6 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *
|
||||
{
|
||||
DWORD bytes_written;
|
||||
BOOL res;
|
||||
FILE *traffic_dump_file;
|
||||
errno_t err_traffic;
|
||||
|
||||
// Traffic dump debug log
|
||||
if (enable_traffic_dump) {
|
||||
if ((err_traffic = fopen_s(&traffic_dump_file, "./traffic_log.txt", "a+")) != 0) {
|
||||
enable_traffic_dump = false;
|
||||
}
|
||||
}
|
||||
|
||||
OVERLAPPED ol;
|
||||
unsigned char *buf;
|
||||
@@ -645,15 +635,6 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *
|
||||
length = dev->output_report_length;
|
||||
}
|
||||
|
||||
// Log buffer to a text file
|
||||
if (enable_traffic_dump) {
|
||||
fprintf_s(traffic_dump_file, "%s", "W: ");
|
||||
for (int buf_index = 0; buf_index < dev->output_report_length; buf_index++)
|
||||
fprintf_s(traffic_dump_file, "%02x ", buf[buf_index]);
|
||||
fprintf_s(traffic_dump_file, "%s", "\n\n");
|
||||
fclose(traffic_dump_file);
|
||||
}
|
||||
|
||||
res = WriteFile(dev->device_handle, buf, length, NULL, &ol);
|
||||
|
||||
if (!res) {
|
||||
@@ -688,15 +669,6 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
|
||||
DWORD bytes_read = 0;
|
||||
size_t copy_len = 0;
|
||||
BOOL res;
|
||||
FILE *traffic_dump_file;
|
||||
errno_t err_traffic;
|
||||
|
||||
// Traffic dump debug log
|
||||
if (enable_traffic_dump) {
|
||||
if ((err_traffic = fopen_s(&traffic_dump_file, "./traffic_log.txt", "a+")) != 0) {
|
||||
enable_traffic_dump = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the handle for convenience. */
|
||||
HANDLE ev = dev->ol.hEvent;
|
||||
@@ -760,17 +732,6 @@ end_of_function:
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Log buffer to a text file
|
||||
if (enable_traffic_dump) {
|
||||
fprintf_s(traffic_dump_file, "%s", "R: ");
|
||||
for (int buf_index = 0; buf_index < (int)copy_len; buf_index++)
|
||||
fprintf_s(traffic_dump_file, "%02x ", data[buf_index]);
|
||||
if ((int)copy_len == 0)
|
||||
fprintf_s(traffic_dump_file, "%s", "Requested hid read length was 0 bytes.");
|
||||
fprintf_s(traffic_dump_file, "%s", "\n\n");
|
||||
fclose(traffic_dump_file);
|
||||
}
|
||||
|
||||
return copy_len;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#pragma once
|
||||
extern bool enable_traffic_dump;
|
||||
+602
-1404
File diff suppressed because it is too large.
Load diff
@@ -1,58 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// crc-8-ccitt / polynomial 0x07 look up table
|
||||
static uint8_t mcu_crc8_table[256] = {
|
||||
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
|
||||
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
|
||||
0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
|
||||
0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD,
|
||||
0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA,
|
||||
0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2, 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
|
||||
0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A,
|
||||
0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A,
|
||||
0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C, 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
|
||||
0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4,
|
||||
0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44,
|
||||
0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C, 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
|
||||
0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63,
|
||||
0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13,
|
||||
0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB, 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
|
||||
0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
|
||||
};
|
||||
|
||||
// ARGB Ironbow palette
|
||||
static uint32_t iron_palette[] = {
|
||||
0xff000014, 0xff000025, 0xff00002a, 0xff000032, 0xff000036, 0xff00003e, 0xff000042, 0xff00004f,
|
||||
0xff010055, 0xff010057, 0xff02005c, 0xff03005e, 0xff040063, 0xff050065, 0xff070069, 0xff0a0070,
|
||||
0xff0b0073, 0xff0d0075, 0xff0d0076, 0xff100078, 0xff120079, 0xff15007c, 0xff17007d, 0xff1c0081,
|
||||
0xff200084, 0xff220085, 0xff260087, 0xff280089, 0xff2c008a, 0xff2e008b, 0xff32008d, 0xff38008f,
|
||||
0xff390090, 0xff3c0092, 0xff3e0093, 0xff410094, 0xff420095, 0xff450096, 0xff470096, 0xff4c0097,
|
||||
0xff4f0097, 0xff510097, 0xff540098, 0xff560098, 0xff5a0099, 0xff5c0099, 0xff5f009a, 0xff64009b,
|
||||
0xff66009b, 0xff6a009b, 0xff6c009c, 0xff6f009c, 0xff70009c, 0xff73009d, 0xff75009d, 0xff7a009d,
|
||||
0xff7e009d, 0xff7f009d, 0xff83009d, 0xff84009d, 0xff87009d, 0xff89009d, 0xff8b009d, 0xff91009c,
|
||||
0xff93009c, 0xff96009b, 0xff98009b, 0xff9b009b, 0xff9c009b, 0xff9f009b, 0xffa0009b, 0xffa4009b,
|
||||
0xffa7009a, 0xffa8009a, 0xffaa0099, 0xffab0099, 0xffae0198, 0xffaf0198, 0xffb00198, 0xffb30196,
|
||||
0xffb40296, 0xffb60295, 0xffb70395, 0xffb90495, 0xffba0495, 0xffbb0593, 0xffbc0593, 0xffbf0692,
|
||||
0xffc00791, 0xffc00791, 0xffc10990, 0xffc20a8f, 0xffc30b8e, 0xffc40c8d, 0xffc60d8b, 0xffc81088,
|
||||
0xffc91187, 0xffca1385, 0xffcb1385, 0xffcc1582, 0xffcd1681, 0xffce187e, 0xffcf187c, 0xffd11b78,
|
||||
0xffd21c75, 0xffd21d74, 0xffd32071, 0xffd4216f, 0xffd5236b, 0xffd52469, 0xffd72665, 0xffd92a60,
|
||||
0xffda2b5e, 0xffdb2e5a, 0xffdb2f57, 0xffdd3051, 0xffdd314e, 0xffde3347, 0xffdf3444, 0xffe0373a,
|
||||
0xffe03933, 0xffe13a30, 0xffe23c2a, 0xffe33d26, 0xffe43f20, 0xffe4411d, 0xffe5431b, 0xffe64616,
|
||||
0xffe74715, 0xffe74913, 0xffe84a12, 0xffe84c0f, 0xffe94d0e, 0xffea4e0c, 0xffea4f0c, 0xffeb520a,
|
||||
0xffec5409, 0xffec5608, 0xffec5808, 0xffed5907, 0xffed5b06, 0xffee5c06, 0xffee5d05, 0xffef6004,
|
||||
0xffef6104, 0xfff06303, 0xfff06403, 0xfff16603, 0xfff16603, 0xfff16803, 0xfff16902, 0xfff16b02,
|
||||
0xfff26d01, 0xfff26e01, 0xfff37001, 0xfff37101, 0xfff47300, 0xfff47400, 0xfff47600, 0xfff47a00,
|
||||
0xfff57b00, 0xfff57e00, 0xfff57f00, 0xfff68100, 0xfff68200, 0xfff78400, 0xfff78500, 0xfff88800,
|
||||
0xfff88900, 0xfff88a00, 0xfff88c00, 0xfff98d00, 0xfff98e00, 0xfff98f00, 0xfff99100, 0xfffa9400,
|
||||
0xfffa9500, 0xfffb9800, 0xfffb9900, 0xfffb9c00, 0xfffc9d00, 0xfffca000, 0xfffca100, 0xfffda400,
|
||||
0xfffda700, 0xfffda800, 0xfffdab00, 0xfffdac00, 0xfffdae00, 0xfffeaf00, 0xfffeb100, 0xfffeb400,
|
||||
0xfffeb500, 0xfffeb800, 0xfffeb900, 0xfffeba00, 0xfffebb00, 0xfffebd00, 0xfffebe00, 0xfffec200,
|
||||
0xfffec400, 0xfffec500, 0xfffec700, 0xfffec800, 0xfffeca01, 0xfffeca01, 0xfffecc02, 0xfffecf04,
|
||||
0xfffecf04, 0xfffed106, 0xfffed308, 0xfffed50a, 0xfffed60a, 0xfffed80c, 0xfffed90d, 0xffffdb10,
|
||||
0xffffdc14, 0xffffdd16, 0xffffde1b, 0xffffdf1e, 0xffffe122, 0xffffe224, 0xffffe328, 0xffffe531,
|
||||
0xffffe635, 0xffffe73c, 0xffffe83f, 0xffffea46, 0xffffeb49, 0xffffec50, 0xffffed54, 0xffffee5f,
|
||||
0xffffef67, 0xfffff06a, 0xfffff172, 0xfffff177, 0xfffff280, 0xfffff285, 0xfffff38e, 0xfffff49a,
|
||||
0xfffff59e, 0xfffff5a6, 0xfffff6aa, 0xfffff7b3, 0xfffff7b6, 0xfffff8bd, 0xfffff8c1, 0xfffff9ca,
|
||||
0xfffffad1, 0xfffffad4, 0xfffffcdb, 0xfffffcdf, 0xfffffde5, 0xfffffde8, 0xfffffeee, 0xfffffff6
|
||||
};
|
||||
|
||||
@@ -1,312 +0,0 @@
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** Project: Joy-Con Color Picker *****/
|
||||
/***** Filename: AdobeColors.cs *****/
|
||||
/***** Original Project: Adobe Color Picker Clone 1 *****/
|
||||
/***** Original Author: Danny Blanchard *****/
|
||||
/***** - scrabcakes@gmail.com *****/
|
||||
/***** Updates: *****/
|
||||
/***** 3/28/2005 - Initial Version : Danny Blanchard *****/
|
||||
/***** Feb 2018 - JoyCon Version : CTCaer *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** This version is heavily optimised for use in *****/
|
||||
/***** CTCaer's Joy-Con Toolkit and other projects. *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace jcColor {
|
||||
/// <summary>
|
||||
/// Summary description for AdobeColors.
|
||||
/// </summary>
|
||||
public class AdobeColors
|
||||
{
|
||||
#region Constructors / Destructors
|
||||
|
||||
public AdobeColors()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sets the absolute brightness of a colour
|
||||
/// </summary>
|
||||
/// <param name="c">Original colour</param>
|
||||
/// <param name="brightness">The luminance level to impose</param>
|
||||
/// <returns>an adjusted colour</returns>
|
||||
public static Color SetBrightness(Color c, double brightness)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.L=brightness;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an existing brightness level
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To reduce brightness use a number smaller than 1. To increase brightness use a number larger tnan 1
|
||||
/// </remarks>
|
||||
/// <param name="c">The original colour</param>
|
||||
/// <param name="brightness">The luminance delta</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color ModifyBrightness(Color c, double brightness)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.L*=brightness;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the absolute saturation level
|
||||
/// </summary>
|
||||
/// <remarks>Accepted values 0-1</remarks>
|
||||
/// <param name="c">An original colour</param>
|
||||
/// <param name="Saturation">The saturation value to impose</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color SetSaturation(Color c, double Saturation)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.S=Saturation;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an existing Saturation level
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To reduce Saturation use a number smaller than 1. To increase Saturation use a number larger tnan 1
|
||||
/// </remarks>
|
||||
/// <param name="c">The original colour</param>
|
||||
/// <param name="Saturation">The saturation delta</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color ModifySaturation(Color c, double Saturation)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.S*=Saturation;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the absolute Hue level
|
||||
/// </summary>
|
||||
/// <remarks>Accepted values 0-1</remarks>
|
||||
/// <param name="c">An original colour</param>
|
||||
/// <param name="Hue">The Hue value to impose</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color SetHue(Color c, double Hue)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.H=Hue;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an existing Hue level
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To reduce Hue use a number smaller than 1. To increase Hue use a number larger tnan 1
|
||||
/// </remarks>
|
||||
/// <param name="c">The original colour</param>
|
||||
/// <param name="Hue">The Hue delta</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color ModifyHue(Color c, double Hue)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.H*=Hue;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a colour from HSL to RGB
|
||||
/// </summary>
|
||||
/// <remarks>Adapted from the algoritm in Foley and Van-Dam</remarks>
|
||||
/// <param name="hsl">The HSL value</param>
|
||||
/// <returns>A Color structure containing the equivalent RGB values</returns>
|
||||
public static Color HSL_to_RGB(HSL hsl)
|
||||
{
|
||||
int Max, Mid, Min;
|
||||
double q;
|
||||
|
||||
Max = Round(hsl.L * 255);
|
||||
Min = Round((1.0 - hsl.S)*(hsl.L/1.0)*255);
|
||||
q = (double)(Max - Min)/255;
|
||||
|
||||
if ( hsl.H >= 0 && hsl.H <= (double)1/6 )
|
||||
{
|
||||
Mid = Round(((hsl.H - 0) * q) * 1530 + Min);
|
||||
return Color.FromArgb(Max,Mid,Min);
|
||||
}
|
||||
else if ( hsl.H <= (double)1/3 )
|
||||
{
|
||||
Mid = Round(-((hsl.H - (double)1/6) * q) * 1530 + Max);
|
||||
return Color.FromArgb(Mid,Max,Min);
|
||||
}
|
||||
else if ( hsl.H <= 0.5 )
|
||||
{
|
||||
Mid = Round(((hsl.H - (double)1/3) * q) * 1530 + Min);
|
||||
return Color.FromArgb(Min,Max,Mid);
|
||||
}
|
||||
else if ( hsl.H <= (double)2/3 )
|
||||
{
|
||||
Mid = Round(-((hsl.H - 0.5) * q) * 1530 + Max);
|
||||
return Color.FromArgb(Min,Mid,Max);
|
||||
}
|
||||
else if ( hsl.H <= (double)5/6 )
|
||||
{
|
||||
Mid = Round(((hsl.H - (double)2/3) * q) * 1530 + Min);
|
||||
return Color.FromArgb(Mid,Min,Max);
|
||||
}
|
||||
else if ( hsl.H <= 1.0 )
|
||||
{
|
||||
Mid = Round(-((hsl.H - (double)5/6) * q) * 1530 + Max);
|
||||
return Color.FromArgb(Max,Min,Mid);
|
||||
}
|
||||
else return Color.FromArgb(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts RGB to HSL
|
||||
/// </summary>
|
||||
/// <remarks>Takes advantage of whats already built in to .NET by using the Color.GetHue, Color.GetSaturation and Color.GetBrightness methods</remarks>
|
||||
/// <param name="c">A Color to convert</param>
|
||||
/// <returns>An HSL value</returns>
|
||||
public static HSL RGB_to_HSL (Color c)
|
||||
{
|
||||
HSL hsl = new HSL();
|
||||
|
||||
int Max, Min, Diff, Sum;
|
||||
|
||||
// Of our RGB values, assign the highest value to Max, and the Smallest to Min
|
||||
if ( c.R > c.G ) { Max = c.R; Min = c.G; }
|
||||
else { Max = c.G; Min = c.R; }
|
||||
if ( c.B > Max ) Max = c.B;
|
||||
else if ( c.B < Min ) Min = c.B;
|
||||
|
||||
Diff = Max - Min;
|
||||
Sum = Max + Min;
|
||||
|
||||
// Luminance - a.k.a. Brightness - Adobe photoshop uses the logic that the
|
||||
// site VBspeed regards (regarded) as too primitive = superior decides the
|
||||
// level of brightness.
|
||||
hsl.L = (double)Max/255;
|
||||
|
||||
// Saturation
|
||||
if ( Max == 0 ) hsl.S = 0; // Protecting from the impossible operation of division by zero.
|
||||
else hsl.S = (double)Diff/Max; // The logic of Adobe Photoshops is this simple.
|
||||
|
||||
// Hue R is situated at the angel of 360 eller noll degrees;
|
||||
// G vid 120 degrees
|
||||
// B vid 240 degrees
|
||||
double q;
|
||||
if ( Diff == 0 ) q = 0; // Protecting from the impossible operation of division by zero.
|
||||
else q = (double)60/Diff;
|
||||
|
||||
if ( Max == c.R )
|
||||
{
|
||||
if ( c.G < c.B ) hsl.H = (double)(360 + q * (c.G - c.B))/360;
|
||||
else hsl.H = (double)(q * (c.G - c.B))/360;
|
||||
}
|
||||
else if ( Max == c.G ) hsl.H = (double)(120 + q * (c.B - c.R))/360;
|
||||
else if ( Max == c.B ) hsl.H = (double)(240 + q * (c.R - c.G))/360;
|
||||
else hsl.H = 0.0;
|
||||
|
||||
return hsl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Custom rounding function.
|
||||
/// </summary>
|
||||
/// <param name="val">Value to round</param>
|
||||
/// <returns>Rounded value</returns>
|
||||
private static int Round(double val)
|
||||
{
|
||||
int ret_val = (int)val;
|
||||
|
||||
int temp = (int)(val * 100);
|
||||
|
||||
if ( (temp % 100) >= 50 )
|
||||
ret_val += 1;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class HSL
|
||||
{
|
||||
#region Class Variables
|
||||
|
||||
public HSL()
|
||||
{
|
||||
_h=0;
|
||||
_s=0;
|
||||
_l=0;
|
||||
}
|
||||
|
||||
double _h;
|
||||
double _s;
|
||||
double _l;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public double H
|
||||
{
|
||||
get{return _h;}
|
||||
set
|
||||
{
|
||||
_h=value;
|
||||
_h=_h>1 ? 1 : _h<0 ? 0 : _h;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public double S
|
||||
{
|
||||
get{return _s;}
|
||||
set
|
||||
{
|
||||
_s=value;
|
||||
_s=_s>1 ? 1 : _s<0 ? 0 : _s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public double L
|
||||
{
|
||||
get{return _l;}
|
||||
set
|
||||
{
|
||||
_l=value;
|
||||
_l=_l>1 ? 1 : _l<0 ? 0 : _l;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("Joy-Con Toolkit Color Picker Library")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("CTCaer Designs S.A.")]
|
||||
[assembly: AssemblyProduct("Joy-Con Color Picker")]
|
||||
[assembly: AssemblyCopyright("CTCaer ©")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.7.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -1,152 +0,0 @@
|
||||
// Original code from
|
||||
// Color Picker with Color Wheel and Eye Dropper
|
||||
// by jkristia
|
||||
//
|
||||
// Modified by:
|
||||
// CTCaer | Feb 2018.
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor {
|
||||
class EyedropColorPicker : Control
|
||||
{
|
||||
public event EventHandler SelectedColorChanged;
|
||||
|
||||
Bitmap m_snapshot;
|
||||
Bitmap m_icon;
|
||||
Color m_selectedColor;
|
||||
float m_zoom = 4;
|
||||
public int Zoom
|
||||
{
|
||||
get { return (int)m_zoom; }
|
||||
set
|
||||
{
|
||||
m_zoom = value;
|
||||
RecalcSnapshotSize();
|
||||
}
|
||||
}
|
||||
public Color SelectedColor
|
||||
{
|
||||
get { return m_selectedColor; }
|
||||
set
|
||||
{
|
||||
if (m_selectedColor == value)
|
||||
return;
|
||||
}
|
||||
}
|
||||
public EyedropColorPicker()
|
||||
{
|
||||
this.DoubleBuffered = true;
|
||||
m_icon = new Bitmap(jcColor.Properties.Resources.eyedropper);
|
||||
m_icon.MakeTransparent(Color.Magenta);
|
||||
}
|
||||
RectangleF ImageRect
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Rect(ClientRectangle);
|
||||
}
|
||||
}
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
RecalcSnapshotSize();
|
||||
}
|
||||
void RecalcSnapshotSize()
|
||||
{
|
||||
if (m_snapshot != null)
|
||||
m_snapshot.Dispose();
|
||||
RectangleF r = ImageRect;
|
||||
int w = (int)(Math.Floor(r.Width / Zoom));
|
||||
int h = (int)(Math.Floor(r.Height / Zoom));
|
||||
m_snapshot = new Bitmap(w, h);
|
||||
}
|
||||
void GetSnapshot()
|
||||
{
|
||||
Point p = Control.MousePosition;
|
||||
p.X -= m_snapshot.Width / 2;
|
||||
p.Y -= m_snapshot.Height / 2;
|
||||
|
||||
using (Graphics dc = Graphics.FromImage(m_snapshot))
|
||||
{
|
||||
dc.CopyFromScreen(p, new Point(0,0), m_snapshot.Size);
|
||||
Refresh(); //Invalidate();
|
||||
|
||||
PointF center = Util.Center(new RectangleF(0, 0, m_snapshot.Size.Width, m_snapshot.Size.Height));
|
||||
Color c = m_snapshot.GetPixel((int)Math.Round(center.X), (int)Math.Round(center.Y));
|
||||
if (c != m_selectedColor)
|
||||
{
|
||||
m_selectedColor = c;
|
||||
if (SelectedColorChanged != null)
|
||||
SelectedColorChanged(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Rectangle rr = ClientRectangle;
|
||||
|
||||
if (m_snapshot != null)
|
||||
{
|
||||
e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
RectangleF r = RectangleF.Empty;
|
||||
r.Width = m_snapshot.Size.Width * Zoom;
|
||||
r.Height = m_snapshot.Size.Height * Zoom;
|
||||
r.X = 0;
|
||||
r.Y = 0;
|
||||
e.Graphics.DrawImage(m_snapshot, r);
|
||||
|
||||
if (iscapturing)
|
||||
{
|
||||
PointF center = Util.Center(r);
|
||||
Rectangle centerrect = new Rectangle(Util.Point(center), new Size(0, 0));
|
||||
centerrect.X -= ((int)Zoom / 2 - 1);
|
||||
centerrect.Y -= ((int)Zoom / 2 - 1);
|
||||
centerrect.Width = (int)Zoom;
|
||||
centerrect.Height = (int)Zoom;
|
||||
e.Graphics.DrawRectangle(Pens.Black, centerrect);
|
||||
}
|
||||
else
|
||||
{
|
||||
int offset = 3;
|
||||
e.Graphics.FillRectangle(SystemBrushes.Control, new Rectangle(new Point(offset,offset), m_icon.Size));
|
||||
e.Graphics.DrawImage(m_icon, offset, offset);
|
||||
}
|
||||
}
|
||||
Pen pen = new Pen(BackColor, 3);
|
||||
rr.Inflate(-1,-1);
|
||||
e.Graphics.DrawRectangle(pen, rr);
|
||||
Util.DrawFrame(e.Graphics, rr, 6, Color.CadetBlue);
|
||||
}
|
||||
bool iscapturing = false;
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if ((e.Button & MouseButtons.Left)== MouseButtons.Left)
|
||||
{
|
||||
Cursor = Cursors.Cross;
|
||||
iscapturing = true;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if ((e.Button & MouseButtons.Left)== MouseButtons.Left)
|
||||
GetSnapshot();
|
||||
}
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
{
|
||||
Cursor = Cursors.Arrow;
|
||||
iscapturing = false;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
namespace jcColor
|
||||
{
|
||||
partial class PresetNameDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtbox_presetName = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.m_btn_OK = new System.Windows.Forms.Button();
|
||||
this.m_btn_Cancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtbox_presetName
|
||||
//
|
||||
this.txtbox_presetName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.txtbox_presetName.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtbox_presetName.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtbox_presetName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
|
||||
this.txtbox_presetName.Location = new System.Drawing.Point(12, 45);
|
||||
this.txtbox_presetName.Name = "txtbox_presetName";
|
||||
this.txtbox_presetName.Size = new System.Drawing.Size(245, 20);
|
||||
this.txtbox_presetName.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
|
||||
this.label1.Location = new System.Drawing.Point(9, 19);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(131, 17);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Enter preset\'s name:";
|
||||
//
|
||||
// m_btn_OK
|
||||
//
|
||||
this.m_btn_OK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.m_btn_OK.FlatAppearance.BorderSize = 0;
|
||||
this.m_btn_OK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.m_btn_OK.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(161)));
|
||||
this.m_btn_OK.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(188)))), ((int)(((byte)(0)))));
|
||||
this.m_btn_OK.Location = new System.Drawing.Point(170, 81);
|
||||
this.m_btn_OK.Name = "m_btn_OK";
|
||||
this.m_btn_OK.Size = new System.Drawing.Size(87, 30);
|
||||
this.m_btn_OK.TabIndex = 5;
|
||||
this.m_btn_OK.Text = "OK";
|
||||
this.m_btn_OK.UseVisualStyleBackColor = false;
|
||||
this.m_btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
|
||||
//
|
||||
// m_btn_Cancel
|
||||
//
|
||||
this.m_btn_Cancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.m_btn_Cancel.FlatAppearance.BorderSize = 0;
|
||||
this.m_btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.m_btn_Cancel.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(161)));
|
||||
this.m_btn_Cancel.ForeColor = System.Drawing.Color.OrangeRed;
|
||||
this.m_btn_Cancel.Location = new System.Drawing.Point(68, 81);
|
||||
this.m_btn_Cancel.Name = "m_btn_Cancel";
|
||||
this.m_btn_Cancel.Size = new System.Drawing.Size(87, 30);
|
||||
this.m_btn_Cancel.TabIndex = 6;
|
||||
this.m_btn_Cancel.Text = "Cancel";
|
||||
this.m_btn_Cancel.UseVisualStyleBackColor = false;
|
||||
this.m_btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
|
||||
//
|
||||
// PresetNameDialog
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
|
||||
this.ClientSize = new System.Drawing.Size(267, 125);
|
||||
this.Controls.Add(this.m_btn_Cancel);
|
||||
this.Controls.Add(this.m_btn_OK);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.txtbox_presetName);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "PresetNameDialog";
|
||||
this.ShowIcon = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Update Preset";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
public System.Windows.Forms.TextBox txtbox_presetName;
|
||||
private System.Windows.Forms.Label label1;
|
||||
public System.Windows.Forms.Button m_btn_OK;
|
||||
public System.Windows.Forms.Button m_btn_Cancel;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor
|
||||
{
|
||||
public partial class PresetNameDialog : Form
|
||||
{
|
||||
public PresetNameDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.AcceptButton = this.m_btn_OK;
|
||||
}
|
||||
|
||||
private void btn_OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btn_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,73 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace jcColor.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("jcColor.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap eyedropper {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("eyedropper", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="eyedropper" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\eyedropper.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,312 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
internal class resfinder
|
||||
{
|
||||
// Trick from Bob Powell
|
||||
}
|
||||
|
||||
namespace jcColor.Buttons
|
||||
{
|
||||
[Description("Round (Elliptical) Button Control")]
|
||||
public class RoundButton : System.Windows.Forms.Button
|
||||
{
|
||||
#region Public Properties
|
||||
public override string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return buttonText;
|
||||
}
|
||||
set
|
||||
{
|
||||
buttonText = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool checkedFocus;
|
||||
[Bindable(true), Category("Button Appearance"),
|
||||
DefaultValue(false),
|
||||
Description("Specifies if the button is checked.")]
|
||||
public bool CheckedFocus {
|
||||
get {
|
||||
return checkedFocus;
|
||||
}
|
||||
set {
|
||||
checkedFocus = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public int buttonPressOffset;
|
||||
[Bindable(true), Category("Button Appearance"),
|
||||
DefaultValue(0),
|
||||
Description("Specifies if the button is pressed.")]
|
||||
public int ButtonPressOffset {
|
||||
get {
|
||||
return buttonPressOffset;
|
||||
}
|
||||
set {
|
||||
buttonPressOffset = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Windows form control derived from Button, to create round and elliptical buttons
|
||||
/// </summary>
|
||||
public RoundButton()
|
||||
{
|
||||
this.Name = "RoundButton";
|
||||
this.Size = new System.Drawing.Size(50, 50); // Default size of control
|
||||
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mouseDown);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.mouseUp);
|
||||
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.keyDown);
|
||||
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.keyUp);
|
||||
}
|
||||
|
||||
#region Private properties
|
||||
|
||||
private Color buttonColor;
|
||||
private String buttonText;
|
||||
|
||||
private Color edgeColor1; // Change if button pressed
|
||||
private Color edgeColor2; //
|
||||
private int edgeWidth; // Width of button edge
|
||||
private Color cColor = Color.White; // Centre colour for Path Gradient brushed
|
||||
|
||||
private GraphicsPath bpath;
|
||||
private GraphicsPath gpath;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Base draw functions
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
buttonColor = this.BackColor;
|
||||
edgeColor1 = ControlPaint.Light(buttonColor);
|
||||
edgeColor2 = ControlPaint.Dark(buttonColor);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
Rectangle buttonRect = this.ClientRectangle;
|
||||
edgeWidth = GetEdgeWidth(buttonRect);
|
||||
|
||||
FillBackground(g, buttonRect);
|
||||
|
||||
ShrinkShape(ref g, ref buttonRect, edgeWidth);
|
||||
|
||||
DrawButton(g, buttonRect);
|
||||
|
||||
SetClickableRegion();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill in the control background
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics object</param>
|
||||
/// <param name="rect">Rectangle defining the button background</param>
|
||||
protected void FillBackground(Graphics g, Rectangle rect)
|
||||
{
|
||||
// Fill in the control with the background colour, to overwrite anything
|
||||
// that may have been drawn already.
|
||||
Rectangle bgRect = rect;
|
||||
bgRect.Inflate(1,1);
|
||||
SolidBrush bgBrush = new SolidBrush(Color.FromKnownColor(KnownColor.Control));
|
||||
bgBrush.Color = Parent.BackColor;
|
||||
g.FillRectangle(bgBrush, bgRect);
|
||||
bgBrush.Dispose();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill in the main button colour
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="buttonRect">Rectangle defining the button top</param>
|
||||
protected virtual void DrawButton(Graphics g, Rectangle buttonRect)
|
||||
{
|
||||
BuildGraphicsPath(buttonRect);
|
||||
|
||||
PathGradientBrush pgb = new PathGradientBrush(bpath);
|
||||
pgb.SurroundColors = new Color[] {buttonColor};
|
||||
|
||||
buttonRect.Offset(buttonPressOffset, buttonPressOffset);
|
||||
|
||||
pgb.CenterColor = buttonColor;
|
||||
|
||||
FillShape(g, pgb, buttonRect);
|
||||
|
||||
// If we have focus, draw line around control to indicate this.
|
||||
if (CheckedFocus)
|
||||
{
|
||||
DrawFocus(g, buttonRect);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Base draw functions
|
||||
|
||||
#region Overrideable shape-specific methods
|
||||
|
||||
protected virtual void BuildGraphicsPath(Rectangle buttonRect)
|
||||
{
|
||||
bpath = new GraphicsPath();
|
||||
// Adding this second smaller rectangle to the graphics path smooths the edges - don't know why...?
|
||||
Rectangle rect2 = new Rectangle(buttonRect.X - 1, buttonRect.Y - 1, buttonRect.Width + 2, buttonRect.Height + 2);
|
||||
AddShape(bpath, rect2);
|
||||
AddShape(bpath, buttonRect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create region the same shape as the button. This will respond to the mouse click
|
||||
/// </summary>
|
||||
protected virtual void SetClickableRegion()
|
||||
{
|
||||
gpath = new GraphicsPath();
|
||||
gpath.AddEllipse(this.ClientRectangle);
|
||||
this.Region = new Region(gpath); // Click only activates on elipse
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to fill the specified rectangle with either LinearGradient or PathGradient
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="brush">Either a PathGradient- or LinearGradientBrush</param>
|
||||
/// <param name="rect">The rectangle bounding the ellipse to be filled</param>
|
||||
protected virtual void FillShape(Graphics g, Object brush, Rectangle rect)
|
||||
{
|
||||
if (brush.GetType().ToString() == "System.Drawing.Drawing2D.LinearGradientBrush")
|
||||
{
|
||||
g.FillEllipse((LinearGradientBrush)brush, rect);
|
||||
}
|
||||
else if (brush.GetType().ToString() == "System.Drawing.Drawing2D.PathGradientBrush")
|
||||
{
|
||||
g.FillEllipse((PathGradientBrush)brush, rect);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an ellipse to the Graphics Path
|
||||
/// </summary>
|
||||
/// <param name="gpath">The Graphics Path</param>
|
||||
/// <param name="rect">The rectangle defining the ellipse to be added</param>
|
||||
protected virtual void AddShape(GraphicsPath gpath, Rectangle rect)
|
||||
{
|
||||
gpath.AddEllipse(rect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the specified shape
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="pen">Pen</param>
|
||||
/// <param name="rect">The rectangle bounding the ellipse to be drawn</param>
|
||||
protected virtual void DrawShape(Graphics g, Pen pen, Rectangle rect)
|
||||
{
|
||||
g.DrawEllipse(pen, rect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shrink the shape
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="rect">The rectangle defining the shape to be shrunk</param>
|
||||
/// <param name="amount">The amount to shrink it by</param>
|
||||
protected virtual void ShrinkShape(ref Graphics g, ref Rectangle rect, int amount)
|
||||
{
|
||||
rect.Inflate(-amount, -amount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicate that this button has focus
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="rect">The rectangle defining the button face</param>
|
||||
protected virtual void DrawFocus(Graphics g, Rectangle rect)
|
||||
{
|
||||
rect.Inflate(-3, -3);
|
||||
Pen fPen = new Pen(Color.FromArgb(150, 255, 255, 255));
|
||||
fPen.DashStyle = DashStyle.Solid;
|
||||
fPen.Width = 2;
|
||||
DrawShape(g, fPen, rect);
|
||||
rect.Inflate(2, 2);
|
||||
fPen = new Pen(Color.FromArgb(150, 0, 0, 0));
|
||||
fPen.DashStyle = DashStyle.Solid;
|
||||
fPen.Width = 3;
|
||||
DrawShape(g, fPen, rect);
|
||||
}
|
||||
|
||||
#endregion Overrideable shape-specific methods
|
||||
|
||||
#region Help functions
|
||||
|
||||
/// <summary>
|
||||
/// Calculate button edge width depending on button size
|
||||
/// </summary>
|
||||
/// <param name="rect">Rectangle defining the button</param>
|
||||
/// <returns>The width of the edge</returns>
|
||||
protected int GetEdgeWidth(Rectangle rect)
|
||||
{
|
||||
if (rect.Width < 50 | rect.Height < 50) return 1;
|
||||
else return 2;
|
||||
}
|
||||
|
||||
#endregion Private Help functions
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
protected void mouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
buttonDown();
|
||||
}
|
||||
|
||||
protected void mouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
buttonUp();
|
||||
}
|
||||
|
||||
protected void buttonDown()
|
||||
{
|
||||
buttonPressOffset = 1;
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
protected void buttonUp()
|
||||
{
|
||||
buttonPressOffset = 0;
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
protected void keyDown(object sender, System.Windows.Forms.KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode.ToString() == "Space")
|
||||
{
|
||||
buttonDown();
|
||||
}
|
||||
}
|
||||
|
||||
protected void keyUp(object sender, System.Windows.Forms.KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode.ToString() == "Space")
|
||||
{
|
||||
buttonUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion Event Handlers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,329 +0,0 @@
|
||||
// Original code from
|
||||
// Color Picker with Color Wheel and Eye Dropper
|
||||
// by jkristia
|
||||
//
|
||||
// Modified by:
|
||||
// CTCaer | Feb 2018.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace jcColor {
|
||||
static class Util
|
||||
{
|
||||
public static Rectangle Rect(RectangleF rf)
|
||||
{
|
||||
Rectangle r = new Rectangle();
|
||||
r.X = (int)rf.X;
|
||||
r.Y = (int)rf.Y;
|
||||
r.Width = (int)rf.Width;
|
||||
r.Height = (int)rf.Height;
|
||||
return r;
|
||||
}
|
||||
public static RectangleF Rect(Rectangle r)
|
||||
{
|
||||
RectangleF rf = new RectangleF();
|
||||
rf.X = (float)r.X;
|
||||
rf.Y = (float)r.Y;
|
||||
rf.Width = (float)r.Width;
|
||||
rf.Height = (float)r.Height;
|
||||
return rf;
|
||||
}
|
||||
public static Point Point(PointF pf)
|
||||
{
|
||||
return new Point((int)pf.X, (int)pf.Y);
|
||||
}
|
||||
public static PointF Center(RectangleF r)
|
||||
{
|
||||
PointF center = r.Location;
|
||||
center.X += r.Width / 2;
|
||||
center.Y += r.Height / 2;
|
||||
return center;
|
||||
}
|
||||
|
||||
public static void DrawFrame(Graphics dc, RectangleF r, float cornerRadius, Color color)
|
||||
{
|
||||
Pen pen = new Pen(color);
|
||||
if (cornerRadius <= 0)
|
||||
{
|
||||
dc.DrawRectangle(pen, Rect(r));
|
||||
return;
|
||||
}
|
||||
cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Width) - 2);
|
||||
cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Height) - 2);
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddArc(r.X,r.Y, cornerRadius, cornerRadius, 180, 90);
|
||||
path.AddArc(r.Right-cornerRadius,r.Y, cornerRadius, cornerRadius, 270, 90);
|
||||
path.AddArc(r.Right-cornerRadius,r.Bottom-cornerRadius, cornerRadius, cornerRadius, 0, 90);
|
||||
path.AddArc(r.X,r.Bottom-cornerRadius, cornerRadius, cornerRadius, 90, 90);
|
||||
path.CloseAllFigures();
|
||||
dc.DrawPath(pen, path);
|
||||
}
|
||||
public static void Draw2ColorBar(Graphics dc, RectangleF r, Orientation orientation, Color c1, Color c2)
|
||||
{
|
||||
RectangleF lr1 = r;
|
||||
float angle = 0;
|
||||
|
||||
if (orientation == Orientation.Vertical)
|
||||
angle = 270;
|
||||
if (orientation == Orientation.Horizontal)
|
||||
angle = 0;
|
||||
|
||||
if (lr1.Height > 0 && lr1.Width > 0)
|
||||
{
|
||||
LinearGradientBrush lb1 = new LinearGradientBrush(lr1, c1, c2, angle, false);
|
||||
dc.FillRectangle(lb1, lr1);
|
||||
lb1.Dispose();
|
||||
}
|
||||
}
|
||||
public static void Draw3ColorBar(Graphics dc, RectangleF r, Orientation orientation, Color c1, Color c2, Color c3)
|
||||
{
|
||||
// to draw a 3 color bar 2 gradient brushes are needed
|
||||
// one from c1 - c2 and c2 - c3
|
||||
RectangleF lr1 = r;
|
||||
RectangleF lr2 = r;
|
||||
float angle = 0;
|
||||
|
||||
if (orientation == Orientation.Vertical)
|
||||
{
|
||||
angle = 270;
|
||||
|
||||
lr1.Height = lr1.Height / 2;
|
||||
lr2.Height = r.Height - lr1.Height;
|
||||
lr2.Y += lr1.Height;
|
||||
}
|
||||
if (orientation == Orientation.Horizontal)
|
||||
{
|
||||
angle = 0;
|
||||
|
||||
lr1.Width = lr1.Width / 2;
|
||||
lr2.Width = r.Width - lr1.Width;
|
||||
lr1.X = lr2.Right;
|
||||
}
|
||||
|
||||
if (lr1.Height > 0 && lr1.Width > 0)
|
||||
{
|
||||
LinearGradientBrush lb2 = new LinearGradientBrush(lr2, c1, c2, angle, false);
|
||||
LinearGradientBrush lb1 = new LinearGradientBrush(lr1, c2, c3, angle, false);
|
||||
|
||||
dc.FillRectangle(lb1, lr1);
|
||||
dc.FillRectangle(lb2, lr2);
|
||||
|
||||
lb1.Dispose();
|
||||
lb2.Dispose();
|
||||
}
|
||||
// with some sizes the first pixel in the gradient rectangle shows the opposite color
|
||||
// this is a workaround for that problem
|
||||
if (orientation == Orientation.Vertical)
|
||||
{
|
||||
Pen pc2 = new Pen(c2, 1);
|
||||
Pen pc3 = new Pen(c3, 1);
|
||||
dc.DrawLine(pc3, lr1.Left, lr1.Top, lr1.Right - 1, lr1.Top);
|
||||
dc.DrawLine(pc2, lr2.Left, lr2.Top, lr2.Right - 1, lr2.Top);
|
||||
pc2.Dispose();
|
||||
pc3.Dispose();
|
||||
}
|
||||
|
||||
if (orientation == Orientation.Horizontal)
|
||||
{
|
||||
Pen pc1 = new Pen(c1, 1);
|
||||
Pen pc2 = new Pen(c2, 1);
|
||||
Pen pc3 = new Pen(c3, 1);
|
||||
dc.DrawLine(pc1, lr2.Left, lr2.Top, lr2.Left, lr2.Bottom-1);
|
||||
dc.DrawLine(pc2, lr2.Right, lr2.Top, lr2.Right, lr2.Bottom-1);
|
||||
dc.DrawLine(pc3, lr1.Right, lr1.Top, lr1.Right, lr1.Bottom-1);
|
||||
pc1.Dispose();
|
||||
pc2.Dispose();
|
||||
pc3.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Control> controlsSorted(this Control panel) {
|
||||
var controls = panel.Controls.OfType<Control>().ToList();
|
||||
controls.Sort((c1, c2) => c1.TabIndex.CompareTo(c2.TabIndex));
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
|
||||
class WinUtil
|
||||
{
|
||||
public const int WM_KEYDOWN = 0x0100;
|
||||
public const int WM_KEYUP = 0x0101;
|
||||
public const int WM_CHAR = 0x0102;
|
||||
|
||||
public const int SWP_NOSIZE = 0x0001;
|
||||
public const int SWP_NOMOVE = 0x0002;
|
||||
public const int SWP_NOZORDER = 0x0004;
|
||||
public const int SWP_NOREDRAW = 0x0008;
|
||||
public const int SWP_NOACTIVATE = 0x0010;
|
||||
public const int SWP_FRAMECHANGED = 0x0020; /* The frame changed: send WM_NCCALCSIZE */
|
||||
public const int SWP_SHOWWINDOW = 0x0040;
|
||||
public const int SWP_HIDEWINDOW = 0x0080;
|
||||
public const int SWP_NOCOPYBITS = 0x0100;
|
||||
public const int SWP_NOOWNERZORDER = 0x0200; /* Don't do owner Z ordering */
|
||||
public const int SWP_NOSENDCHANGING = 0x0400; /* Don't send WM_WINDOWPOSCHANGING */
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags);
|
||||
|
||||
public const uint WS_OVERLAPPED = WS_BORDER | WS_CAPTION;
|
||||
public const uint WS_CLIPSIBLINGS = 0x04000000;
|
||||
public const uint WS_CLIPCHILDREN = 0x02000000;
|
||||
public const uint WS_CAPTION = 0x00C00000; /* WS_BORDER | WS_DLGFRAME */
|
||||
public const uint WS_BORDER = 0x00800000;
|
||||
public const uint WS_DLGFRAME = 0x00400000;
|
||||
public const uint WS_VSCROLL = 0x00200000;
|
||||
public const uint WS_HSCROLL = 0x00100000;
|
||||
public const uint WS_SYSMENU = 0x00080000;
|
||||
public const uint WS_THICKFRAME = 0x00040000;
|
||||
public const uint WS_MAXIMIZEBOX = 0x00020000;
|
||||
public const uint WS_MINIMIZEBOX = 0x00010000;
|
||||
public const uint WS_SIZEBOX = WS_THICKFRAME;
|
||||
public const uint WS_POPUP = 0x80000000;
|
||||
public const uint WS_CHILD = 0x40000000;
|
||||
public const uint WS_VISIBLE = 0x10000000;
|
||||
public const uint WS_DISABLED = 0x08000000;
|
||||
|
||||
public const uint WS_EX_DLGMODALFRAME= 0x00000001;
|
||||
public const uint WS_EX_TOPMOST = 0x00000008;
|
||||
public const uint WS_EX_TOOLWINDOW = 0x00000080;
|
||||
public const uint WS_EX_WINDOWEDGE = 0x00000100;
|
||||
public const uint WS_EX_CLIENTEDGE = 0x00000200;
|
||||
|
||||
public const uint WS_EX_CONTEXTHELP = 0x00000400;
|
||||
public const uint WS_EX_STATICEDGE = 0x00020000;
|
||||
public const uint WS_EX_OVERLAPPEDWINDOW =(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
|
||||
|
||||
public const int GWL_STYLE = (-16);
|
||||
public const int GWL_EXSTYLE = (-20);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint="GetWindowLong", CharSet=CharSet.Auto)]
|
||||
public static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint="SetWindowLong", CharSet=CharSet.Auto)]
|
||||
public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
|
||||
public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
public const int WH_KEYBOARD = 2;
|
||||
public const int WH_MOUSE = 7;
|
||||
public const int WH_KEYBOARD_LL = 13;
|
||||
public const int WH_MOUSE_LL = 14;
|
||||
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
|
||||
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern bool UnhookWindowsHookEx(int idHook);
|
||||
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
//Declare the wrapper managed POINT class.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class POINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
|
||||
//Declare the wrapper managed MouseHookStruct class.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class MouseHookStruct
|
||||
{
|
||||
public POINT pt;
|
||||
public int hwnd;
|
||||
public int wHitTestCode;
|
||||
public int dwExtraInfo;
|
||||
}
|
||||
|
||||
//Declare the wrapper managed KeyboardHookStruct class.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class KeyboardHookStruct
|
||||
{
|
||||
public int vkCode;
|
||||
public int scanCode;
|
||||
public int flags;
|
||||
public int time;
|
||||
public int dwExtraInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// http://support.microsoft.com/kb/318804
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp
|
||||
/// http://www.codeproject.com/KB/cs/globalhook.aspx
|
||||
public class Hook
|
||||
{
|
||||
public delegate void KeyboardDelegate(KeyEventArgs e);
|
||||
public KeyboardDelegate OnKeyDown;
|
||||
int m_hHook = 0;
|
||||
WinUtil.HookProc m_HookCallback;
|
||||
|
||||
public void SetHook(bool enable)
|
||||
{
|
||||
if (enable && m_hHook == 0)
|
||||
{
|
||||
m_HookCallback = new WinUtil.HookProc(HookCallbackProc);
|
||||
Module module = Assembly.GetExecutingAssembly().GetModules()[0];
|
||||
m_hHook = WinUtil.SetWindowsHookEx(WinUtil.WH_KEYBOARD_LL, m_HookCallback, Marshal.GetHINSTANCE(module),0);
|
||||
if (m_hHook == 0)
|
||||
{
|
||||
MessageBox.Show("SetHook Failed. Please make sure the 'Visual Studio Host Process' on the debug setting page is disabled");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable == false && m_hHook != 0)
|
||||
{
|
||||
WinUtil.UnhookWindowsHookEx(m_hHook);
|
||||
m_hHook = 0;
|
||||
}
|
||||
}
|
||||
int HookCallbackProc(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
if (nCode < 0)
|
||||
{
|
||||
return WinUtil.CallNextHookEx(m_hHook, nCode, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Marshall the data from the callback.
|
||||
WinUtil.KeyboardHookStruct hookstruct = (WinUtil.KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(WinUtil.KeyboardHookStruct));
|
||||
|
||||
if (OnKeyDown != null && wParam.ToInt32() == WinUtil.WM_KEYDOWN)
|
||||
{
|
||||
Keys key = (Keys)hookstruct.vkCode;
|
||||
if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
|
||||
key |= Keys.Shift;
|
||||
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
|
||||
key |= Keys.Control;
|
||||
|
||||
KeyEventArgs e = new KeyEventArgs(key);
|
||||
e.Handled = false;
|
||||
OnKeyDown(e);
|
||||
if (e.Handled)
|
||||
return 1;
|
||||
}
|
||||
int result = 0;
|
||||
if (m_hHook != 0)
|
||||
result = WinUtil.CallNextHookEx(m_hHook, nCode, wParam, lParam);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>
|
||||
@@ -1,883 +0,0 @@
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** Project: Joy-Con Color Picker *****/
|
||||
/***** Filename: ctrl2DColorBox.cs *****/
|
||||
/***** Original Project: Adobe Color Picker Clone 1 *****/
|
||||
/***** Original Author: Danny Blanchard *****/
|
||||
/***** - scrabcakes@gmail.com *****/
|
||||
/***** Updates: *****/
|
||||
/***** 3/28/2005 - Initial Version : Danny Blanchard *****/
|
||||
/***** Feb 2018 - JoyCon Version : CTCaer *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** This version is heavily optimised for use in *****/
|
||||
/***** CTCaer's Joy-Con Toolkit and other projects. *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor {
|
||||
/// <summary>
|
||||
/// Summary description for ctrl2DColorBox.
|
||||
/// </summary>
|
||||
public class ctrl2DColorBox : System.Windows.Forms.UserControl
|
||||
{
|
||||
#region Class Variables
|
||||
|
||||
public enum eDrawStyle
|
||||
{
|
||||
Hue,
|
||||
Saturation,
|
||||
Brightness,
|
||||
Red,
|
||||
Green,
|
||||
Blue
|
||||
}
|
||||
|
||||
private int m_iMarker_X = 0;
|
||||
private int m_iMarker_Y = 0;
|
||||
private bool m_bDragging = false;
|
||||
|
||||
// These variables keep track of how to fill in the content inside the box;
|
||||
private eDrawStyle m_eDrawStyle = eDrawStyle.Hue;
|
||||
private AdobeColors.HSL m_hsl;
|
||||
private Color m_rgb;
|
||||
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors / Destructors
|
||||
|
||||
public ctrl2DColorBox()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
// Initialize Colors
|
||||
m_hsl = new AdobeColors.HSL();
|
||||
m_hsl.H = 1.0;
|
||||
m_hsl.S = 1.0;
|
||||
m_hsl.L = 1.0;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
m_eDrawStyle = eDrawStyle.Hue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ctrl2DColorBox
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
|
||||
this.ForeColor = System.Drawing.Color.DeepSkyBlue;
|
||||
this.Name = "ctrl2DColorBox";
|
||||
this.Size = new System.Drawing.Size(260, 260);
|
||||
this.Load += new System.EventHandler(this.ctrl2DColorBox_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ctrl2DColorBox_Paint);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ctrl2DColorBox_MouseDown);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrl2DColorBox_MouseMove);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ctrl2DColorBox_MouseUp);
|
||||
this.Resize += new System.EventHandler(this.ctrl2DColorBox_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Control Events
|
||||
|
||||
private void ctrl2DColorBox_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
m_bDragging = true; // Begin dragging which notifies MouseMove function that it needs to update the marker
|
||||
|
||||
int x = e.X - 2, y = e.Y - 2;
|
||||
if ( x < 0 ) x = 0;
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // Calculate marker position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4;
|
||||
|
||||
if ( x == m_iMarker_X && y == m_iMarker_Y ) // If the marker hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawMarker(x, y, true); // Redraw the marker
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls marker (selected color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( !m_bDragging ) // Only respond when the mouse is dragging the marker.
|
||||
return;
|
||||
|
||||
int x = e.X - 2, y = e.Y - 2;
|
||||
if ( x < 0 ) x = 0;
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // Calculate marker position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4;
|
||||
|
||||
if ( x == m_iMarker_X && y == m_iMarker_Y ) // If the marker hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawMarker(x, y, true); // Redraw the marker
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls marker (selected color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
if ( !m_bDragging )
|
||||
return;
|
||||
|
||||
m_bDragging = false;
|
||||
|
||||
int x = e.X - 2, y = e.Y - 2;
|
||||
if ( x < 0 ) x = 0;
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // Calculate marker position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4;
|
||||
|
||||
if ( x == m_iMarker_X && y == m_iMarker_Y ) // If the marker hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawMarker(x, y, true); // Redraw the marker
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls marker (selected color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public new event EventHandler Scroll;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// The drawstyle of the contol (Hue, Saturation, Brightness, Red, Green or Blue)
|
||||
/// </summary>
|
||||
public eDrawStyle DrawStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_eDrawStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_eDrawStyle = value;
|
||||
|
||||
// Redraw the control based on the new eDrawStyle
|
||||
Reset_Marker(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The HSL color of the control, changing the HSL will automatically change the RGB color for the control.
|
||||
/// </summary>
|
||||
public AdobeColors.HSL HSL
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_hsl;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_hsl = value;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Marker(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The RGB color of the control, changing the RGB will automatically change the HSL color for the control.
|
||||
/// </summary>
|
||||
public Color RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rgb;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rgb = value;
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Marker(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Redraws only the content over the marker
|
||||
/// </summary>
|
||||
private void ClearMarker()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
// Determine the area that needs to be redrawn
|
||||
int start_x, start_y, end_x, end_y;
|
||||
int red = 0; int green = 0; int blue = 0;
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
|
||||
// Find the markers corners
|
||||
start_x = m_iMarker_X - 5;
|
||||
start_y = m_iMarker_Y - 5;
|
||||
end_x = m_iMarker_X + 5;
|
||||
end_y = m_iMarker_Y + 5;
|
||||
// Adjust the area if part of it hangs outside the content area
|
||||
if ( start_x < 0 ) start_x = 0;
|
||||
if ( start_y < 0 ) start_y = 0;
|
||||
if ( end_x > this.Width - 4 ) end_x = this.Width - 4;
|
||||
if ( end_y > this.Height - 4 ) end_y = this.Height - 4;
|
||||
|
||||
// Redraw the content based on the current draw style:
|
||||
// The code get's a little messy from here
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
// S=0,S=1,S=2,S=3.....S=100
|
||||
// L=100
|
||||
// L=99
|
||||
// L=98 Drawstyle
|
||||
// L=97 Hue
|
||||
// ...
|
||||
// L=0
|
||||
case eDrawStyle.Hue :
|
||||
|
||||
hsl_start.H = m_hsl.H; hsl_end.H = m_hsl.H; // Hue is constant
|
||||
hsl_start.S = (double)start_x/(this.Width - 4); // Because we're drawing horizontal lines, s will not change
|
||||
hsl_end.S = (double)end_x/(this.Width - 4); // from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
hsl_start.L = 1.0 - (double)i/(this.Height - 4); // Brightness (L) WILL change for each horizontal
|
||||
hsl_end.L = hsl_start.L; // line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// H=0,H=1,H=2,H=3.....H=360
|
||||
// L=100
|
||||
// L=99
|
||||
// L=98 Drawstyle
|
||||
// L=97 Saturation
|
||||
// ...
|
||||
// L=0
|
||||
case eDrawStyle.Saturation :
|
||||
|
||||
hsl_start.S = m_hsl.S; hsl_end.S = m_hsl.S; // Saturation is constant
|
||||
hsl_start.L = 1.0 - (double)start_y/(this.Height - 4); // Because we're drawing vertical lines, L will
|
||||
hsl_end.L = 1.0 - (double)end_y/(this.Height - 4); // not change from line to line
|
||||
|
||||
for ( int i = start_x; i <= end_x; i++ ) // For each vertical line:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Hue (H) WILL change for each vertical
|
||||
hsl_end.H = hsl_start.H; // line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(i + 2,start_y + 1, 1, end_y - start_y + 2), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, start_y + 2, 1, end_y - start_y + 1));
|
||||
br.Dispose();
|
||||
}
|
||||
break;
|
||||
// H=0,H=1,H=2,H=3.....H=360
|
||||
// S=100
|
||||
// S=99
|
||||
// S=98 Drawstyle
|
||||
// S=97 Brightness
|
||||
// ...
|
||||
// S=0
|
||||
case eDrawStyle.Brightness :
|
||||
|
||||
hsl_start.L = m_hsl.L; hsl_end.L = m_hsl.L; // Luminance is constant
|
||||
hsl_start.S = 1.0 - (double)start_y/(this.Height - 4); // Because we're drawing vertical lines, S will
|
||||
hsl_end.S = 1.0 - (double)end_y/(this.Height - 4); // not change from line to line
|
||||
|
||||
for ( int i = start_x; i <= end_x; i++ ) // For each vertical line:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Hue (H) WILL change for each vertical
|
||||
hsl_end.H = hsl_start.H; // line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(i + 2,start_y + 1, 1, end_y - start_y + 2), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, start_y + 2, 1, end_y - start_y + 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// B=0,B=1,B=2,B=3.....B=100
|
||||
// G=100
|
||||
// G=99
|
||||
// G=98 Drawstyle
|
||||
// G=97 Red
|
||||
// ...
|
||||
// G=0
|
||||
case eDrawStyle.Red :
|
||||
|
||||
red = m_rgb.R; // Red is constant
|
||||
int start_b = Round(255 * (double)start_x/(this.Width - 4)); // Because we're drawing horizontal lines, B
|
||||
int end_b = Round(255 * (double)end_x/(this.Width - 4)); // will not change from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
green = Round(255 - (255 * (double)i/(this.Height - 4))); // green WILL change for each horizontal line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), Color.FromArgb(red, green, start_b), Color.FromArgb(red, green, end_b), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// B=0,B=1,B=2,B=3.....B=100
|
||||
// R=100
|
||||
// R=99
|
||||
// R=98 Drawstyle
|
||||
// R=97 Green
|
||||
// ...
|
||||
// R=0
|
||||
case eDrawStyle.Green :
|
||||
|
||||
green = m_rgb.G;; // Green is constant
|
||||
int start_b2 = Round(255 * (double)start_x/(this.Width - 4)); // Because we're drawing horizontal lines, B
|
||||
int end_b2 = Round(255 * (double)end_x/(this.Width - 4)); // will not change from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
red = Round(255 - (255 * (double)i/(this.Height - 4))); // red WILL change for each horizontal line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), Color.FromArgb(red, green, start_b2), Color.FromArgb(red, green, end_b2), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// R=0,R=1,R=2,R=3.....R=100
|
||||
// G=100
|
||||
// G=99
|
||||
// G=98 Drawstyle
|
||||
// G=97 Blue
|
||||
// ...
|
||||
// G=0
|
||||
case eDrawStyle.Blue :
|
||||
|
||||
blue = m_rgb.B;; // Blue is constant
|
||||
int start_r = Round(255 * (double)start_x/(this.Width - 4)); // Because we're drawing horizontal lines, R
|
||||
int end_r = Round(255 * (double)end_x/(this.Width - 4)); // will not change from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
green = Round(255 - (255 * (double)i/(this.Height - 4))); // green WILL change for each horizontal line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), Color.FromArgb(start_r, green, blue), Color.FromArgb(end_r, green, blue), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the marker (circle) inside the box
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="Unconditional"></param>
|
||||
private void DrawMarker(int x, int y, bool Unconditional) // *****
|
||||
{ // * | *
|
||||
if ( x < 0 ) x = 0; // * | *
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // * | *
|
||||
if ( y < 0 ) y = 0; // * | *
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4; // *----X----*
|
||||
// * | *
|
||||
if ( m_iMarker_Y == y && m_iMarker_X == x && !Unconditional ) // * | *
|
||||
return; // * | *
|
||||
// * | *
|
||||
ClearMarker(); // *****
|
||||
|
||||
m_iMarker_X = x;
|
||||
m_iMarker_Y = y;
|
||||
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pen;
|
||||
AdobeColors.HSL _hsl = GetColor(x,y); // The selected color determines the color of the marker drawn over
|
||||
// it (black or white)
|
||||
if ( _hsl.L < (double)200/255 )
|
||||
pen = new Pen(Color.White); // White marker if selected color is dark
|
||||
else if ( _hsl.H < (double)26/360 || _hsl.H > (double)200/360 )
|
||||
if ( _hsl.S > (double)70/255 )
|
||||
pen = new Pen(Color.White);
|
||||
else
|
||||
pen = new Pen(Color.Black); // Else use a black marker for lighter colors
|
||||
else
|
||||
pen = new Pen(Color.Black);
|
||||
|
||||
g.DrawEllipse(pen, x - 3, y - 3, 10, 10); // Draw the marker : 11 x 11 circle
|
||||
|
||||
DrawBorder(); // Force the border to be redrawn, just in case the marker has been drawn over it.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the border around the control.
|
||||
/// </summary>
|
||||
private void DrawBorder()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pencil;
|
||||
|
||||
// To make the control look like Adobe Photoshop's the border around the control will be a gray line
|
||||
// on the top and left side, a white line on the bottom and right side, and a black rectangle (line)
|
||||
// inside the gray/white rectangle
|
||||
|
||||
pencil = new Pen(Color.FromArgb(100, 100, 100)); // The same gray color used by Photoshop
|
||||
g.DrawLine(pencil, this.Width - 2, 0, 0, 0); // Draw top line
|
||||
g.DrawLine(pencil, 0, 0, 0, this.Height - 2); // Draw left hand line
|
||||
|
||||
//pencil = new Pen(Color.White);
|
||||
g.DrawLine(pencil, this.Width - 1, 0, this.Width - 1,this.Height - 1); // Draw right hand line
|
||||
g.DrawLine(pencil, this.Width - 1,this.Height - 1, 0,this.Height - 1); // Draw bottome line
|
||||
|
||||
pencil = new Pen(Color.FromArgb(85, 85, 85));
|
||||
g.DrawRectangle(pencil, 1, 1, this.Width - 3, this.Height - 3); // Draw inner black rectangle
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the DrawStyle of the control and calls the appropriate
|
||||
/// drawing function for content
|
||||
/// </summary>
|
||||
private void DrawContent()
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Hue value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Hue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
hsl_start.H = m_hsl.H;
|
||||
hsl_end.H = m_hsl.H;
|
||||
hsl_start.S = 0.0;
|
||||
hsl_end.S = 1.0;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
hsl_start.L = 1.0 - (double)i/(this.Height - 4); // Calculate luminance at this line (Hue and Saturation are constant)
|
||||
hsl_end.L = hsl_start.L;
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Saturation value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Saturation()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
hsl_start.S = m_hsl.S;
|
||||
hsl_end.S = m_hsl.S;
|
||||
hsl_start.L = 1.0;
|
||||
hsl_end.L = 0.0;
|
||||
|
||||
for ( int i = 0; i < this.Width - 4; i++ ) // For each vertical line in the control:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Calculate Hue at this line (Saturation and Luminance are constant)
|
||||
hsl_end.H = hsl_start.H;
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, 1, this.Height - 4), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, 2, 1, this.Height - 4));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Luminance or Brightness value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Luminance()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
hsl_start.L = m_hsl.L;
|
||||
hsl_end.L = m_hsl.L;
|
||||
hsl_start.S = 1.0;
|
||||
hsl_end.S = 0.0;
|
||||
|
||||
for ( int i = 0; i < this.Width - 4; i++ ) // For each vertical line in the control:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Calculate Hue at this line (Saturation and Luminance are constant)
|
||||
hsl_end.H = hsl_start.H;
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, 1, this.Height - 4), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, 2, 1, this.Height - 4));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Red value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Red()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
int red = m_rgb.R;;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
// Calculate Green at this line (Red and Blue are constant)
|
||||
int green = Round(255 - (255 * (double)i/(this.Height - 4)));
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), Color.FromArgb(red, green, 0), Color.FromArgb(red, green, 255), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Green value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Green()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
int green = m_rgb.G;;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
// Calculate Red at this line (Green and Blue are constant)
|
||||
int red = Round(255 - (255 * (double)i/(this.Height - 4)));
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), Color.FromArgb(red, green, 0), Color.FromArgb(red, green, 255), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Blue value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Blue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
int blue = m_rgb.B;;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
// Calculate Green at this line (Red and Blue are constant)
|
||||
int green = Round(255 - (255 * (double)i/(this.Height - 4)));
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), Color.FromArgb(0, green, blue), Color.FromArgb(255, green, blue), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calls all the functions neccessary to redraw the entire control.
|
||||
/// </summary>
|
||||
private void Redraw_Control()
|
||||
{
|
||||
DrawBorder();
|
||||
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
|
||||
DrawMarker(m_iMarker_X, m_iMarker_Y, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the marker position of the slider to match the controls color. Gives the option of redrawing the slider.
|
||||
/// </summary>
|
||||
/// <param name="Redraw">Set to true if you want the function to redraw the slider after determining the best position</param>
|
||||
private void Reset_Marker(bool Redraw)
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_iMarker_X = Round((this.Width - 4) * m_hsl.S);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - m_hsl.L));
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_iMarker_X = Round((this.Width - 4) * m_hsl.H);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - m_hsl.L));
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_iMarker_X = Round((this.Width - 4) * m_hsl.H);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - m_hsl.S));
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
m_iMarker_X = Round((this.Width - 4) * (double)m_rgb.B/255);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - (double)m_rgb.G/255));
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
m_iMarker_X = Round((this.Width - 4) * (double)m_rgb.B/255);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - (double)m_rgb.R/255));
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
m_iMarker_X = Round((this.Width - 4) * (double)m_rgb.R/255);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - (double)m_rgb.G/255));
|
||||
break;
|
||||
}
|
||||
|
||||
if ( Redraw )
|
||||
DrawMarker(m_iMarker_X, m_iMarker_Y, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the controls color (both HSL and RGB variables) based on the current marker position
|
||||
/// </summary>
|
||||
private void ResetHSLRGB()
|
||||
{
|
||||
int red, green, blue;
|
||||
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_hsl.S = (double)m_iMarker_X/(this.Width - 4);
|
||||
m_hsl.L = 1.0 - (double)m_iMarker_Y/(this.Height - 4);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_hsl.H = (double)m_iMarker_X/(this.Width - 4);
|
||||
m_hsl.L = 1.0 - (double)m_iMarker_Y/(this.Height - 4);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_hsl.H = (double)m_iMarker_X/(this.Width - 4);
|
||||
m_hsl.S = 1.0 - (double)m_iMarker_Y/(this.Height - 4);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
blue = Round(255 * (double)m_iMarker_X/(this.Width - 4));
|
||||
green = Round(255 * (1.0 - (double)m_iMarker_Y/(this.Height - 4)));
|
||||
m_rgb = Color.FromArgb(m_rgb.R, green, blue);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
blue = Round(255 * (double)m_iMarker_X/(this.Width - 4));
|
||||
red = Round(255 * (1.0 - (double)m_iMarker_Y/(this.Height - 4)));
|
||||
m_rgb = Color.FromArgb(red, m_rgb.G, blue);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
red = Round(255 * (double)m_iMarker_X/(this.Width - 4));
|
||||
green = Round(255 * (1.0 - (double)m_iMarker_Y/(this.Height - 4)));
|
||||
m_rgb = Color.FromArgb(red, green, m_rgb.B);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Kindof self explanitory, I really need to look up the .NET function that does this.
|
||||
/// </summary>
|
||||
/// <param name="val">double value to be rounded to an integer</param>
|
||||
/// <returns></returns>
|
||||
private int Round(double val)
|
||||
{
|
||||
int ret_val = (int)val;
|
||||
|
||||
int temp = (int)(val * 100);
|
||||
|
||||
if ( (temp % 100) >= 50 )
|
||||
ret_val += 1;
|
||||
|
||||
return ret_val;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the graphed color at the x,y position on the control
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private AdobeColors.HSL GetColor(int x, int y)
|
||||
{
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
_hsl.H = m_hsl.H;
|
||||
_hsl.S = (double)x/(this.Width - 4);
|
||||
_hsl.L = 1.0 - (double)y/(this.Height - 4);
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
_hsl.S = m_hsl.S;
|
||||
_hsl.H = (double)x/(this.Width - 4);
|
||||
_hsl.L = 1.0 - (double)y/(this.Height - 4);
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
_hsl.L = m_hsl.L;
|
||||
_hsl.H = (double)x/(this.Width - 4);
|
||||
_hsl.S = 1.0 - (double)y/(this.Height - 4);
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
_hsl = AdobeColors.RGB_to_HSL(Color.FromArgb(m_rgb.R, Round(255 * (1.0 - (double)y/(this.Height - 4))), Round(255 * (double)x/(this.Width - 4))));
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
_hsl = AdobeColors.RGB_to_HSL(Color.FromArgb(Round(255 * (1.0 - (double)y/(this.Height - 4))), m_rgb.G, Round(255 * (double)x/(this.Width - 4))));
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
_hsl = AdobeColors.RGB_to_HSL(Color.FromArgb(Round(255 * (double)x/(this.Width - 4)), Round(255 * (1.0 - (double)y/(this.Height - 4))), m_rgb.B));
|
||||
break;
|
||||
}
|
||||
|
||||
return _hsl;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,659 +0,0 @@
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** Project: Joy-Con Color Picker *****/
|
||||
/***** Filename: ctrlVerticalColorSlider.cs *****/
|
||||
/***** Original Project: Adobe Color Picker Clone 1 *****/
|
||||
/***** Original Author: Danny Blanchard *****/
|
||||
/***** - scrabcakes@gmail.com *****/
|
||||
/***** Updates: *****/
|
||||
/***** 3/28/2005 - Initial Version : Danny Blanchard *****/
|
||||
/***** Feb 2018 - JoyCon Version : CTCaer *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** This version is heavily optimised for use in *****/
|
||||
/***** CTCaer's Joy-Con Toolkit and other projects. *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor {
|
||||
public delegate void EventHandler(object sender, EventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// A vertical slider control that shows a range for a color property (a.k.a. Hue, Saturation, Brightness,
|
||||
/// Red, Green, Blue) and sends an event when the slider is changed.
|
||||
/// </summary>
|
||||
public class ctrlVerticalColorSlider : System.Windows.Forms.UserControl
|
||||
{
|
||||
#region Class Variables
|
||||
|
||||
public enum eDrawStyle
|
||||
{
|
||||
Hue,
|
||||
Saturation,
|
||||
Brightness,
|
||||
Red,
|
||||
Green,
|
||||
Blue
|
||||
}
|
||||
|
||||
|
||||
// Slider properties
|
||||
private int m_iMarker_Start_Y = 0;
|
||||
private bool m_bDragging = false;
|
||||
|
||||
// These variables keep track of how to fill in the content inside the box;
|
||||
private eDrawStyle m_eDrawStyle = eDrawStyle.Hue;
|
||||
private AdobeColors.HSL m_hsl;
|
||||
private Color m_rgb;
|
||||
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors / Destructors
|
||||
|
||||
public ctrlVerticalColorSlider()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
// Initialize Colors
|
||||
m_hsl = new AdobeColors.HSL();
|
||||
m_hsl.H = 1.0;
|
||||
m_hsl.S = 1.0;
|
||||
m_hsl.L = 1.0;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
m_eDrawStyle = eDrawStyle.Hue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ctrlVerticalColorSlider
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
|
||||
this.ForeColor = System.Drawing.Color.DeepSkyBlue;
|
||||
this.Name = "ctrlVerticalColorSlider";
|
||||
this.Size = new System.Drawing.Size(40, 264);
|
||||
this.Load += new System.EventHandler(this.ctrl1DColorBar_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ctrl1DColorBar_Paint);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ctrl1DColorBar_MouseDown);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrl1DColorBar_MouseMove);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ctrl1DColorBar_MouseUp);
|
||||
this.Resize += new System.EventHandler(this.ctrl1DColorBar_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Control Events
|
||||
|
||||
private void ctrl1DColorBar_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
m_bDragging = true; // Begin dragging which notifies MouseMove function that it needs to update the marker
|
||||
|
||||
int y;
|
||||
y = e.Y;
|
||||
y -= 4; // Calculate slider position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 9 ) y = this.Height - 9;
|
||||
|
||||
if ( y == m_iMarker_Start_Y ) // If the slider hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawSlider(y, false); // Redraw the slider
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls slider(color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( !m_bDragging ) // Only respond when the mouse is dragging the marker.
|
||||
return;
|
||||
|
||||
int y;
|
||||
y = e.Y;
|
||||
y -= 4; // Calculate slider position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 9 ) y = this.Height - 9;
|
||||
|
||||
if ( y == m_iMarker_Start_Y ) // If the slider hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawSlider(y, false); // Redraw the slider
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls slider(color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
m_bDragging = false;
|
||||
|
||||
int y;
|
||||
y = e.Y;
|
||||
y -= 4; // Calculate slider position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 9 ) y = this.Height - 9;
|
||||
|
||||
if ( y == m_iMarker_Start_Y ) // If the slider hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawSlider(y, false); // Redraw the slider
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls slider(color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public new event EventHandler Scroll;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// The drawstyle of the contol (Hue, Saturation, Brightness, Red, Green or Blue)
|
||||
/// </summary>
|
||||
public eDrawStyle DrawStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_eDrawStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_eDrawStyle = value;
|
||||
|
||||
// Redraw the control based on the new eDrawStyle
|
||||
Reset_Slider(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The HSL color of the control, changing the HSL will automatically change the RGB color for the control.
|
||||
/// </summary>
|
||||
public AdobeColors.HSL HSL
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_hsl;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_hsl = value;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Slider(true);
|
||||
DrawContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The RGB color of the control, changing the RGB will automatically change the HSL color for the control.
|
||||
/// </summary>
|
||||
public Color RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rgb;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rgb = value;
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Slider(true);
|
||||
DrawContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Redraws the background over the slider area on both sides of the control
|
||||
/// </summary>
|
||||
private void ClearSlider()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
SolidBrush brush = new SolidBrush(Color.FromArgb(70,70,70));
|
||||
|
||||
g.FillRectangle(brush, 0, 0, 8, this.Height); // clear left hand slider
|
||||
g.FillRectangle(brush, this.Width - 8, 0, 8, this.Height); // clear right hand slider
|
||||
brush.Dispose();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the slider arrows on both sides of the control.
|
||||
/// </summary>
|
||||
/// <param name="position">position value of the slider, lowest being at the bottom. The range
|
||||
/// is between 0 and the controls height-9. The values will be adjusted if too large/small</param>
|
||||
/// <param name="Unconditional">If Unconditional is true, the slider is drawn, otherwise some logic
|
||||
/// is performed to determine is drawing is really neccessary.</param>
|
||||
private void DrawSlider(int position, bool Unconditional)
|
||||
{
|
||||
if ( position < 0 ) position = 0;
|
||||
if ( position > this.Height - 9 ) position = this.Height - 9;
|
||||
|
||||
if ( m_iMarker_Start_Y == position && !Unconditional ) // If the marker position hasn't changed
|
||||
return; // since the last time it was drawn and we don't HAVE to redraw
|
||||
// then exit procedure
|
||||
|
||||
m_iMarker_Start_Y = position; // Update the controls marker position
|
||||
|
||||
this.ClearSlider(); // Remove old slider
|
||||
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pencil = new Pen(Color.FromArgb(116,114,106)); // Same gray color Photoshop uses
|
||||
Brush brush = Brushes.White;
|
||||
|
||||
Point[] arrow = new Point[7]; // GGG
|
||||
arrow[0] = new Point(1,position); // G G
|
||||
arrow[1] = new Point(3,position); // G G
|
||||
arrow[2] = new Point(7,position + 4); // G G
|
||||
arrow[3] = new Point(3,position + 8); // G G
|
||||
arrow[4] = new Point(1,position + 8); // G G
|
||||
arrow[5] = new Point(0,position + 7); // G G
|
||||
arrow[6] = new Point(0,position + 1); // G G
|
||||
// GGG
|
||||
|
||||
g.FillPolygon(brush, arrow); // Fill left arrow with white
|
||||
g.DrawPolygon(pencil, arrow); // Draw left arrow border with gray
|
||||
|
||||
// GGG
|
||||
arrow[0] = new Point(this.Width - 2,position); // G G
|
||||
arrow[1] = new Point(this.Width - 4,position); // G G
|
||||
arrow[2] = new Point(this.Width - 8,position + 4); // G G
|
||||
arrow[3] = new Point(this.Width - 4,position + 8); // G G
|
||||
arrow[4] = new Point(this.Width - 2,position + 8); // G G
|
||||
arrow[5] = new Point(this.Width - 1,position + 7); // G G
|
||||
arrow[6] = new Point(this.Width - 1,position + 1); // G G
|
||||
// GGG
|
||||
|
||||
g.FillPolygon(brush, arrow); // Fill right arrow with white
|
||||
g.DrawPolygon(pencil, arrow); // Draw right arrow border with gray
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the border around the control, in this case the border around the content area between
|
||||
/// the slider arrows.
|
||||
/// </summary>
|
||||
private void DrawBorder()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pencil;
|
||||
|
||||
// To make the control look like Adobe Photoshop's the border around the control will be a gray line
|
||||
// on the top and left side, a white line on the bottom and right side, and a black rectangle (line)
|
||||
// inside the gray/white rectangle
|
||||
|
||||
pencil = new Pen(Color.FromArgb(100, 100, 100)); // The same gray color used by Photoshop
|
||||
g.DrawLine(pencil, this.Width - 10, 2, 9, 2); // Draw top line
|
||||
g.DrawLine(pencil, 9, 2, 9, this.Height - 4); // Draw left hand line
|
||||
|
||||
//pencil = new Pen(Color.FromArgb(120, 120, 120));
|
||||
g.DrawLine(pencil, this.Width - 9, 2, this.Width - 9,this.Height - 3); // Draw right hand line
|
||||
g.DrawLine(pencil, this.Width - 9,this.Height - 3, 9,this.Height - 3); // Draw bottome line
|
||||
|
||||
pencil = new Pen(Color.FromArgb(85, 85, 85));
|
||||
g.DrawRectangle(pencil, 10, 3, this.Width - 20, this.Height - 7); // Draw inner black rectangle
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the DrawStyle of the control and calls the appropriate
|
||||
/// drawing function for content
|
||||
/// </summary>
|
||||
private void DrawContent()
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Draw_Style_X - Content drawing functions
|
||||
|
||||
// The following functions do the real work of the control, drawing the primary content (the area between the slider)
|
||||
//
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Hue (from 0 to 360)
|
||||
/// </summary>
|
||||
private void Draw_Style_Hue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
_hsl.S = 1.0; // S and L will both be at 100% for this DrawStyle
|
||||
_hsl.L = 1.0;
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
_hsl.H = 1.0 - (double)i/(this.Height - 8); // H (hue) is based on the current vertical position
|
||||
Pen pen = new Pen(AdobeColors.HSL_to_RGB(_hsl)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Saturation (0 to 100%) for the given
|
||||
/// Hue and Luminance.
|
||||
/// </summary>
|
||||
private void Draw_Style_Saturation()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
_hsl.H = m_hsl.H; // Use the H and L values of the current color (m_hsl)
|
||||
_hsl.L = m_hsl.L;
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
_hsl.S = 1.0 - (double)i/(this.Height - 8); // S (Saturation) is based on the current vertical position
|
||||
Pen pen = new Pen(AdobeColors.HSL_to_RGB(_hsl)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Luminance (0 to 100%) for the given
|
||||
/// Hue and Saturation.
|
||||
/// </summary>
|
||||
private void Draw_Style_Luminance()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
_hsl.H = m_hsl.H; // Use the H and S values of the current color (m_hsl)
|
||||
_hsl.S = m_hsl.S;
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
_hsl.L = 1.0 - (double)i/(this.Height - 8); // L (Luminance) is based on the current vertical position
|
||||
Pen pen = new Pen(AdobeColors.HSL_to_RGB(_hsl)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Red (0 to 255) for the given
|
||||
/// Green and Blue.
|
||||
/// </summary>
|
||||
private void Draw_Style_Red()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
int red = 255 - Round(255 * (double)i/(this.Height - 8)); // red is based on the current vertical position
|
||||
Pen pen = new Pen(Color.FromArgb(red, m_rgb.G, m_rgb.B)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Green (0 to 255) for the given
|
||||
/// Red and Blue.
|
||||
/// </summary>
|
||||
private void Draw_Style_Green()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
int green = 255 - Round(255 * (double)i/(this.Height - 8)); // green is based on the current vertical position
|
||||
Pen pen = new Pen(Color.FromArgb(m_rgb.R, green, m_rgb.B)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Blue (0 to 255) for the given
|
||||
/// Red and Green.
|
||||
/// </summary>
|
||||
private void Draw_Style_Blue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
int blue = 255 - Round(255 * (double)i/(this.Height - 8)); // green is based on the current vertical position
|
||||
Pen pen = new Pen(Color.FromArgb(m_rgb.R, m_rgb.G, blue)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Calls all the functions neccessary to redraw the entire control.
|
||||
/// </summary>
|
||||
private void Redraw_Control()
|
||||
{
|
||||
DrawSlider(m_iMarker_Start_Y, true);
|
||||
DrawBorder();
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the vertical position of the slider to match the controls color. Gives the option of redrawing the slider.
|
||||
/// </summary>
|
||||
/// <param name="Redraw">Set to true if you want the function to redraw the slider after determining the best position</param>
|
||||
private void Reset_Slider(bool Redraw)
|
||||
{
|
||||
// The position of the marker (slider) changes based on the current drawstyle:
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * m_hsl.H );
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * m_hsl.S );
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * m_hsl.L );
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * (double)m_rgb.R/255 );
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * (double)m_rgb.G/255 );
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * (double)m_rgb.B/255 );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( Redraw )
|
||||
DrawSlider(m_iMarker_Start_Y, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the controls color (both HSL and RGB variables) based on the current slider position
|
||||
/// </summary>
|
||||
private void ResetHSLRGB()
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_hsl.H = 1.0 - (double)m_iMarker_Start_Y/(this.Height - 9);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_hsl.S = 1.0 - (double)m_iMarker_Start_Y/(this.Height - 9);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_hsl.L = 1.0 - (double)m_iMarker_Start_Y/(this.Height - 9);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
m_rgb = Color.FromArgb(255 - Round( 255 * (double)m_iMarker_Start_Y/(this.Height - 9) ), m_rgb.G, m_rgb.B);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
m_rgb = Color.FromArgb(m_rgb.R, 255 - Round( 255 * (double)m_iMarker_Start_Y/(this.Height - 9) ), m_rgb.B);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
m_rgb = Color.FromArgb(m_rgb.R, m_rgb.G, 255 - Round( 255 * (double)m_iMarker_Start_Y/(this.Height - 9) ));
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Kindof self explanitory, I really need to look up the .NET function that does this.
|
||||
/// </summary>
|
||||
/// <param name="val">double value to be rounded to an integer</param>
|
||||
/// <returns></returns>
|
||||
private int Round(double val)
|
||||
{
|
||||
int ret_val = (int)val;
|
||||
|
||||
int temp = (int)(val * 100);
|
||||
|
||||
if ( (temp % 100) >= 50 )
|
||||
ret_val += 1;
|
||||
|
||||
return ret_val;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 10</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>49</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,152 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>7.10.3077</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{22E08F67-4E40-4A92-876B-410FFD49B20E}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName />
|
||||
<AssemblyName>jcColor</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile />
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>jcColor</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject />
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>0.0</OldToolsVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>obj\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile />
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DocumentationFile />
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn />
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<Name>System.Windows.Forms</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.XML">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdobeColors.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ctrl2DColorBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ctrlVerticalColorSlider.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="EyedropColorPicker.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmJoyConColorPicker.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PresetNameDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PresetNameDialog.Designer.cs">
|
||||
<DependentUpon>PresetNameDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="RoundButton.cs" />
|
||||
<Compile Include="Util.cs" />
|
||||
<None Include="Resources\eyedropper.bmp" />
|
||||
<EmbeddedResource Include="ctrl2DColorBox.resx">
|
||||
<DependentUpon>ctrl2DColorBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ctrlVerticalColorSlider.resx">
|
||||
<DependentUpon>ctrlVerticalColorSlider.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="frmJoyConColorPicker.resx">
|
||||
<DependentUpon>frmJoyConColorPicker.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PresetNameDialog.resx">
|
||||
<DependentUpon>PresetNameDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.net4.7.1.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent />
|
||||
<PostBuildEvent />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+1314
-2669
File diff suppressed because it is too large.
Load diff
+26
-102
@@ -1,11 +1,22 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "hidapi.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::ComponentModel;
|
||||
using namespace System::Collections;
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Data;
|
||||
using namespace System::Drawing;
|
||||
using namespace System::Resources;
|
||||
using namespace System::Xml;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::IO;
|
||||
using namespace System::Globalization;
|
||||
|
||||
template <typename T> T CLAMP(const T& value, const T& low, const T& high)
|
||||
{
|
||||
return value < low ? low : (value > high ? high : value);
|
||||
return value < low ? low : (value > high ? high : value);
|
||||
}
|
||||
|
||||
typedef uint8_t u8;
|
||||
@@ -17,91 +28,8 @@ typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct brcm_hdr {
|
||||
u8 cmd;
|
||||
u8 timer;
|
||||
u8 rumble_l[4];
|
||||
u8 rumble_r[4];
|
||||
};
|
||||
|
||||
struct brcm_cmd_01 {
|
||||
u8 subcmd;
|
||||
union {
|
||||
struct {
|
||||
u32 offset;
|
||||
u8 size;
|
||||
} spi_data;
|
||||
|
||||
struct {
|
||||
u8 arg1;
|
||||
u8 arg2;
|
||||
} subcmd_arg;
|
||||
|
||||
struct {
|
||||
u8 mcu_cmd;
|
||||
u8 mcu_subcmd;
|
||||
u8 mcu_mode;
|
||||
} subcmd_21_21;
|
||||
|
||||
struct {
|
||||
u8 mcu_cmd;
|
||||
u8 mcu_subcmd;
|
||||
u8 no_of_reg;
|
||||
u16 reg1_addr;
|
||||
u8 reg1_val;
|
||||
u16 reg2_addr;
|
||||
u8 reg2_val;
|
||||
u16 reg3_addr;
|
||||
u8 reg3_val;
|
||||
u16 reg4_addr;
|
||||
u8 reg4_val;
|
||||
u16 reg5_addr;
|
||||
u8 reg5_val;
|
||||
u16 reg6_addr;
|
||||
u8 reg6_val;
|
||||
u16 reg7_addr;
|
||||
u8 reg7_val;
|
||||
u16 reg8_addr;
|
||||
u8 reg8_val;
|
||||
u16 reg9_addr;
|
||||
u8 reg9_val;
|
||||
} subcmd_21_23_04;
|
||||
|
||||
struct {
|
||||
u8 mcu_cmd;
|
||||
u8 mcu_subcmd;
|
||||
u8 mcu_ir_mode;
|
||||
u8 no_of_frags;
|
||||
u16 mcu_major_v;
|
||||
u16 mcu_minor_v;
|
||||
} subcmd_21_23_01;
|
||||
};
|
||||
};
|
||||
|
||||
struct ir_image_config {
|
||||
u8 ir_res_reg;
|
||||
u16 ir_exposure;
|
||||
u8 ir_leds; // Leds to enable, Strobe/Flashlight modes
|
||||
u16 ir_leds_intensity; // MSByte: Leds 1/2, LSB: Leds 3/4
|
||||
u8 ir_digital_gain;
|
||||
u8 ir_ex_light_filter;
|
||||
u32 ir_custom_register; // MSByte: Enable/Disable, Middle Byte: Edge smoothing, LSB: Color interpolation
|
||||
u16 ir_buffer_update_time;
|
||||
u8 ir_hand_analysis_mode;
|
||||
u8 ir_hand_analysis_threshold;
|
||||
u32 ir_denoise; // MSByte: Enable/Disable, Middle Byte: Edge smoothing, LSB: Color interpolation
|
||||
u8 ir_flip;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
extern s16 uint16_to_int16(u16 a);
|
||||
extern void decode_stick_params(u16 *decoded_stick_params, u8 *encoded_stick_params);
|
||||
extern void encode_stick_params(u8 *encoded_stick_params, u16 *decoded_stick_params);
|
||||
|
||||
extern std::string get_sn(u32 offset, const u16 read_len);
|
||||
extern s16 uint16_to_int16(u16 a);
|
||||
extern int get_spi_data(u32 offset, const u16 read_len, u8 *test_buf);
|
||||
extern int write_spi_data(u32 offset, const u16 write_len, u8* test_buf);
|
||||
extern int get_device_info(u8* test_buf);
|
||||
@@ -115,25 +43,21 @@ extern int send_custom_command(u8* arg);
|
||||
extern int device_connection();
|
||||
extern int set_led_busy();
|
||||
extern int button_test();
|
||||
extern int ir_sensor(ir_image_config &ir_cfg);
|
||||
extern int ir_sensor_config_live(ir_image_config &ir_cfg);
|
||||
extern int nfc_tag_info();
|
||||
extern int silence_input_report();
|
||||
int handle_ok;
|
||||
int handle_ok;
|
||||
bool enable_button_test;
|
||||
bool enable_IRVideoPhoto;
|
||||
bool enable_IRAutoExposure;
|
||||
bool enable_NFCScanning;
|
||||
bool allow_full_restore;
|
||||
bool cancel_spi_dump;
|
||||
bool check_connection_ok;
|
||||
|
||||
u8 timming_byte;
|
||||
u8 ir_max_frag_no;
|
||||
hid_device *handle_l_r_pro;
|
||||
hid_device *handle_dual_l;
|
||||
bool dual_mode_jc_enable;
|
||||
bool dual_l_handle_enable;
|
||||
int handler_close;
|
||||
int option_is_on;
|
||||
|
||||
namespace CppWinFormJoy {
|
||||
class images
|
||||
{
|
||||
//For annoying designer..
|
||||
//Todo.
|
||||
};
|
||||
class images
|
||||
{
|
||||
//For annoying designer..
|
||||
//Todo.
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
@@ -8,17 +8,17 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DF218734-A810-4FFF-8164-638680773512}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>jctool</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<ProjectName>jctool</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@@ -35,7 +35,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<EnableManagedIncrementalBuild>false</EnableManagedIncrementalBuild>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
@@ -43,7 +42,6 @@
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4244</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
@@ -61,13 +59,8 @@
|
||||
</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
<Command>copy /Y "$(ProjectDir)Colors.config" "$(OutDir)Colors.config"</Command>
|
||||
</PostBuildEvent>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>$(ProjectDir)dpiawarev2.manifest.xml</AdditionalManifestFiles>
|
||||
<EnableDpiAwareness>false</EnableDpiAwareness>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -81,8 +74,6 @@
|
||||
<ClCompile Include="hid.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hidapi_log.h" />
|
||||
<ClInclude Include="ir_sensor.h" />
|
||||
<ClInclude Include="jctool.h" />
|
||||
<ClInclude Include="FormJoy.h">
|
||||
<FileType>CppForm</FileType>
|
||||
@@ -116,11 +107,7 @@
|
||||
<Image Include="pro2.ico" />
|
||||
<Image Include="pro_small.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="jc_colorpicker\jcColorDialog.vs2017.csproj">
|
||||
<Project>{22e08f67-4e40-4a92-876b-410ffd49b20e}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -44,12 +44,6 @@
|
||||
<ClInclude Include="luts.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ir_sensor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="hidapi_log.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="FormJoy.resx">
|
||||
+4
-42
@@ -6,47 +6,9 @@ struct lut_amp {
|
||||
uint16_t la[101];
|
||||
};
|
||||
|
||||
static lut_amp lut_joy_amp{
|
||||
{ 0.00000f, 0.007843f, 0.011823f, 0.014061f, 0.01672f, 0.019885f, 0.023648f, 0.028123f,
|
||||
0.033442f, 0.039771f, 0.047296f, 0.056246f, 0.066886f, 0.079542f, 0.094592f, 0.112491f,
|
||||
0.117471f, 0.122671f, 0.128102f, 0.133774f, 0.139697f, 0.145882f, 0.152341f, 0.159085f,
|
||||
0.166129f, 0.173484f, 0.181166f, 0.189185f, 0.197561f, 0.206308f, 0.215442f, 0.224982f,
|
||||
0.229908f, 0.234943f, 0.240087f, 0.245345f, 0.250715f, 0.256206f, 0.261816f, 0.267549f,
|
||||
0.273407f, 0.279394f, 0.285514f, 0.291765f, 0.298154f, 0.304681f, 0.311353f, 0.318171f,
|
||||
0.325138f, 0.332258f, 0.339534f, 0.346969f, 0.354566f, 0.362331f, 0.370265f, 0.378372f,
|
||||
0.386657f, 0.395124f, 0.403777f, 0.412619f, 0.421652f, 0.430885f, 0.440321f, 0.449964f,
|
||||
0.459817f, 0.469885f, 0.480174f, 0.490689f, 0.501433f, 0.512413f, 0.523633f, 0.535100f,
|
||||
0.546816f, 0.558790f, 0.571027f, 0.583530f, 0.596307f, 0.609365f, 0.622708f, 0.636344f,
|
||||
0.650279f, 0.664518f, 0.679069f, 0.693939f, 0.709133f, 0.724662f, 0.740529f, 0.756745f,
|
||||
0.773316f, 0.790249f, 0.807554f, 0.825237f, 0.843307f, 0.861772f, 0.880643f, 0.899928f,
|
||||
0.919633f, 0.939771f, 0.960348f, 0.981378f, 1.002867f },
|
||||
|
||||
{ 0x0, 0x2, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
|
||||
0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
|
||||
0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e,
|
||||
0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e,
|
||||
0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e,
|
||||
0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
|
||||
0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e,
|
||||
0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e,
|
||||
0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e,
|
||||
0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e,
|
||||
0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae,
|
||||
0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe,
|
||||
0xc0, 0xc2, 0xc4, 0xc6, 0xc8 },
|
||||
|
||||
{ 0x0040, 0x8040, 0x0041, 0x8041, 0x0042, 0x8042, 0x0043, 0x8043,
|
||||
0x0044, 0x8044, 0x0045, 0x8045, 0x0046, 0x8046, 0x0047, 0x8047,
|
||||
0x0048, 0x8048, 0x0049, 0x8049, 0x004a, 0x804a, 0x004b, 0x804b,
|
||||
0x004c, 0x804c, 0x004d, 0x804d, 0x004e, 0x804e, 0x004f, 0x804f,
|
||||
0x0050, 0x8050, 0x0051, 0x8051, 0x0052, 0x8052, 0x0053, 0x8053,
|
||||
0x0054, 0x8054, 0x0055, 0x8055, 0x0056, 0x8056, 0x0057, 0x8057,
|
||||
0x0058, 0x8058, 0x0059, 0x8059, 0x005a, 0x805a, 0x005b, 0x805b,
|
||||
0x005c, 0x805c, 0x005d, 0x805d, 0x005e, 0x805e, 0x005f, 0x805f,
|
||||
0x0060, 0x8060, 0x0061, 0x8061, 0x0062, 0x8062, 0x0063, 0x8063,
|
||||
0x0064, 0x8064, 0x0065, 0x8065, 0x0066, 0x8066, 0x0067, 0x8067,
|
||||
0x0068, 0x8068, 0x0069, 0x8069, 0x006a, 0x806a, 0x006b, 0x806b,
|
||||
0x006c, 0x806c, 0x006d, 0x806d, 0x006e, 0x806e, 0x006f, 0x806f,
|
||||
0x0070, 0x8070, 0x0071, 0x8071, 0x0072 }
|
||||
lut_amp lut_joy_amp{
|
||||
{ 0.0f, 0.007843f, 0.011823f, 0.014061f, 0.01672f, 0.019885f, 0.023648f, 0.028123f, 0.033442f, 0.039771f, 0.047296f, 0.056246f, 0.066886f, 0.079542f, 0.094592f, 0.112491f, 0.117471f, 0.122671f, 0.128102f, 0.133774f, 0.139697f, 0.145882f, 0.152341f, 0.159085f, 0.166129f, 0.173484f, 0.181166f, 0.189185f, 0.197561f, 0.206308f, 0.215442f, 0.224982f, 0.229908f, 0.234943f, 0.240087f, 0.245345f, 0.250715f, 0.256206f, 0.261816f, 0.267549f, 0.273407f, 0.279394f, 0.285514f, 0.291765f, 0.298154f, 0.304681f, 0.311353f, 0.318171f, 0.325138f, 0.332258f, 0.339534f, 0.346969f, 0.354566f, 0.362331f, 0.370265f, 0.378372f, 0.386657f, 0.395124f, 0.403777f, 0.412619f, 0.421652f, 0.430885f, 0.440321f, 0.449964f, 0.459817f, 0.469885f, 0.480174f, 0.490689f, 0.501433f, 0.512413f, 0.523633f, 0.5351f, 0.546816f, 0.55879f, 0.571027f, 0.58353f, 0.596307f, 0.609365f, 0.622708f, 0.636344f, 0.650279f, 0.664518f, 0.679069f, 0.693939f, 0.709133f, 0.724662f, 0.740529f, 0.756745f, 0.773316f, 0.790249f, 0.807554f, 0.825237f, 0.843307f, 0.861772f, 0.880643f, 0.899928f, 0.919633f, 0.939771f, 0.960348f, 0.981378f, 1.002867f },
|
||||
{ 0x0, 0x2, 0x4, 0x6, 0x8, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, 0xc0, 0xc2, 0xc4, 0xc6, 0xc8 },
|
||||
{ 0x0040, 0x8040, 0x0041, 0x8041, 0x0042, 0x8042, 0x0043, 0x8043, 0x0044, 0x8044, 0x0045, 0x8045, 0x0046, 0x8046, 0x0047, 0x8047, 0x0048, 0x8048, 0x0049, 0x8049, 0x004a, 0x804a, 0x004b, 0x804b, 0x004c, 0x804c, 0x004d, 0x804d, 0x004e, 0x804e, 0x004f, 0x804f, 0x0050, 0x8050, 0x0051, 0x8051, 0x0052, 0x8052, 0x0053, 0x8053, 0x0054, 0x8054, 0x0055, 0x8055, 0x0056, 0x8056, 0x0057, 0x8057, 0x0058, 0x8058, 0x0059, 0x8059, 0x005a, 0x805a, 0x005b, 0x805b, 0x005c, 0x805c, 0x005d, 0x805d, 0x005e, 0x805e, 0x005f, 0x805f, 0x0060, 0x8060, 0x0061, 0x8061, 0x0062, 0x8062, 0x0063, 0x8063, 0x0064, 0x8064, 0x0065, 0x8065, 0x0066, 0x8066, 0x0067, 0x8067, 0x0068, 0x8068, 0x0069, 0x8069, 0x006a, 0x806a, 0x006b, 0x806b, 0x006c, 0x806c, 0x006d, 0x806d, 0x006e, 0x806e, 0x006f, 0x806f, 0x0070, 0x8070, 0x0071, 0x8071, 0x0072 }
|
||||
};
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<RetailColors>
|
||||
<RC key="retailpreset_01" rgb_color="828282" tooltip="Grey" />
|
||||
<RC key="retailpreset_02" rgb_color="0AB9E6" tooltip="Neon Blue" />
|
||||
<RC key="retailpreset_03" rgb_color="FF3C28" tooltip="Neon Red" />
|
||||
<RC key="retailpreset_04" rgb_color="E6FF00" tooltip="Neon Yellow" />
|
||||
<RC key="retailpreset_05" rgb_color="FF3278" tooltip="Neon Pink" />
|
||||
<RC key="retailpreset_06" rgb_color="1EDC00" tooltip="Neon Green" />
|
||||
<RC key="retailpreset_07" rgb_color="E10F00" tooltip="Red" />
|
||||
<RC key="retailpreset_08" rgb_color="323232" tooltip="Pro Black" />
|
||||
</RetailColors>
|
||||
<RetailColorsButtons>
|
||||
<RC key="retailpreset_09" rgb_color="0F0F0F" tooltip="Grey Buttons" />
|
||||
<RC key="retailpreset_10" rgb_color="001E1E" tooltip="Neon Blue Buttons" />
|
||||
<RC key="retailpreset_11" rgb_color="1E0A0A" tooltip="Neon Red Buttons" />
|
||||
<RC key="retailpreset_12" rgb_color="142800" tooltip="Neon Yellow Buttons" />
|
||||
<RC key="retailpreset_13" rgb_color="28001E" tooltip="Neon Pink Buttons" />
|
||||
<RC key="retailpreset_14" rgb_color="002800" tooltip="Neon Green Buttons" />
|
||||
<RC key="retailpreset_15" rgb_color="280A0A" tooltip="Red Buttons" />
|
||||
<RC key="retailpreset_16" rgb_color="FFFFFF" tooltip="Pro Black Buttons" />
|
||||
</RetailColorsButtons>
|
||||
</configuration>
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
// Super Mario Bros - Main theme
|
||||
static uint32_t tune_SMB[2740] = {
|
||||
uint32_t tune_SMB[2740] = {
|
||||
0xbf375f7b, 0xbe37c362, 0xbe10bf77, 0xcef75e6c, 0xc6f7de71, 0xbbf74240, 0xcef75e6e, 0xcef74279,
|
||||
0xbe396775, 0xce37c36e, 0xce374374, 0xbe17df6f, 0xcf39e77d, 0xce3daf6b, 0xca175f40, 0xceecc260,
|
||||
0xcef75e6c, 0xbee0e672, 0xbef75e6e, 0xbef0de6c, 0xcef7666c, 0xce39df74, 0xce37df6d, 0xcef03e78,
|
||||
@@ -347,7 +347,7 @@ static uint32_t tune_SMB[2740] = {
|
||||
0xbe306771, 0xbe308373, 0xce37436b, 0x06e0de68 };
|
||||
|
||||
// Super Mario Odyssey - Jump Up, Super Star!
|
||||
static uint32_t tune_SMO_OK[4941] = {
|
||||
uint32_t tune_SMO_OK[4941] = {
|
||||
0x00014040, 0x00014040, 0x00014040, 0x00014040, 0x00014040, 0x00014040, 0x00014040, 0x530ca648,
|
||||
0xef33f16b, 0xb34b2946, 0xeafd4342, 0xcad14640, 0xeba93348, 0x4b53d94a, 0x4339e646, 0xfb3f5646,
|
||||
0xb3495945, 0xb752536c, 0x933b6745, 0xf355e945, 0x93be7a46, 0xfa7cd548, 0xad4bef84, 0x5c1b2e48,
|
||||
|
||||
Reference in new issue
Block a user