diff --git a/.gitattributes b/.gitattributes index cf1815723a..c9c18efa88 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3035,7 +3035,7 @@ DesktopEditor/mac_build/raster/raster.xcodeproj/project.xcworkspace/xcuserdata/a DesktopEditor/mac_build/raster/raster.xcodeproj/xcuserdata svnc_tsvn_003alogminsize=5 DesktopEditor/mac_build/raster/raster.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5 DesktopEditor/mac_build/raster/raster.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad/xcschemes svnc_tsvn_003alogminsize=5 -DesktopEditor/raster/Metafile svnc_tsvn_003alogminsize=5 +DesktopEditor/raster/Metafile svnc_tsvn_003alogminsize=5 svn_global_002dignores DesktopEditor/raster/Metafile/Emf svnc_tsvn_003alogminsize=5 DesktopEditor/raster/Metafile/Wmf svnc_tsvn_003alogminsize=5 DoctRenderer/COMMON/Dlls/AVSGraphics.dll svn_mime_002dtype=application%2Foctet-stream diff --git a/.gitsvnattributes/DesktopEditor/raster/Metafile/svn_global_002dignores b/.gitsvnattributes/DesktopEditor/raster/Metafile/svn_global_002dignores new file mode 100644 index 0000000000..839447fe24 --- /dev/null +++ b/.gitsvnattributes/DesktopEditor/raster/Metafile/svn_global_002dignores @@ -0,0 +1,6 @@ +*.sdf +*.user +Debug +x64 +Metafile.opensdf +Metafile.v12.suo diff --git a/DesktopEditor/raster/Metafile/Metafile.sln b/DesktopEditor/raster/Metafile/Metafile.sln new file mode 100644 index 0000000000..d246a98c35 --- /dev/null +++ b/DesktopEditor/raster/Metafile/Metafile.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Metafile", "Metafile.vcxproj", "{E0341CD3-CFC0-4544-9DBA-31781C259DBF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|Win32.ActiveCfg = Debug|Win32 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|Win32.Build.0 = Debug|Win32 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|x64.ActiveCfg = Debug|x64 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|x64.Build.0 = Debug|x64 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|Win32.ActiveCfg = Release|Win32 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|Win32.Build.0 = Release|Win32 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|x64.ActiveCfg = Release|x64 + {E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DesktopEditor/raster/Metafile/Metafile.vcxproj b/DesktopEditor/raster/Metafile/Metafile.vcxproj new file mode 100644 index 0000000000..be1502eec4 --- /dev/null +++ b/DesktopEditor/raster/Metafile/Metafile.vcxproj @@ -0,0 +1,189 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {E0341CD3-CFC0-4544-9DBA-31781C259DBF} + Win32Proj + Metafile + + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + true + ..\..\agg-2.4\include;..\..\freetype-2.5.2\include;..\..\cximage\jasper\include;..\..\cximage\jpeg;..\..\cximage\png;..\..\cximage\zlib;%(AdditionalIncludeDirectories) + + + Console + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + true + ..\..\agg-2.4\include;..\..\freetype-2.5.2\include;..\..\cximage\jasper\include;..\..\cximage\jpeg;..\..\cximage\png;..\..\cximage\zlib;%(AdditionalIncludeDirectories) + 4005;4018 + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS + true + ..\..\agg-2.4\include;..\..\freetype-2.5.2\include;..\..\cximage\jasper\include;..\..\cximage\jpeg;..\..\cximage\png;..\..\cximage\zlib;%(AdditionalIncludeDirectories) + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DesktopEditor/raster/Metafile/Metafile.vcxproj.filters b/DesktopEditor/raster/Metafile/Metafile.vcxproj.filters new file mode 100644 index 0000000000..b1f4f3bcc6 --- /dev/null +++ b/DesktopEditor/raster/Metafile/Metafile.vcxproj.filters @@ -0,0 +1,126 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d2706d5c-ed10-4c43-bbb2-211400bb40ac} + + + {4c9bc033-8ce8-4711-9c98-6a7605147e5f} + + + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Wmf + + + Header Files + + + Emf + + + Emf + + + Emf + + + Header Files + + + Emf + + + Emf + + + Emf + + + Resource Files + + + Emf + + + Emf + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Emf + + + Emf + + + Emf + + + Emf + + + \ No newline at end of file diff --git a/DesktopEditor/raster/Metafile/TestMain.cpp b/DesktopEditor/raster/Metafile/TestMain.cpp new file mode 100644 index 0000000000..297b9187a7 --- /dev/null +++ b/DesktopEditor/raster/Metafile/TestMain.cpp @@ -0,0 +1,81 @@ +//#define _CRTDBG_LEAK_CHECK_DF + +#include "stdafx.h" + +#include "../../fontengine/ApplicationFonts.h" +#include "MetaFile.h" + +#include +#include + +using namespace MetaFile; + +std::vector GetAllFilesInFolder(std::wstring wsFolder, std::wstring wsExt) +{ + std::vector vwsNames; + + std::wstring wsSearchPath = wsFolder; + wsSearchPath.append(L"*."); + wsSearchPath.append(wsExt); + + WIN32_FIND_DATA oFindData; + HANDLE hFind = ::FindFirstFile(wsSearchPath.c_str(), &oFindData); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + if (!(oFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + vwsNames.push_back(oFindData.cFileName); + } + } while (::FindNextFile(hFind, &oFindData)); + ::FindClose(hFind); + } + return vwsNames; +} +void ConvertFile(CMetaFile &oMetaFile, std::wstring wsFilePath) +{ + oMetaFile.Close(); + + std::wstring wsDstFilePath = (wsFilePath.substr(0, wsFilePath.size() - 3)).append(L"jpg"); + if (oMetaFile.LoadFromFile(wsFilePath.c_str())) + { + oMetaFile.ConvertToRaster(wsDstFilePath.c_str(), 4, 1000); + } +} +void ConvertFolder(CMetaFile &oMetaFile, std::wstring wsFolderPath) +{ + oMetaFile.Close(); + + std::vector vFiles = GetAllFilesInFolder(wsFolderPath, L"emf"); + for (int nIndex = 0; nIndex < vFiles.size(); nIndex++) + { + std::wstring wsFilePath = wsFolderPath; + wsFilePath.append(vFiles.at(nIndex)); + if (oMetaFile.LoadFromFile(wsFilePath.c_str())) + { + std::wstring wsDstFilePath = (wsFilePath.substr(0, wsFilePath.size() - 3)).append(L"jpg"); + oMetaFile.ConvertToRaster(wsDstFilePath.c_str(), 4, 1000); + oMetaFile.Close(); + } + + printf("%d of %d %S\n", nIndex, vFiles.size(), vFiles.at(nIndex).c_str()); + } +} + +void Test() +{ + CApplicationFonts oFonts; + oFonts.Initialize(); + + CMetaFile oMetaFile(&oFonts); + //ConvertFile(oMetaFile, L"D://Test Files//fulltest.wmf"); + ConvertFolder(oMetaFile, L"D://Test Files//Bugs//"); +} + +void main() +{ + Test(); + //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + //_CrtDumpMemoryLeaks(); +} \ No newline at end of file diff --git a/DesktopEditor/raster/Metafile/stdafx.cpp b/DesktopEditor/raster/Metafile/stdafx.cpp new file mode 100644 index 0000000000..1577c4e3bc --- /dev/null +++ b/DesktopEditor/raster/Metafile/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" \ No newline at end of file diff --git a/DesktopEditor/raster/Metafile/stdafx.h b/DesktopEditor/raster/Metafile/stdafx.h new file mode 100644 index 0000000000..af6b9c290f --- /dev/null +++ b/DesktopEditor/raster/Metafile/stdafx.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +#pragma comment(lib, "../../Qt_build/graphics/project/debug/graphics.lib") \ No newline at end of file