mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Generate theme images in 'cache' directory, allow PNG source images
This commit is contained in:
parent
f66b91931b
commit
1f0d2dcc82
4 changed files with 90 additions and 62 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "BeefySysLib/util/Array.h"
|
||||
#include "BeefySysLib/img/PSDReader.h"
|
||||
#include "BeefySysLib/img/PNGData.h"
|
||||
#include <direct.h>
|
||||
|
||||
USING_NS_BF;
|
||||
|
||||
|
@ -133,10 +134,28 @@ int main()
|
|||
else
|
||||
fileName = "UI_4.psd";
|
||||
|
||||
if (!FileExists(fileName))
|
||||
{
|
||||
if (!isThemeDir)
|
||||
continue;
|
||||
|
||||
fileName.RemoveFromEnd(3);
|
||||
fileName += "png";
|
||||
if (!FileExists(fileName))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName.EndsWith(".png"))
|
||||
{
|
||||
PNGData* pngData = new PNGData();
|
||||
if (pngData->LoadFromFile(fileName))
|
||||
{
|
||||
imageData = pngData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!reader.Init(fileName))
|
||||
{
|
||||
if (size == 0)
|
||||
|
@ -164,6 +183,7 @@ int main()
|
|||
}
|
||||
|
||||
imageData = reader.ReadImageData();
|
||||
|
||||
if (imageData == NULL)
|
||||
{
|
||||
ImageData* rawImageData = reader.MergeLayers(NULL, layerIndices, NULL);;
|
||||
|
@ -181,15 +201,16 @@ int main()
|
|||
delete rawImageData;
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// PNGData pngData;
|
||||
// pngData.mWidth = imageData->mWidth;
|
||||
// pngData.mHeight = imageData->mHeight;
|
||||
// pngData.mBits = imageData->mBits;
|
||||
// pngData.WriteToFile("c:\\temp\\test.png");
|
||||
// pngData.mBits = NULL;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PNGData pngData;
|
||||
// pngData.mWidth = imageData->mWidth;
|
||||
// pngData.mHeight = imageData->mHeight;
|
||||
// pngData.mBits = imageData->mBits;
|
||||
// pngData.WriteToFile("c:\\temp\\test.png");
|
||||
// pngData.mBits = NULL;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,6 +286,9 @@ int main()
|
|||
return false;
|
||||
};
|
||||
|
||||
if (isThemeDir)
|
||||
_mkdir("cache");
|
||||
|
||||
for (int size = 0; size < 3; size++)
|
||||
{
|
||||
int scale = 1 << size;
|
||||
|
@ -284,11 +308,11 @@ int main()
|
|||
if (isThemeDir)
|
||||
{
|
||||
if (size == 0)
|
||||
fileName = "UI.png";
|
||||
fileName = "cache/UI.png";
|
||||
else if (size == 1)
|
||||
fileName = "UI_2.png";
|
||||
fileName = "cache/UI_2.png";
|
||||
else
|
||||
fileName = "UI_4.png";
|
||||
fileName = "cache/UI_4.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -42,13 +42,13 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
BIN
IDE/dist/images/ImgCreate.exe
vendored
BIN
IDE/dist/images/ImgCreate.exe
vendored
Binary file not shown.
|
@ -491,20 +491,24 @@ namespace IDE
|
|||
for (int scale < 3)
|
||||
{
|
||||
String srcImgPath = scope .(absPath);
|
||||
String srcImgPath2 = scope .(absPath);
|
||||
String destImgPath = scope .(absPath);
|
||||
switch (scale)
|
||||
{
|
||||
case 0:
|
||||
srcImgPath.Append("UI.psd");
|
||||
destImgPath.Append("UI.png");
|
||||
srcImgPath2.Append("UI.png");
|
||||
destImgPath.Append("cache/UI.png");
|
||||
case 1:
|
||||
srcImgPath.Append("UI_2.psd");
|
||||
destImgPath.Append("UI_2.png");
|
||||
srcImgPath2.Append("UI_2.png");
|
||||
destImgPath.Append("cache/UI_2.png");
|
||||
case 2:
|
||||
srcImgPath.Append("UI_4.psd");
|
||||
destImgPath.Append("UI_2.png");
|
||||
srcImgPath2.Append("UI_2.png");
|
||||
destImgPath.Append("cache/UI_2.png");
|
||||
}
|
||||
maxSrcImgTime = Math.Max(maxSrcImgTime, File.GetLastWriteTime(srcImgPath).GetValueOrDefault());
|
||||
maxSrcImgTime = Math.Max(maxSrcImgTime, Math.Max(File.GetLastWriteTime(srcImgPath).GetValueOrDefault(), File.GetLastWriteTime(srcImgPath2).GetValueOrDefault()));
|
||||
let destImageTime = File.GetLastWriteTime(destImgPath).GetValueOrDefault();
|
||||
if (scale == 0)
|
||||
minDestImgTime = destImageTime;
|
||||
|
@ -543,9 +547,9 @@ namespace IDE
|
|||
String imgPath = scope .(absPath);
|
||||
switch (scale)
|
||||
{
|
||||
case 0: imgPath.Append("UI.png");
|
||||
case 1: imgPath.Append("UI_2.png");
|
||||
case 2: imgPath.Append("UI_4.png");
|
||||
case 0: imgPath.Append("cache/UI.png");
|
||||
case 1: imgPath.Append("cache/UI_2.png");
|
||||
case 2: imgPath.Append("cache/UI_4.png");
|
||||
}
|
||||
|
||||
if (File.Exists(imgPath))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue