├── .gitattributes
├── .gitignore
├── AddColorCode.sln
├── AddColorCode
├── AddColorCode.cpp
├── AddColorCode.def
├── AddColorCode.h
├── AddColorCode.rc
├── AddColorCode.vcxproj
├── AddColorCode.vcxproj.filters
├── AddColorCode_Filter.cpp
├── pch.cpp
├── pch.h
└── resource.h
├── CREDITS.md
├── Common.props
├── LICENSE
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 | _bin/
36 | _obj/
37 |
38 | # Visual Studio 2015/2017 cache/options directory
39 | .vs/
40 | # Uncomment if you have tasks that create the project's static files in wwwroot
41 | #wwwroot/
42 |
43 | # Visual Studio 2017 auto generated files
44 | Generated\ Files/
45 |
46 | # MSTest test Results
47 | [Tt]est[Rr]esult*/
48 | [Bb]uild[Ll]og.*
49 |
50 | # NUnit
51 | *.VisualState.xml
52 | TestResult.xml
53 | nunit-*.xml
54 |
55 | # Build Results of an ATL Project
56 | [Dd]ebugPS/
57 | [Rr]eleasePS/
58 | dlldata.c
59 |
60 | # Benchmark Results
61 | BenchmarkDotNet.Artifacts/
62 |
63 | # .NET Core
64 | project.lock.json
65 | project.fragment.lock.json
66 | artifacts/
67 |
68 | # ASP.NET Scaffolding
69 | ScaffoldingReadMe.txt
70 |
71 | # StyleCop
72 | StyleCopReport.xml
73 |
74 | # Files built by Visual Studio
75 | *_i.c
76 | *_p.c
77 | *_h.h
78 | *.ilk
79 | *.meta
80 | *.obj
81 | *.iobj
82 | *.pch
83 | *.pdb
84 | *.ipdb
85 | *.pgc
86 | *.pgd
87 | *.rsp
88 | *.sbr
89 | *.tlb
90 | *.tli
91 | *.tlh
92 | *.tmp
93 | *.tmp_proj
94 | *_wpftmp.csproj
95 | *.log
96 | *.vspscc
97 | *.vssscc
98 | .builds
99 | *.pidb
100 | *.svclog
101 | *.scc
102 |
103 | # Chutzpah Test files
104 | _Chutzpah*
105 |
106 | # Visual C++ cache files
107 | ipch/
108 | *.aps
109 | *.ncb
110 | *.opendb
111 | *.opensdf
112 | *.sdf
113 | *.cachefile
114 | *.VC.db
115 | *.VC.VC.opendb
116 |
117 | # Visual Studio profiler
118 | *.psess
119 | *.vsp
120 | *.vspx
121 | *.sap
122 |
123 | # Visual Studio Trace Files
124 | *.e2e
125 |
126 | # TFS 2012 Local Workspace
127 | $tf/
128 |
129 | # Guidance Automation Toolkit
130 | *.gpState
131 |
132 | # ReSharper is a .NET coding add-in
133 | _ReSharper*/
134 | *.[Rr]e[Ss]harper
135 | *.DotSettings.user
136 |
137 | # TeamCity is a build add-in
138 | _TeamCity*
139 |
140 | # DotCover is a Code Coverage Tool
141 | *.dotCover
142 |
143 | # AxoCover is a Code Coverage Tool
144 | .axoCover/*
145 | !.axoCover/settings.json
146 |
147 | # Coverlet is a free, cross platform Code Coverage Tool
148 | coverage*.json
149 | coverage*.xml
150 | coverage*.info
151 |
152 | # Visual Studio code coverage results
153 | *.coverage
154 | *.coveragexml
155 |
156 | # NCrunch
157 | _NCrunch_*
158 | .*crunch*.local.xml
159 | nCrunchTemp_*
160 |
161 | # MightyMoose
162 | *.mm.*
163 | AutoTest.Net/
164 |
165 | # Web workbench (sass)
166 | .sass-cache/
167 |
168 | # Installshield output folder
169 | [Ee]xpress/
170 |
171 | # DocProject is a documentation generator add-in
172 | DocProject/buildhelp/
173 | DocProject/Help/*.HxT
174 | DocProject/Help/*.HxC
175 | DocProject/Help/*.hhc
176 | DocProject/Help/*.hhk
177 | DocProject/Help/*.hhp
178 | DocProject/Help/Html2
179 | DocProject/Help/html
180 |
181 | # Click-Once directory
182 | publish/
183 |
184 | # Publish Web Output
185 | *.[Pp]ublish.xml
186 | *.azurePubxml
187 | # Note: Comment the next line if you want to checkin your web deploy settings,
188 | # but database connection strings (with potential passwords) will be unencrypted
189 | *.pubxml
190 | *.publishproj
191 |
192 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
193 | # checkin your Azure Web App publish settings, but sensitive information contained
194 | # in these scripts will be unencrypted
195 | PublishScripts/
196 |
197 | # NuGet Packages
198 | *.nupkg
199 | # NuGet Symbol Packages
200 | *.snupkg
201 | # The packages folder can be ignored because of Package Restore
202 | **/[Pp]ackages/*
203 | # except build/, which is used as an MSBuild target.
204 | !**/[Pp]ackages/build/
205 | # Uncomment if necessary however generally it will be regenerated when needed
206 | #!**/[Pp]ackages/repositories.config
207 | # NuGet v3's project.json files produces more ignorable files
208 | *.nuget.props
209 | *.nuget.targets
210 |
211 | # Microsoft Azure Build Output
212 | csx/
213 | *.build.csdef
214 |
215 | # Microsoft Azure Emulator
216 | ecf/
217 | rcf/
218 |
219 | # Windows Store app package directories and files
220 | AppPackages/
221 | BundleArtifacts/
222 | Package.StoreAssociation.xml
223 | _pkginfo.txt
224 | *.appx
225 | *.appxbundle
226 | *.appxupload
227 |
228 | # Visual Studio cache files
229 | # files ending in .cache can be ignored
230 | *.[Cc]ache
231 | # but keep track of directories ending in .cache
232 | !?*.[Cc]ache/
233 |
234 | # Others
235 | ClientBin/
236 | ~$*
237 | *~
238 | *.dbmdl
239 | *.dbproj.schemaview
240 | *.jfm
241 | *.pfx
242 | *.publishsettings
243 | orleans.codegen.cs
244 |
245 | # Including strong name files can present a security risk
246 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
247 | #*.snk
248 |
249 | # Since there are multiple workflows, uncomment next line to ignore bower_components
250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
251 | #bower_components/
252 |
253 | # RIA/Silverlight projects
254 | Generated_Code/
255 |
256 | # Backup & report files from converting an old project file
257 | # to a newer Visual Studio version. Backup files are not needed,
258 | # because we have git ;-)
259 | _UpgradeReport_Files/
260 | Backup*/
261 | UpgradeLog*.XML
262 | UpgradeLog*.htm
263 | ServiceFabricBackup/
264 | *.rptproj.bak
265 |
266 | # SQL Server files
267 | *.mdf
268 | *.ldf
269 | *.ndf
270 |
271 | # Business Intelligence projects
272 | *.rdl.data
273 | *.bim.layout
274 | *.bim_*.settings
275 | *.rptproj.rsuser
276 | *- [Bb]ackup.rdl
277 | *- [Bb]ackup ([0-9]).rdl
278 | *- [Bb]ackup ([0-9][0-9]).rdl
279 |
280 | # Microsoft Fakes
281 | FakesAssemblies/
282 |
283 | # GhostDoc plugin setting file
284 | *.GhostDoc.xml
285 |
286 | # Node.js Tools for Visual Studio
287 | .ntvs_analysis.dat
288 | node_modules/
289 |
290 | # Visual Studio 6 build log
291 | *.plg
292 |
293 | # Visual Studio 6 workspace options file
294 | *.opt
295 |
296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
297 | *.vbw
298 |
299 | # Visual Studio LightSwitch build output
300 | **/*.HTMLClient/GeneratedArtifacts
301 | **/*.DesktopClient/GeneratedArtifacts
302 | **/*.DesktopClient/ModelManifest.xml
303 | **/*.Server/GeneratedArtifacts
304 | **/*.Server/ModelManifest.xml
305 | _Pvt_Extensions
306 |
307 | # Paket dependency manager
308 | .paket/paket.exe
309 | paket-files/
310 |
311 | # FAKE - F# Make
312 | .fake/
313 |
314 | # CodeRush personal settings
315 | .cr/personal
316 |
317 | # Python Tools for Visual Studio (PTVS)
318 | __pycache__/
319 | *.pyc
320 |
321 | # Cake - Uncomment if you are using it
322 | # tools/**
323 | # !tools/packages.config
324 |
325 | # Tabs Studio
326 | *.tss
327 |
328 | # Telerik's JustMock configuration file
329 | *.jmconfig
330 |
331 | # BizTalk build output
332 | *.btp.cs
333 | *.btm.cs
334 | *.odx.cs
335 | *.xsd.cs
336 |
337 | # OpenCover UI analysis results
338 | OpenCover/
339 |
340 | # Azure Stream Analytics local run output
341 | ASALocalRun/
342 |
343 | # MSBuild Binary and Structured Log
344 | *.binlog
345 |
346 | # NVidia Nsight GPU debugger configuration file
347 | *.nvuser
348 |
349 | # MFractors (Xamarin productivity tool) working folder
350 | .mfractor/
351 |
352 | # Local History for Visual Studio
353 | .localhistory/
354 |
355 | # BeatPulse healthcheck temp database
356 | healthchecksdb
357 |
358 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
359 | MigrationBackup/
360 |
361 | # Ionide (cross platform F# VS Code tools) working folder
362 | .ionide/
363 |
364 | # Fody - auto-generated XML schema
365 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/AddColorCode.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31515.178
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AddColorCode", "AddColorCode\AddColorCode.vcxproj", "{772BC0B9-7CA2-4EF5-9439-91D4F823156E}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77E9C1D4-FC85-44BA-981A-77402A637511}"
9 | ProjectSection(SolutionItems) = preProject
10 | CREDITS.md = CREDITS.md
11 | LICENSE = LICENSE
12 | README.md = README.md
13 | EndProjectSection
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|x64 = Debug|x64
18 | Debug|x86 = Debug|x86
19 | Release|x64 = Release|x64
20 | Release|x86 = Release|x86
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Debug|x64.ActiveCfg = Debug|x64
24 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Debug|x64.Build.0 = Debug|x64
25 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Debug|x86.ActiveCfg = Debug|Win32
26 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Debug|x86.Build.0 = Debug|Win32
27 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Release|x64.ActiveCfg = Release|x64
28 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Release|x64.Build.0 = Release|x64
29 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Release|x86.ActiveCfg = Release|Win32
30 | {772BC0B9-7CA2-4EF5-9439-91D4F823156E}.Release|x86.Build.0 = Release|Win32
31 | EndGlobalSection
32 | GlobalSection(SolutionProperties) = preSolution
33 | HideSolutionNode = FALSE
34 | EndGlobalSection
35 | GlobalSection(ExtensibilityGlobals) = postSolution
36 | SolutionGuid = {04F73712-35B3-45DC-891D-A4ADC727C31E}
37 | EndGlobalSection
38 | EndGlobal
39 |
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "AddColorCode.h"
3 | #include "resource.h"
4 |
5 | //--------------------------------------------------------------------
6 |
7 | // デバッグ用コールバック関数。デバッグメッセージを出力する
8 | void ___outputLog(LPCTSTR text, LPCTSTR output)
9 | {
10 | ::OutputDebugString(output);
11 | }
12 |
13 | //--------------------------------------------------------------------
14 |
15 | AviUtlInternal g_auin;
16 | HINSTANCE g_instance = 0;
17 | HWND g_hdlg = 0;
18 | POINT g_offset = { 0, 0 };
19 |
20 | BOOL* ColorDialog_CanHandleCommand = 0;
21 | int* ColorDialog_R = 0;
22 | int* ColorDialog_G = 0;
23 | int* ColorDialog_B = 0;
24 |
25 | //--------------------------------------------------------------------
26 |
27 | // ini ファイルから設定を読み込む。
28 | void loadProfile()
29 | {
30 | MY_TRACE(_T("loadProfile()\n"));
31 |
32 | TCHAR path[MAX_PATH];
33 | ::GetModuleFileName(g_instance, path, MAX_PATH);
34 | ::PathRenameExtension(path, _T(".ini"));
35 | MY_TRACE_TSTR(path);
36 |
37 | g_offset.x = ::GetPrivateProfileInt(_T("Settings"), _T("offset.x"), g_offset.x, path);
38 | g_offset.y = ::GetPrivateProfileInt(_T("Settings"), _T("offset.y"), g_offset.y, path);
39 |
40 | MY_TRACE_INT(g_offset.x);
41 | MY_TRACE_INT(g_offset.y);
42 | }
43 |
44 | // フックをセットする。
45 | void initHook()
46 | {
47 | MY_TRACE(_T("initHook()\n"));
48 |
49 | g_auin.initExEditAddress();
50 |
51 | DWORD exedit = g_auin.GetExEdit();
52 | if (!exedit) return;
53 |
54 | true_SetDIBitsToDevice = hookImportFunc(
55 | (HMODULE)exedit, "SetDIBitsToDevice", hook_SetDIBitsToDevice);
56 | MY_TRACE_HEX(true_SetDIBitsToDevice);
57 |
58 | castAddress(ColorDialog_CanHandleCommand, exedit + 0x134E64);
59 | castAddress(ColorDialog_R, exedit + 0x11F2D0);
60 | castAddress(ColorDialog_G, exedit + 0x11F0AC);
61 | castAddress(ColorDialog_B, exedit + 0x11F064);
62 |
63 | castAddress(true_ColorDialog_SetColor, exedit + 0x22420);
64 | castAddress(true_ColorDialog_UpdateColorCircle, exedit + 0x21300);
65 | castAddress(true_ColorDialog_UpdateControls, exedit + 0x216A0);
66 |
67 | true_ShowColorDialog = hookCall(exedit + 0x4D386, hook_ShowColorDialog);
68 | MY_TRACE_HEX(true_ShowColorDialog);
69 |
70 | // スポイト処理の ::GetPixel() をフックする。
71 | true_Dropper_GetPixel = hookAbsoluteCall(exedit + 0x22128, hook_Dropper_GetPixel);
72 | MY_TRACE_HEX(true_Dropper_GetPixel);
73 |
74 | DetourTransactionBegin();
75 | DetourUpdateThread(::GetCurrentThread());
76 |
77 | ATTACH_HOOK_PROC(ColorDialog_SetColor);
78 | ATTACH_HOOK_PROC(ColorDialog_UpdateColorCircle);
79 | ATTACH_HOOK_PROC(ColorDialog_UpdateControls);
80 |
81 | if (DetourTransactionCommit() == NO_ERROR)
82 | {
83 | MY_TRACE(_T("拡張編集のフックに成功しました\n"));
84 | }
85 | else
86 | {
87 | MY_TRACE(_T("拡張編集のフックに失敗しました\n"));
88 | }
89 | }
90 |
91 | // フックを解除する。
92 | void termHook()
93 | {
94 | MY_TRACE(_T("termHook()\n"));
95 | }
96 |
97 | //--------------------------------------------------------------------
98 |
99 | void updateColorCode(int r, int g, int b)
100 | {
101 | // フラグをセットしてからコントロールの値を更新する。
102 |
103 | *ColorDialog_CanHandleCommand = FALSE;
104 |
105 | TCHAR text[MAX_PATH] = {};
106 | ::StringCbPrintf(text, sizeof(text), _T("%02x%02x%02x"), r, g, b);
107 | ::SetDlgItemText(g_hdlg, 174, text);
108 |
109 | *ColorDialog_CanHandleCommand = TRUE;
110 | }
111 |
112 | //--------------------------------------------------------------------
113 |
114 | IMPLEMENT_HOOK_PROC_NULL(int, WINAPI, SetDIBitsToDevice, (
115 | _In_ HDC hdc, _In_ int xDest, _In_ int yDest, _In_ DWORD w, _In_ DWORD h, _In_ int xSrc, _In_ int ySrc,
116 | _In_ UINT StartScan, _In_ UINT cLines, _In_ CONST VOID * lpvBits, _In_ CONST BITMAPINFO * lpbmi, _In_ UINT ColorUse))
117 | {
118 | MY_TRACE(_T("SetDIBitsToDevice(%d, %d) 変更前\n"), xDest, yDest);
119 |
120 | // 描画位置をオフセットの分だけずらす。
121 |
122 | xDest += g_offset.x;
123 | yDest += g_offset.y;
124 |
125 | MY_TRACE(_T("SetDIBitsToDevice(%d, %d) 変更後\n"), xDest, yDest);
126 |
127 | return true_SetDIBitsToDevice(hdc, xDest, yDest, w, h, xSrc, ySrc, StartScan, cLines, lpvBits, lpbmi, ColorUse);
128 | }
129 |
130 | IMPLEMENT_HOOK_PROC_NULL(INT_PTR, CALLBACK, ColorDialogProc, (HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam))
131 | {
132 | switch (message)
133 | {
134 | case WM_INITDIALOG:
135 | {
136 | MY_TRACE(_T("WM_INITDIALOG\n"));
137 |
138 | g_hdlg = hdlg;
139 | MY_TRACE_HEX(g_hdlg);
140 |
141 | break;
142 | }
143 | case WM_COMMAND:
144 | {
145 | UINT code = HIWORD(wParam);
146 | UINT id = LOWORD(wParam);
147 | HWND sender = (HWND)lParam;
148 |
149 | // MY_TRACE(_T("WM_COMMAND, 0x%04X, 0x%04X, 0x%08X)\n"), code, id, sender);
150 |
151 | if (code == EN_UPDATE && id == IDC_COLOR_CODE && *ColorDialog_CanHandleCommand)
152 | {
153 | // エディットボックスのテキストを取得する。
154 | TCHAR text[MAX_PATH] = {};
155 | ::GetDlgItemText(hdlg, IDC_COLOR_CODE, text, MAX_PATH);
156 | MY_TRACE_TSTR(text);
157 |
158 | // テキスト内の数値開始位置へのオフセットを取得する。
159 | int offset = 0;
160 | if (text[0] == _T('#')) offset = 1;
161 |
162 | // テキストを数値に変換する。
163 | DWORD color = _tcstoul(text + offset, 0, 16);
164 | MY_TRACE_HEX(color);
165 |
166 | int r, g, b;
167 |
168 | if (::lstrlen(text + offset) > 3)
169 | {
170 | // rrggbb の形式の RGB を取得する。
171 | r = (color >> 16) & 0xff;
172 | g = (color >> 8) & 0xff;
173 | b = (color >> 0) & 0xff;
174 | }
175 | else
176 | {
177 | // rgb の形式の RGB を取得する。
178 | r = (color >> 8) & 0x0f;
179 | g = (color >> 4) & 0x0f;
180 | b = (color >> 0) & 0x0f;
181 |
182 | r |= r << 4;
183 | g |= g << 4;
184 | b |= b << 4;
185 | }
186 | MY_TRACE(_T("%d, %d, %d\n"), r, g, b);
187 |
188 | *ColorDialog_R = r;
189 | *ColorDialog_G = g;
190 | *ColorDialog_B = b;
191 | true_ColorDialog_SetColor(r, g, b);
192 | true_ColorDialog_UpdateColorCircle(hdlg);
193 | true_ColorDialog_UpdateControls(hdlg, r, g, b);
194 | }
195 |
196 | break;
197 | }
198 | case WM_LBUTTONDOWN:
199 | case WM_LBUTTONUP:
200 | case WM_MOUSEMOVE:
201 | {
202 | // マウス位置をオフセットの分だけずらす。
203 |
204 | POINT point = LP2PT(lParam);
205 | point.x -= g_offset.x;
206 | point.y -= g_offset.y;
207 | lParam = PT2LP(point);
208 |
209 | break;
210 | }
211 | }
212 |
213 | return true_ColorDialogProc(hdlg, message, wParam, lParam);
214 | }
215 |
216 | IMPLEMENT_HOOK_PROC_NULL(INT_PTR, CDECL, ShowColorDialog, (HINSTANCE instance, LPCSTR templateName, HWND parent, DLGPROC dialogProc))
217 | {
218 | MY_TRACE(_T("ShowColorDialog(0x%08X, %hs, 0x%08X, 0x%08X)\n"), instance, templateName, parent, dialogProc);
219 |
220 | if (::lstrcmpiA(templateName, "GET_COLOR") == 0)
221 | {
222 | MY_TRACE(_T("「色の選択」ダイアログをフックします\n"));
223 |
224 | true_ColorDialogProc = dialogProc;
225 | return true_ShowColorDialog(g_instance, templateName, parent, hook_ColorDialogProc);
226 | }
227 |
228 | return true_ShowColorDialog(instance, templateName, parent, dialogProc);
229 | }
230 |
231 | IMPLEMENT_HOOK_PROC_NULL(void, CDECL, ColorDialog_SetColor, (int r, int g, int b))
232 | {
233 | MY_TRACE(_T("ColorDialog_SetColor(%d, %d, %d)\n"), r, g, b);
234 |
235 | true_ColorDialog_SetColor(r, g, b);
236 |
237 | updateColorCode(r, g, b);
238 | }
239 |
240 | IMPLEMENT_HOOK_PROC_NULL(void, CDECL, ColorDialog_UpdateColorCircle, (HWND hdlg))
241 | {
242 | MY_TRACE(_T("ColorDialog_UpdateColorCircle(0x%08X)\n"), hdlg);
243 |
244 | true_ColorDialog_UpdateColorCircle(hdlg);
245 | }
246 |
247 | IMPLEMENT_HOOK_PROC_NULL(void, CDECL, ColorDialog_UpdateControls, (HWND hdlg, int r, int g, int b))
248 | {
249 | MY_TRACE(_T("ColorDialog_UpdateControls(0x%08X, %d, %d, %d)\n"), hdlg, r, g, b);
250 |
251 | true_ColorDialog_UpdateControls(hdlg, r, g, b);
252 |
253 | updateColorCode(r, g, b);
254 | }
255 |
256 | IMPLEMENT_HOOK_PROC_NULL(COLORREF, WINAPI, Dropper_GetPixel, (HDC _dc, int x, int y))
257 | {
258 | MY_TRACE(_T("Dropper_GetPixel(0x%08X, %d, %d)\n"), _dc, x, y);
259 |
260 | // すべてのモニタのすべての場所から色を抽出できるようにする。
261 |
262 | HWND hwnd = 0;
263 | POINT point; ::GetCursorPos(&point);
264 | ::LogicalToPhysicalPointForPerMonitorDPI(hwnd, &point);
265 | HDC dc = ::GetDC(hwnd);
266 | COLORREF color = ::GetPixel(dc, point.x, point.y);
267 | ::ReleaseDC(hwnd, dc);
268 | return color;
269 | }
270 |
271 | //--------------------------------------------------------------------
272 |
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | GetFilterTable @1
3 |
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | //--------------------------------------------------------------------
4 |
5 | DECLARE_HOOK_PROC(int, WINAPI, SetDIBitsToDevice, (
6 | _In_ HDC hdc, _In_ int xDest, _In_ int yDest, _In_ DWORD w, _In_ DWORD h, _In_ int xSrc, _In_ int ySrc,
7 | _In_ UINT StartScan, _In_ UINT cLines, _In_ CONST VOID * lpvBits, _In_ CONST BITMAPINFO * lpbmi, _In_ UINT ColorUse));
8 | DECLARE_HOOK_PROC(INT_PTR, CALLBACK, ColorDialogProc, (HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam));
9 | DECLARE_HOOK_PROC(INT_PTR, CDECL, ShowColorDialog, (HINSTANCE instance, LPCSTR templateName, HWND parent, DLGPROC dialogProc));
10 | DECLARE_HOOK_PROC(void, CDECL, ColorDialog_SetColor, (int r, int g, int b));
11 | DECLARE_HOOK_PROC(void, CDECL, ColorDialog_UpdateColorCircle, (HWND hdlg));
12 | DECLARE_HOOK_PROC(void, CDECL, ColorDialog_UpdateControls, (HWND hdlg, int r, int g, int b));
13 | DECLARE_HOOK_PROC(COLORREF, WINAPI, Dropper_GetPixel, (HDC dc, int x, int y));
14 |
15 | //--------------------------------------------------------------------
16 |
17 | void loadProfile();
18 | void initHook();
19 | void termHook();
20 |
21 | //--------------------------------------------------------------------
22 |
23 | extern AviUtlInternal g_auin;
24 | extern HINSTANCE g_instance;
25 |
26 | //--------------------------------------------------------------------
27 |
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hebiiro/AviUtl-Plugin-AddColorCode/f235ca16abfb7df32096d3940cf19fd89112cf1b/AddColorCode/AddColorCode.rc
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 16.0
23 | Win32Proj
24 | {772bc0b9-7ca2-4ef5-9439-91d4f823156e}
25 | AddColorCode
26 | 10.0
27 |
28 |
29 |
30 | DynamicLibrary
31 | true
32 | v142
33 | MultiByte
34 |
35 |
36 | DynamicLibrary
37 | false
38 | v142
39 | true
40 | MultiByte
41 |
42 |
43 | DynamicLibrary
44 | true
45 | v142
46 | MultiByte
47 |
48 |
49 | DynamicLibrary
50 | false
51 | v142
52 | true
53 | MultiByte
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | true
79 |
80 |
81 | false
82 |
83 |
84 | true
85 |
86 |
87 | false
88 |
89 |
90 |
91 | Level3
92 | true
93 | WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
94 | true
95 | Use
96 | pch.h
97 | ../../;../../AviUtl/aviutl_exedit_sdk/
98 | stdcpplatest
99 |
100 |
101 | Windows
102 | true
103 | false
104 | $(TargetName).def
105 | ../../
106 |
107 |
108 | copy /B /Y "$(TargetDir)$(TargetFileName)" "C:\AviUtl110_test\Plugins\$(TargetName).auf"
109 |
110 |
111 |
112 |
113 | Level3
114 | true
115 | true
116 | true
117 | WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
118 | true
119 | Use
120 | pch.h
121 | ../../;../../AviUtl/aviutl_exedit_sdk/
122 | stdcpplatest
123 |
124 |
125 | Windows
126 | true
127 | true
128 | DebugFull
129 | false
130 | $(TargetName).def
131 | ../../
132 |
133 |
134 | copy /B /Y "$(TargetDir)$(TargetFileName)" "C:\AviUtl110_test\Plugins\$(TargetName).auf"
135 |
136 |
137 |
138 |
139 | Level3
140 | true
141 | _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
142 | true
143 | Use
144 | pch.h
145 | ../../;../../AviUtl/aviutl_exedit_sdk/
146 | stdcpplatest
147 |
148 |
149 | Windows
150 | true
151 | false
152 | $(TargetName).def
153 | ../../
154 |
155 |
156 | copy /B /Y "$(TargetDir)$(TargetFileName)" "C:\AviUtl110_test\Plugins\$(TargetName).auf"
157 |
158 |
159 |
160 |
161 | Level3
162 | true
163 | true
164 | true
165 | NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
166 | true
167 | Use
168 | pch.h
169 | ../../;../../AviUtl/aviutl_exedit_sdk/
170 | stdcpplatest
171 |
172 |
173 | Windows
174 | true
175 | true
176 | DebugFull
177 | false
178 | $(TargetName).def
179 | ../../
180 |
181 |
182 | copy /B /Y "$(TargetDir)$(TargetFileName)" "C:\AviUtl110_test\Plugins\$(TargetName).auf"
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 | Create
245 | Create
246 | Create
247 | Create
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Common
7 |
8 |
9 | Common
10 |
11 |
12 | Common
13 |
14 |
15 | AviUtl\aviutl_plugin_sdk
16 |
17 |
18 | AviUtl\aviutl_exedit_sdk
19 |
20 |
21 | AviUtl\aviutl_exedit_sdk
22 |
23 |
24 | AviUtl\aviutl_exedit_sdk\aviutl
25 |
26 |
27 | AviUtl\aviutl_exedit_sdk\aviutl
28 |
29 |
30 | AviUtl\aviutl_exedit_sdk\aviutl
31 |
32 |
33 | AviUtl\aviutl_exedit_sdk\aviutl
34 |
35 |
36 | AviUtl\aviutl_exedit_sdk\aviutl
37 |
38 |
39 | AviUtl\aviutl_exedit_sdk\aviutl
40 |
41 |
42 | AviUtl\aviutl_exedit_sdk\aviutl
43 |
44 |
45 | AviUtl\aviutl_exedit_sdk\aviutl
46 |
47 |
48 | AviUtl\aviutl_exedit_sdk\aviutl
49 |
50 |
51 | AviUtl\aviutl_exedit_sdk\aviutl
52 |
53 |
54 | AviUtl\aviutl_exedit_sdk\aviutl
55 |
56 |
57 | AviUtl\aviutl_exedit_sdk\aviutl
58 |
59 |
60 | AviUtl\aviutl_exedit_sdk\aviutl
61 |
62 |
63 | AviUtl\aviutl_exedit_sdk\aviutl
64 |
65 |
66 | AviUtl\aviutl_exedit_sdk\aviutl
67 |
68 |
69 | AviUtl\aviutl_exedit_sdk\aviutl
70 |
71 |
72 | AviUtl\aviutl_exedit_sdk\aviutl
73 |
74 |
75 | AviUtl\aviutl_exedit_sdk\aviutl
76 |
77 |
78 | AviUtl\aviutl_exedit_sdk\aviutl
79 |
80 |
81 | AviUtl\aviutl_exedit_sdk\aviutl
82 |
83 |
84 | AviUtl\aviutl_exedit_sdk\aviutl
85 |
86 |
87 | AviUtl\aviutl_exedit_sdk\aviutl
88 |
89 |
90 | AviUtl\aviutl_exedit_sdk\aviutl
91 |
92 |
93 | AviUtl\aviutl_exedit_sdk\aviutl
94 |
95 |
96 | AviUtl\aviutl_exedit_sdk\exedit
97 |
98 |
99 | AviUtl\aviutl_exedit_sdk\exedit
100 |
101 |
102 | AviUtl\aviutl_exedit_sdk\exedit
103 |
104 |
105 | AviUtl\aviutl_exedit_sdk\exedit
106 |
107 |
108 | AviUtl\aviutl_exedit_sdk\exedit
109 |
110 |
111 | AviUtl\aviutl_exedit_sdk\exedit
112 |
113 |
114 | AviUtl\aviutl_exedit_sdk\exedit
115 |
116 |
117 | AviUtl\aviutl_exedit_sdk\exedit
118 |
119 |
120 | AviUtl\aviutl_exedit_sdk\exedit
121 |
122 |
123 | AviUtl\aviutl_exedit_sdk\exedit
124 |
125 |
126 | AviUtl\aviutl_exedit_sdk\exedit
127 |
128 |
129 | AviUtl\aviutl_exedit_sdk\exedit
130 |
131 |
132 | AviUtl\aviutl_exedit_sdk\exedit
133 |
134 |
135 | AviUtl\aviutl_exedit_sdk\exedit
136 |
137 |
138 | AviUtl\aviutl_exedit_sdk\exedit
139 |
140 |
141 | AviUtl\aviutl_exedit_sdk\exedit
142 |
143 |
144 | AviUtl\aviutl_exedit_sdk\exedit
145 |
146 |
147 | AviUtl\aviutl_exedit_sdk\exedit
148 |
149 |
150 | AviUtl\aviutl_exedit_sdk\exedit
151 |
152 |
153 | AviUtl\aviutl_exedit_sdk\exedit
154 |
155 |
156 | Framework
157 |
158 |
159 | Resource
160 |
161 |
162 |
163 |
164 |
165 |
166 | Framework
167 |
168 |
169 |
170 |
171 | {177f322b-85e3-40d8-98e7-bca29a16eb22}
172 |
173 |
174 | {ccbdac2b-65c9-4684-a044-c5fe957b3192}
175 |
176 |
177 | {a1238836-0150-43ea-bd93-0c03be34c4f4}
178 |
179 |
180 | {b98f1d9a-6111-4c06-817a-b1032afe5acb}
181 |
182 |
183 | {9b2744e4-89cd-43ee-af81-3cd65fe2b794}
184 |
185 |
186 | {ae9e66b6-7641-4bed-b8cd-f06a27ad4ba9}
187 |
188 |
189 | {7faf636f-5f8f-49c0-a430-76c416a4853c}
190 |
191 |
192 | {ea38b3f6-c5bd-42ad-ae1d-35b7abeb3f1f}
193 |
194 |
195 |
196 |
197 | Resource
198 |
199 |
200 |
201 |
202 | Framework
203 |
204 |
205 |
--------------------------------------------------------------------------------
/AddColorCode/AddColorCode_Filter.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "AddColorCode.h"
3 |
4 | //--------------------------------------------------------------------
5 | // フィルタ構造体のポインタを渡す関数
6 | //--------------------------------------------------------------------
7 | EXTERN_C FILTER_DLL* WINAPI GetFilterTable()
8 | {
9 | static TCHAR filterName[] = TEXT("カラーコード追加");
10 | static TCHAR filterInformation[] = TEXT("カラーコード追加 1.2.1 by 蛇色");
11 |
12 | static FILTER_DLL filter =
13 | {
14 | FILTER_FLAG_NO_CONFIG |
15 | FILTER_FLAG_ALWAYS_ACTIVE |
16 | FILTER_FLAG_DISP_FILTER |
17 | FILTER_FLAG_EX_INFORMATION,
18 | 0, 0,
19 | filterName,
20 | NULL, NULL, NULL,
21 | NULL, NULL,
22 | NULL, NULL, NULL,
23 | NULL,//func_proc,
24 | func_init,
25 | func_exit,
26 | NULL,
27 | NULL,//func_WndProc,
28 | NULL, NULL,
29 | NULL,
30 | NULL,
31 | filterInformation,
32 | NULL, NULL,
33 | NULL, NULL, NULL, NULL,
34 | NULL,
35 | };
36 |
37 | return &filter;
38 | }
39 |
40 | //--------------------------------------------------------------------
41 | // 初期化
42 | //--------------------------------------------------------------------
43 |
44 | BOOL func_init(FILTER *fp)
45 | {
46 | MY_TRACE(_T("func_init()\n"));
47 |
48 | loadProfile();
49 | initHook();
50 |
51 | return TRUE;
52 | }
53 |
54 | //--------------------------------------------------------------------
55 | // 終了
56 | //--------------------------------------------------------------------
57 | BOOL func_exit(FILTER *fp)
58 | {
59 | MY_TRACE(_T("func_exit()\n"));
60 |
61 | termHook();
62 |
63 | return TRUE;
64 | }
65 |
66 | //--------------------------------------------------------------------
67 |
68 | BOOL APIENTRY DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
69 | {
70 | switch (reason)
71 | {
72 | case DLL_PROCESS_ATTACH:
73 | {
74 | MY_TRACE(_T("DLL_PROCESS_ATTACH\n"));
75 |
76 | g_instance = instance;
77 |
78 | break;
79 | }
80 | case DLL_PROCESS_DETACH:
81 | {
82 | MY_TRACE(_T("DLL_PROCESS_DETACH\n"));
83 |
84 | break;
85 | }
86 | }
87 |
88 | return TRUE;
89 | }
90 |
91 | //--------------------------------------------------------------------
92 |
--------------------------------------------------------------------------------
/AddColorCode/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/AddColorCode/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define WIN32_LEAN_AND_MEAN
4 | #include
5 | #include
6 | #include
7 | #pragma comment(lib, "shlwapi.lib")
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 | #include
17 |
18 | #include "AviUtl/aviutl_plugin_sdk/filter.h"
19 | #include "AviUtl/aviutl_exedit_sdk/exedit.hpp"
20 | #include "Common/Tracer.h"
21 | #include "Common/WinUtility.h"
22 | #include "Common/Hook.h"
23 | #include "Common/AviUtlInternal.h"
24 | #include "Detours.4.0.1/detours.h"
25 | #pragma comment(lib, "Detours.4.0.1/detours.lib")
26 |
--------------------------------------------------------------------------------
/AddColorCode/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hebiiro/AviUtl-Plugin-AddColorCode/f235ca16abfb7df32096d3940cf19fd89112cf1b/AddColorCode/resource.h
--------------------------------------------------------------------------------
/CREDITS.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hebiiro/AviUtl-Plugin-AddColorCode/f235ca16abfb7df32096d3940cf19fd89112cf1b/CREDITS.md
--------------------------------------------------------------------------------
/Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | $(SolutionDir)_bin\
7 | $(SolutionDir)_obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\
8 |
9 |
10 |
11 | $(IntDir)
12 |
13 |
14 |
15 |
16 | $(IntDir)
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 hebiiro
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AviUtl プラグイン - カラーコード追加
2 |
3 | 色の選択ダイアログでカラーコードを使えるようにします。
4 | [最新バージョンをダウンロード](../../releases/latest/)
5 |
6 | 
7 |
8 | ## ダウンロード
9 |
10 | 1. ページ右側にある [Releases](/../../releases) をクリックして移動します。
11 | 2. ダウンロードしたいバージョンをクリックして移動します。
12 | 3. Assets の下に圧縮ファイルがあるのでクリックしてダウンロードします。
13 |
14 | ## 導入方法
15 |
16 | 1. 以下のファイルを AviUtl の Plugins フォルダに配置します。
17 | * AddColorCode.auf
18 | * AddColorCode.ini
19 |
20 | ## 使用方法
21 |
22 | 1. 色の選択ダイアログを表示します。
23 | 2. スポイトの横にエディットボックスが追加されているので、そこにカラーコードを入力します。
24 | * 先頭の # は無視されます。
25 | * rrggbb か rgb 形式の16進数文字列を指定できます。
26 |
27 | ## 設定方法
28 |
29 | AddColorCode.ini をテキストエディタで編集してから AviUtl を起動します。
30 |
31 | ```ini
32 | [Settings]
33 | offset.x=0 ; カラーピッカーの位置に与えるオフセットを指定します。
34 | offset.y=0
35 | ```
36 |
37 | ## 更新履歴
38 |
39 | * 1.2.1 - 2023/06/18 スポイトツールが正常に動作しない問題を修正
40 | * 1.2.0 - 2023/05/31 カラーピッカーの位置を変更できる機能を追加
41 | * 1.1.0 - 2022/06/01 カラーコードの変更が反映されない問題を修正
42 | * 1.0.0 - 2022/06/01 初版
43 |
44 | ## 動作確認
45 |
46 | * (必須) AviUtl 1.10 & 拡張編集 0.92 http://spring-fragrance.mints.ne.jp/aviutl/
47 | * (共存確認) patch.aul r42 https://scrapbox.io/ePi5131/patch.aul
48 |
49 | ## クレジット
50 |
51 | * Microsoft Research Detours Package https://github.com/microsoft/Detours
52 | * aviutl_exedit_sdk https://github.com/ePi5131/aviutl_exedit_sdk
53 | * Common Library https://github.com/hebiiro/Common-Library
54 |
55 | ## 作成者情報
56 |
57 | * 作成者 - 蛇色 (へびいろ)
58 | * GitHub - https://github.com/hebiiro
59 | * Twitter - https://twitter.com/io_hebiiro
60 |
61 | ## 免責事項
62 |
63 | この作成物および同梱物を使用したことによって生じたすべての障害・損害・不具合等に関しては、私と私の関係者および私の所属するいかなる団体・組織とも、一切の責任を負いません。各自の責任においてご使用ください。
64 |
--------------------------------------------------------------------------------