Commit d94d6c0f authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

открытие картинок формата WindowsHD Photo https://ru.wikipedia.org/wiki/JPEG_XR

ТОЛЬКО для windows систем, работа по unix/linux ЗАПРЕЩЕНА

открытие будет только по наличию в системе длл - windowcodecs.dll (net 3.5)

файл для теста Удивительная история рождения MS-Dos.docx

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57778 954022d7-b5bf-4e40-9824-e11837661b57
parent b5aba0d2
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
IgnoreImportLibrary="false" IgnoreImportLibrary="false"
AdditionalDependencies="graydither.lib Msimg32.lib" AdditionalDependencies="graydither.lib Msimg32.lib Windowscodecs.lib"
OutputFile="$(OutDir)/ASCImageFile3.dll" OutputFile="$(OutDir)/ASCImageFile3.dll"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="Libs" AdditionalLibraryDirectories="Libs"
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
IgnoreImportLibrary="false" IgnoreImportLibrary="false"
AdditionalDependencies="graydither.lib Msimg32.lib" AdditionalDependencies="graydither.lib Msimg32.lib Windowscodecs.lib"
OutputFile="$(OutDir)/ASCImageFile3.dll" OutputFile="$(OutDir)/ASCImageFile3.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="Libs" AdditionalLibraryDirectories="Libs"
......
...@@ -1155,6 +1155,12 @@ protected: ...@@ -1155,6 +1155,12 @@ protected:
ImageStudio::IO::Tga oReaderTga; ImageStudio::IO::Tga oReaderTga;
bLoading = oReaderTga.FromFile( sFilePath, nFormat, &oImage ); bLoading = oReaderTga.FromFile( sFilePath, nFormat, &oImage );
} }
else
if( eFileType ==_ImageFileFormats::c_Wdp)
{
ImageStudio::IO::Wdp oReaderWdp;
bLoading = oReaderWdp.FromFile( sFilePath, nFormat, &oImage );
}
else else
if( eFileType ==_ImageFileFormats::c_Pcx) if( eFileType ==_ImageFileFormats::c_Pcx)
{ {
......
...@@ -52,10 +52,10 @@ using namespace ATL; ...@@ -52,10 +52,10 @@ using namespace ATL;
#include "../../Common/VideoFileInterface.h" #include "../../Common/VideoFileInterface.h"
#import "../../Redist/ASCMediaCore3.dll" named_guids rename_namespace("MediaCore"), exclude("tagRECT") #import "../../Redist/ASCMediaCore3.dll" named_guids rename_namespace("MediaCore"), exclude("tagRECT") raw_interfaces_only
#import "../../Redist/ASCMediaFormatSettings3.dll" named_guids rename_namespace("MediaFormat"), exclude("tagRECT") #import "../../Redist/ASCMediaFormatSettings3.dll" named_guids rename_namespace("MediaFormat"), exclude("tagRECT") raw_interfaces_only
#import "../../Redist/ASCGraphics.dll" named_guids rename_namespace("AVSGraphics") #import "../../Redist/ASCGraphics.dll" named_guids rename_namespace("AVSGraphics") raw_interfaces_only
#import "../../Redist/ASCImageJpeg2000.dll" named_guids rename_namespace("Jpeg2000") #import "../../Redist/ASCImageJpeg2000.dll" named_guids rename_namespace("Jpeg2000") raw_interfaces_only
#ifndef NO_SWF_CHECKER #ifndef NO_SWF_CHECKER
#import "../../Redist/ASCSWFFile3.dll" named_guids rename_namespace("SWF") #import "../../Redist/ASCSWFFile3.dll" named_guids rename_namespace("SWF")
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//3 //3
//4 //4
//0 //0
//83 //90
#define INTVER 3,4,0,83 #define INTVER 3,4,0,90
#define STRVER "3,4,0,83\0" #define STRVER "3,4,0,90\0"
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
IgnoreImportLibrary="true" IgnoreImportLibrary="true"
AdditionalDependencies=" Msimg32.lib" AdditionalDependencies=" Msimg32.lib Windowscodecs.lib"
OutputFile="$(OutDir)/ASCImageStudio3.dll" OutputFile="$(OutDir)/ASCImageStudio3.dll"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="../Common/libs/Debug" AdditionalLibraryDirectories="../Common/libs/Debug"
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
Name="VCLinkerTool" Name="VCLinkerTool"
RegisterOutput="true" RegisterOutput="true"
IgnoreImportLibrary="true" IgnoreImportLibrary="true"
AdditionalDependencies=" Msimg32.lib" AdditionalDependencies=" Msimg32.lib Windowscodecs.lib"
OutputFile="$(OutDir)/ASCImageStudio3.dll" OutputFile="$(OutDir)/ASCImageStudio3.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\Common\libs\Release\" AdditionalLibraryDirectories="..\Common\libs\Release\"
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//3 //3
//4 //4
//0 //0
//82 //84
#define INTVER 3,4,0,82 #define INTVER 3,4,0,84
#define STRVER "3,4,0,82\0" #define STRVER "3,4,0,84\0"
...@@ -23,7 +23,8 @@ enum _ImageFileFormats ...@@ -23,7 +23,8 @@ enum _ImageFileFormats
c_Swf, c_Swf,
c_Wbz, c_Wbz,
c_Wbc, c_Wbc,
c_Svm c_Svm,
c_Wdp
}; };
struct _ImageFileExtension struct _ImageFileExtension
...@@ -87,7 +88,10 @@ static _ImageFileExtension tableSupportImageFormats[] = ...@@ -87,7 +88,10 @@ static _ImageFileExtension tableSupportImageFormats[] =
{_T("wbz"), c_Wbz}, {_T("wbz"), c_Wbz},
{_T("wbc"), c_Wbc}, {_T("wbc"), c_Wbc},
{_T("svm"), c_Svm}, {_T("svm"), c_Svm},
{_T("mj2"), c_Jpeg2000} {_T("mj2"), c_Jpeg2000},
{_T("wdp"), c_Wdp},
{_T("hdp"), c_Wdp},
{_T("jxr"), c_Wdp}
}; };
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#endif #endif
#include "Wincodec.h"
namespace ImageStudio namespace ImageStudio
{ {
...@@ -1385,6 +1387,78 @@ namespace ImageStudio ...@@ -1385,6 +1387,78 @@ namespace ImageStudio
return Utils::ToFile(pSourceImage, strFilePath, nFormat, TRUE, _T("image/gif"), NULL); return Utils::ToFile(pSourceImage, strFilePath, nFormat, TRUE, _T("image/gif"), NULL);
} }
}; };
#define DIB_WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
class Wdp
{
public:
virtual BOOL FromFile(const CString& strFilePath, int& nFormat, ImageStudio::Core::Image* pResultImage)
{
IWICImagingFactory *m_pIWICFactory = NULL;
HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&m_pIWICFactory));
if (hr || m_pIWICFactory ==NULL) return FALSE;
IWICBitmapDecoder *pDecoder = NULL;
hr = m_pIWICFactory->CreateDecoderFromFilename(strFilePath, &CLSID_WICWmpDecoder,GENERIC_READ,WICDecodeMetadataCacheOnDemand,&pDecoder);
IWICBitmapFrameDecode *pFrame = NULL;
if (SUCCEEDED(hr && pDecoder))
{
hr = pDecoder->GetFrame(0, &pFrame);
pDecoder->Release();
}
UINT Width =0, Height =0;
IWICFormatConverter *m_pConvertedFrame = NULL;
if (pFrame)
{
m_pIWICFactory->CreateFormatConverter(&m_pConvertedFrame);
m_pConvertedFrame->Initialize(
pFrame, // Source frame to convert
GUID_WICPixelFormat32bppBGR, // The desired pixel format
WICBitmapDitherTypeNone, // The desired dither pattern
NULL, // The desired palette
0.f, // The desired alpha threshold
WICBitmapPaletteTypeCustom // Palette translation type
);
pFrame->GetSize(&Width, &Height);
pFrame->Release();
}
IMediaFrame* pMediaFrame = NULL;
if (m_pConvertedFrame)
{
BYTE* pPixels = NULL;
pMediaFrame = CreateFrame( Width, Height, CSP_BGRA | CSP_VFLIP, &pPixels);
if( pFrame &&pPixels)
{
UINT nStride = DIB_WIDTHBYTES(Width * 32);
UINT nImage = nStride * Height;
m_pConvertedFrame->CopyPixels(NULL,nStride,nImage,pPixels);
}
m_pConvertedFrame->Release();
}
m_pIWICFactory->Release();
BOOL bRetValue = pResultImage->FromMediaData( (IUnknown *)pMediaFrame, FALSE );
RELEASEINTERFACE( pMediaFrame );
return bRetValue;
}
virtual BOOL ToFile(ImageStudio::Core::Image* pSourceImage, const CString& strFilePath, int nFormat)
{
return FALSE;
}
};
class Jpeg class Jpeg
{ {
public: public:
...@@ -1410,8 +1484,17 @@ namespace ImageStudio ...@@ -1410,8 +1484,17 @@ namespace ImageStudio
if( !pFile ) if( !pFile )
return FALSE; return FALSE;
BOOL bSuccess = SaveToFile( pFile, pSourceImage->GetBuffer(), pSourceImage->GetWidth(), pSourceImage->GetHeight(), pSourceImage->GetWidth() * 4, nQuality ); BYTE *pPixels = pSourceImage->GetBuffer();
BOOL bSuccess = FALSE;
if (pPixels)
{
bSuccess = SaveToFile( pFile, pSourceImage->GetBuffer(), pSourceImage->GetWidth(), pSourceImage->GetHeight(), pSourceImage->GetWidth() * 4, nQuality/*,SubSampling */);
}
else
{
bSuccess = SaveToFile( pFile, pSourceImage->GetMediaData().GetMediaData(FALSE), nQuality/*,SubSampling*/ );
}
fclose(pFile); fclose(pFile);
return bSuccess; return bSuccess;
...@@ -7145,16 +7228,16 @@ namespace ImageStudio ...@@ -7145,16 +7228,16 @@ namespace ImageStudio
int G = 128 - 100 * U - 208 * V; int G = 128 - 100 * U - 208 * V;
int B = 128 + 516 * U; int B = 128 + 516 * U;
dst[0] = IntToByte( (Y + B) >> 8 ); dst[0] = _IntToByte( (Y + B) >> 8 );
dst[1] = IntToByte( (Y + G) >> 8 ); dst[1] = _IntToByte( (Y + G) >> 8 );
dst[2] = IntToByte( (Y + R) >> 8 ); dst[2] = _IntToByte( (Y + R) >> 8 );
dst[3] = 255; dst[3] = 255;
Y = (int(src[3]) - 16) * 298; Y = (int(src[3]) - 16) * 298;
dst[4] = IntToByte( (Y + B) >> 8 ); dst[4] = _IntToByte( (Y + B) >> 8 );
dst[5] = IntToByte( (Y + G) >> 8 ); dst[5] = _IntToByte( (Y + G) >> 8 );
dst[6] = IntToByte( (Y + R) >> 8 ); dst[6] = _IntToByte( (Y + R) >> 8 );
dst[7] = 255; dst[7] = 255;
// //
...@@ -7166,16 +7249,16 @@ namespace ImageStudio ...@@ -7166,16 +7249,16 @@ namespace ImageStudio
G = 128 - 100 * U - 208 * V; G = 128 - 100 * U - 208 * V;
B = 128 + 516 * U; B = 128 + 516 * U;
dst[0 + nWidth * 4] = IntToByte( (Y + B) >> 8 ); dst[0 + nWidth * 4] = _IntToByte( (Y + B) >> 8 );
dst[1 + nWidth * 4] = IntToByte( (Y + G) >> 8 ); dst[1 + nWidth * 4] = _IntToByte( (Y + G) >> 8 );
dst[2 + nWidth * 4] = IntToByte( (Y + R) >> 8 ); dst[2 + nWidth * 4] = _IntToByte( (Y + R) >> 8 );
dst[3 + nWidth * 4] = 255; dst[3 + nWidth * 4] = 255;
Y = (int(src[3 + offset]) - 16) * 298; Y = (int(src[3 + offset]) - 16) * 298;
dst[4 + nWidth * 4] = IntToByte( (Y + B) >> 8 ); dst[4 + nWidth * 4] = _IntToByte( (Y + B) >> 8 );
dst[5 + nWidth * 4] = IntToByte( (Y + G) >> 8 ); dst[5 + nWidth * 4] = _IntToByte( (Y + G) >> 8 );
dst[6 + nWidth * 4] = IntToByte( (Y + R) >> 8 ); dst[6 + nWidth * 4] = _IntToByte( (Y + R) >> 8 );
dst[7 + nWidth * 4] = 255; dst[7 + nWidth * 4] = 255;
} }
} }
...@@ -7205,16 +7288,16 @@ namespace ImageStudio ...@@ -7205,16 +7288,16 @@ namespace ImageStudio
int G = 128 - 100 * U - 208 * V; int G = 128 - 100 * U - 208 * V;
int B = 128 + 516 * U; int B = 128 + 516 * U;
dst[0] = IntToByte( (Y + B) >> 8 ); dst[0] = _IntToByte( (Y + B) >> 8 );
dst[1] = IntToByte( (Y + G) >> 8 ); dst[1] = _IntToByte( (Y + G) >> 8 );
dst[2] = IntToByte( (Y + R) >> 8 ); dst[2] = _IntToByte( (Y + R) >> 8 );
dst[3] = 255; dst[3] = 255;
Y = (int(src[3]) - 16) * 298; Y = (int(src[3]) - 16) * 298;
dst[4] = IntToByte( (Y + B) >> 8 ); dst[4] = _IntToByte( (Y + B) >> 8 );
dst[5] = IntToByte( (Y + G) >> 8 ); dst[5] = _IntToByte( (Y + G) >> 8 );
dst[6] = IntToByte( (Y + R) >> 8 ); dst[6] = _IntToByte( (Y + R) >> 8 );
dst[7] = 255; dst[7] = 255;
} }
} }
...@@ -7245,30 +7328,30 @@ namespace ImageStudio ...@@ -7245,30 +7328,30 @@ namespace ImageStudio
int G = 128 - 100 * U - 208 * V; int G = 128 - 100 * U - 208 * V;
int B = 128 + 516 * U; int B = 128 + 516 * U;
dst[0] = IntToByte( (Y + B) >> 8 ); dst[0] = _IntToByte( (Y + B) >> 8 );
dst[1] = IntToByte( (Y + G) >> 8 ); dst[1] = _IntToByte( (Y + G) >> 8 );
dst[2] = IntToByte( (Y + R) >> 8 ); dst[2] = _IntToByte( (Y + R) >> 8 );
dst[3] = 255; dst[3] = 255;
Y = (int(pY[1]) - 16) * 298; Y = (int(pY[1]) - 16) * 298;
dst[4] = IntToByte( (Y + B) >> 8 ); dst[4] = _IntToByte( (Y + B) >> 8 );
dst[5] = IntToByte( (Y + G) >> 8 ); dst[5] = _IntToByte( (Y + G) >> 8 );
dst[6] = IntToByte( (Y + R) >> 8 ); dst[6] = _IntToByte( (Y + R) >> 8 );
dst[7] = 255; dst[7] = 255;
Y = (int(pY[0 + nWidth]) - 16) * 298; Y = (int(pY[0 + nWidth]) - 16) * 298;
dst[0 + nWidth * 4] = IntToByte( (Y + B) >> 8 ); dst[0 + nWidth * 4] = _IntToByte( (Y + B) >> 8 );
dst[1 + nWidth * 4] = IntToByte( (Y + G) >> 8 ); dst[1 + nWidth * 4] = _IntToByte( (Y + G) >> 8 );
dst[2 + nWidth * 4] = IntToByte( (Y + R) >> 8 ); dst[2 + nWidth * 4] = _IntToByte( (Y + R) >> 8 );
dst[3 + nWidth * 4] = 255; dst[3 + nWidth * 4] = 255;
Y = (int(pY[1 + nWidth]) - 16) * 298; Y = (int(pY[1 + nWidth]) - 16) * 298;
dst[4 + nWidth * 4] = IntToByte( (Y + B) >> 8 ); dst[4 + nWidth * 4] = _IntToByte( (Y + B) >> 8 );
dst[5 + nWidth * 4] = IntToByte( (Y + G) >> 8 ); dst[5 + nWidth * 4] = _IntToByte( (Y + G) >> 8 );
dst[6 + nWidth * 4] = IntToByte( (Y + R) >> 8 ); dst[6 + nWidth * 4] = _IntToByte( (Y + R) >> 8 );
dst[7 + nWidth * 4] = 255; dst[7 + nWidth * 4] = 255;
} }
} }
......
...@@ -352,9 +352,9 @@ namespace ImageStudio ...@@ -352,9 +352,9 @@ namespace ImageStudio
// nG = int(nG * dK + 0.5); // nG = int(nG * dK + 0.5);
// nB = int(nB * dK + 0.5); // nB = int(nB * dK + 0.5);
// pPixels[0] = IntToByte(nB); // pPixels[0] = _IntToByte(nB);
// pPixels[1] = IntToByte(nG); // pPixels[1] = _IntToByte(nG);
// pPixels[2] = IntToByte(nR); // pPixels[2] = _IntToByte(nR);
//} //}
/* */ /* */
...@@ -379,9 +379,9 @@ namespace ImageStudio ...@@ -379,9 +379,9 @@ namespace ImageStudio
nG = (nG * nK + 512) >> 10; nG = (nG * nK + 512) >> 10;
nB = (nB * nK + 512) >> 10; nB = (nB * nK + 512) >> 10;
pPixels[0] = IntToByte(nB); pPixels[0] = _IntToByte(nB);
pPixels[1] = IntToByte(nG); pPixels[1] = _IntToByte(nG);
pPixels[2] = IntToByte(nR); pPixels[2] = _IntToByte(nR);
} }
return ImageStudio::Transforms::Core::c_nErrorNone; return ImageStudio::Transforms::Core::c_nErrorNone;
...@@ -448,9 +448,9 @@ namespace ImageStudio ...@@ -448,9 +448,9 @@ namespace ImageStudio
// nG = int(nG * dK + 0.5); // nG = int(nG * dK + 0.5);
// nB = int(nB * dK + 0.5); // nB = int(nB * dK + 0.5);
// pPixels[0] = IntToByte(nB); // pPixels[0] = _IntToByte(nB);
// pPixels[1] = IntToByte(nG); // pPixels[1] = _IntToByte(nG);
// pPixels[2] = IntToByte(nR); // pPixels[2] = _IntToByte(nR);
//} //}
/* */ /* */
...@@ -477,9 +477,9 @@ namespace ImageStudio ...@@ -477,9 +477,9 @@ namespace ImageStudio
nG = (nG * nK + 512) >> 10; nG = (nG * nK + 512) >> 10;
nB = (nB * nK + 512) >> 10; nB = (nB * nK + 512) >> 10;
pPixels[0] = IntToByte(nB); pPixels[0] = _IntToByte(nB);
pPixels[1] = IntToByte(nG); pPixels[1] = _IntToByte(nG);
pPixels[2] = IntToByte(nR); pPixels[2] = _IntToByte(nR);
} }
return ImageStudio::Transforms::Core::c_nErrorNone; return ImageStudio::Transforms::Core::c_nErrorNone;
...@@ -802,9 +802,9 @@ namespace ImageStudio ...@@ -802,9 +802,9 @@ namespace ImageStudio
nG = int(nG * dFactor + dOffset); nG = int(nG * dFactor + dOffset);
nB = int(nB * dFactor + dOffset); nB = int(nB * dFactor + dOffset);
pPixels[0] = IntToByte(nB); pPixels[0] = _IntToByte(nB);
pPixels[1] = IntToByte(nG); pPixels[1] = _IntToByte(nG);
pPixels[2] = IntToByte(nR); pPixels[2] = _IntToByte(nR);
} }
return ImageStudio::Transforms::Core::c_nErrorNone; return ImageStudio::Transforms::Core::c_nErrorNone;
...@@ -891,9 +891,9 @@ namespace ImageStudio ...@@ -891,9 +891,9 @@ namespace ImageStudio
nG = int(nG * (nG * dFactor + dOffset)); nG = int(nG * (nG * dFactor + dOffset));
nB = int(nB * (nB * dFactor + dOffset)); nB = int(nB * (nB * dFactor + dOffset));
pPixels[0] = IntToByte(nB); pPixels[0] = _IntToByte(nB);
pPixels[1] = IntToByte(nG); pPixels[1] = _IntToByte(nG);
pPixels[2] = IntToByte(nR); pPixels[2] = _IntToByte(nR);
} }
return ImageStudio::Transforms::Core::c_nErrorNone; return ImageStudio::Transforms::Core::c_nErrorNone;
...@@ -1183,7 +1183,7 @@ namespace ImageStudio ...@@ -1183,7 +1183,7 @@ namespace ImageStudio
GetBValue(nColor), GetBValue(nColor),
GetGValue(nColor), GetGValue(nColor),
GetRValue(nColor), GetRValue(nColor),
IntToByte(alpha) _IntToByte(alpha)
}; };
IppiSize oImageSize = {nWidth, nHeight}; IppiSize oImageSize = {nWidth, nHeight};
...@@ -1867,7 +1867,7 @@ namespace ImageStudio ...@@ -1867,7 +1867,7 @@ namespace ImageStudio
if (nAlpha == 0 || dCompleteness < 0.0001) if (nAlpha == 0 || dCompleteness < 0.0001)
return c_nErrorNone; return c_nErrorNone;
double dAlpha = IntToByte( nAlpha ) / 255.0; double dAlpha = _IntToByte( nAlpha ) / 255.0;
if (dCompleteness >= 0.999 || nWidth < 2 || nHeight < 2) if (dCompleteness >= 0.999 || nWidth < 2 || nHeight < 2)
return BGRA_Fog( pBGRA, nWidth, nHeight, nColor, dAlpha ); return BGRA_Fog( pBGRA, nWidth, nHeight, nColor, dAlpha );
...@@ -3220,7 +3220,7 @@ namespace ImageStudio ...@@ -3220,7 +3220,7 @@ namespace ImageStudio
// Table[nIndex] = BYTE((unsigned)(nIndex * (255 + Level) + 127) * 0x8081u >> 23); // Table[nIndex] = BYTE((unsigned)(nIndex * (255 + Level) + 127) * 0x8081u >> 23);
//} //}
Table[nIndex] = IntToByte( nIndex + Level ); Table[nIndex] = _IntToByte( nIndex + Level );
} }
// apply table // apply table
...@@ -3247,9 +3247,9 @@ namespace ImageStudio ...@@ -3247,9 +3247,9 @@ namespace ImageStudio
// compose table // compose table
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
{ {
Table[2][i] = IntToByte( i + LevelR ); Table[2][i] = _IntToByte( i + LevelR );
Table[1][i] = IntToByte( i + LevelG ); Table[1][i] = _IntToByte( i + LevelG );
Table[0][i] = IntToByte( i + LevelB ); Table[0][i] = _IntToByte( i + LevelB );
} }
// apply table // apply table
...@@ -3278,7 +3278,7 @@ namespace ImageStudio ...@@ -3278,7 +3278,7 @@ namespace ImageStudio
// compose table // compose table
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
{ {
Table[i] = IntToByte( int(127.5 + (i - 127.5)*dLevel) ); Table[i] = _IntToByte( int(127.5 + (i - 127.5)*dLevel) );
} }
// apply table // apply table
...@@ -3588,9 +3588,9 @@ namespace ImageStudio ...@@ -3588,9 +3588,9 @@ namespace ImageStudio
// compose table // compose table
for( int i = 0; i < 256; ++i ) for( int i = 0; i < 256; ++i )
{ {
Table[2][i] = IntToByte(i + nDeltaRed); Table[2][i] = _IntToByte(i + nDeltaRed);
Table[1][i] = IntToByte(i + nDeltaGreen); Table[1][i] = _IntToByte(i + nDeltaGreen);
Table[0][i] = IntToByte(i + nDeltaBlue); Table[0][i] = _IntToByte(i + nDeltaBlue);
} }
// apply table // apply table
...@@ -3606,9 +3606,9 @@ namespace ImageStudio ...@@ -3606,9 +3606,9 @@ namespace ImageStudio
if( Type < 0 || Type > 3 ) if( Type < 0 || Type > 3 )
return c_nErrorNone; return c_nErrorNone;
Blue = IntToByte( Blue ); Blue = _IntToByte( Blue );
Green = IntToByte( Green ); Green = _IntToByte( Green );
Red = IntToByte( Red ); Red = _IntToByte( Red );
// color tables // color tables
BYTE oTableB[256]; BYTE oTableB[256];
...@@ -4062,9 +4062,9 @@ namespace ImageStudio ...@@ -4062,9 +4062,9 @@ namespace ImageStudio
g = int( (g - gray) * dLevel + g + 0.5 ); g = int( (g - gray) * dLevel + g + 0.5 );
r = int( (r - gray) * dLevel + r + 0.5 ); r = int( (r - gray) * dLevel + r + 0.5 );
src[0] = IntToByte( b ); src[0] = _IntToByte( b );
src[1] = IntToByte( g ); src[1] = _IntToByte( g );
src[2] = IntToByte( r ); src[2] = _IntToByte( r );
} }
return c_nErrorNone; return c_nErrorNone;
...@@ -6598,9 +6598,9 @@ namespace ImageStudio ...@@ -6598,9 +6598,9 @@ namespace ImageStudio
g += pBackup[1] * 31; g += pBackup[1] * 31;
r += pBackup[2] * 31; r += pBackup[2] * 31;
r = IntToByte( r ); r = _IntToByte( r );
g = IntToByte( g ); g = _IntToByte( g );
b = IntToByte( b ); b = _IntToByte( b );
int clr = Intensity2( r, g, b ) > level ? 255 : 0; int clr = Intensity2( r, g, b ) > level ? 255 : 0;
...@@ -6915,9 +6915,9 @@ namespace ImageStudio ...@@ -6915,9 +6915,9 @@ namespace ImageStudio
dSumV *= 0.25; dSumV *= 0.25;
// 8 YUV -> RGB // 8 YUV -> RGB
pPixel[nX * 4 + 0] = IntToByte( int(dSumY + 1.772 * dSumU) ); pPixel[nX * 4 + 0] = _IntToByte( int(dSumY + 1.772 * dSumU) );
pPixel[nX * 4 + 1] = IntToByte( int(dSumY - 0.34414 * dSumU - 0.71414 * dSumV) ); pPixel[nX * 4 + 1] = _IntToByte( int(dSumY - 0.34414 * dSumU - 0.71414 * dSumV) );
pPixel[nX * 4 + 2] = IntToByte( int(dSumY + 1.402 * dSumV) ); pPixel[nX * 4 + 2] = _IntToByte( int(dSumY + 1.402 * dSumV) );
} }
} }
} }
...@@ -7032,7 +7032,7 @@ namespace ImageStudio ...@@ -7032,7 +7032,7 @@ namespace ImageStudio
int nMaxLight = Round(dIntensity); int nMaxLight = Round(dIntensity);
for( int i = 0; i < 256; i++ ) for( int i = 0; i < 256; i++ )
{ {
oTable[i] = IntToByte(i + nMaxLight); oTable[i] = _IntToByte(i + nMaxLight);
} }
dAngle *= IPP_PI180; dAngle *= IPP_PI180;
...@@ -7091,9 +7091,9 @@ namespace ImageStudio ...@@ -7091,9 +7091,9 @@ namespace ImageStudio
g = int(g + t); g = int(g + t);
r = int(r + t); r = int(r + t);
pPixels[0] = IntToByte( b ); pPixels[0] = _IntToByte( b );
pPixels[1] = IntToByte( g ); pPixels[1] = _IntToByte( g );
pPixels[2] = IntToByte( r ); pPixels[2] = _IntToByte( r );
} }
} }
...@@ -7114,7 +7114,7 @@ namespace ImageStudio ...@@ -7114,7 +7114,7 @@ namespace ImageStudio
for( int i = 0; i < 256; i++ ) for( int i = 0; i < 256; i++ )
{ {
oTable[i] = IntToByte(i + nMaxLight); oTable[i] = _IntToByte(i + nMaxLight);
} }
dFeather = max(0, min(100, dFeather )) / 100.0; dFeather = max(0, min(100, dFeather )) / 100.0;
...@@ -7202,9 +7202,9 @@ namespace ImageStudio ...@@ -7202,9 +7202,9 @@ namespace ImageStudio
int disp = Round( t ); int disp = Round( t );
pPixels[0] = IntToByte( pPixels[0] + disp ); pPixels[0] = _IntToByte( pPixels[0] + disp );
pPixels[1] = IntToByte( pPixels[1] + disp ); pPixels[1] = _IntToByte( pPixels[1] + disp );
pPixels[2] = IntToByte( pPixels[2] + disp ); pPixels[2] = _IntToByte( pPixels[2] + disp );
} }
else else
{ {
...@@ -7255,9 +7255,9 @@ namespace ImageStudio ...@@ -7255,9 +7255,9 @@ namespace ImageStudio
int disp = Round( t ); int disp = Round( t );
pPixels[0] = IntToByte( pPixels[0] + disp ); pPixels[0] = _IntToByte( pPixels[0] + disp );
pPixels[1] = IntToByte( pPixels[1] + disp ); pPixels[1] = _IntToByte( pPixels[1] + disp );
pPixels[2] = IntToByte( pPixels[2] + disp ); pPixels[2] = _IntToByte( pPixels[2] + disp );
} }
} }
else else
...@@ -7282,9 +7282,9 @@ namespace ImageStudio ...@@ -7282,9 +7282,9 @@ namespace ImageStudio
int disp = Round( t ); int disp = Round( t );
pPixels[0] = IntToByte( pPixels[0] + disp ); pPixels[0] = _IntToByte( pPixels[0] + disp );
pPixels[1] = IntToByte( pPixels[1] + disp ); pPixels[1] = _IntToByte( pPixels[1] + disp );
pPixels[2] = IntToByte( pPixels[2] + disp ); pPixels[2] = _IntToByte( pPixels[2] + disp );
} }
} }
} }
...@@ -10036,7 +10036,7 @@ namespace ImageStudio ...@@ -10036,7 +10036,7 @@ namespace ImageStudio
GetBValue(nBackColor), GetBValue(nBackColor),
GetGValue(nBackColor), GetGValue(nBackColor),
GetRValue(nBackColor), GetRValue(nBackColor),
IntToByte(nBackAlpha), _IntToByte(nBackAlpha),
}; };
nDstStride -= nWidth * 4; nDstStride -= nWidth * 4;
...@@ -11376,9 +11376,9 @@ namespace ImageStudio ...@@ -11376,9 +11376,9 @@ namespace ImageStudio
g += c * 24615; g += c * 24615;
r += c * -714; r += c * -714;
pDst[0] = IntToByte( (b + 32768) >> 16 ); pDst[0] = _IntToByte( (b + 32768) >> 16 );
pDst[1] = IntToByte( (g + 32768) >> 16 ); pDst[1] = _IntToByte( (g + 32768) >> 16 );
pDst[2] = IntToByte( (r + 32768) >> 16 ); pDst[2] = _IntToByte( (r + 32768) >> 16 );
} }
break; break;
......
...@@ -1191,6 +1191,11 @@ namespace ImageStudio ...@@ -1191,6 +1191,11 @@ namespace ImageStudio
bLoading = IO::Utils::FromFile( sFilePath, nFormatOutput, oImage, nFrame, 0, 0, cxType ); bLoading = IO::Utils::FromFile( sFilePath, nFormatOutput, oImage, nFrame, 0, 0, cxType );
break; break;
} }
case c_Wdp:
{
ImageStudio::IO::Wdp oReaderWdp;
bLoading = oReaderWdp.FromFile( sFilePath, nFormatOutput, oImage);
}break;
case c_Psd: case c_Psd:
{ {
ImageStudio::IO::Psd oReaderPsd; ImageStudio::IO::Psd oReaderPsd;
......
This diff is collapsed.
...@@ -71,7 +71,7 @@ namespace ImageStudio ...@@ -71,7 +71,7 @@ namespace ImageStudio
return DWORD(value + 127) * 0x8081U >> 23; return DWORD(value + 127) * 0x8081U >> 23;
} }
inline int IntToByte( int value ) inline int _IntToByte( int value )
{ {
if( value < 0 ) value = 0; else if( value < 0 ) value = 0; else
if( value > 255 ) value = 255; if( value > 255 ) value = 255;
...@@ -89,7 +89,7 @@ namespace ImageStudio ...@@ -89,7 +89,7 @@ namespace ImageStudio
inline int RealToByte( double value ) inline int RealToByte( double value )
{ {
return IntToByte( RealToInt( value ) ); return _IntToByte( RealToInt( value ) );
} }
int ColorBlend( int dst, int src, double alpha ) int ColorBlend( int dst, int src, double alpha )
...@@ -98,7 +98,7 @@ namespace ImageStudio ...@@ -98,7 +98,7 @@ namespace ImageStudio
} }
Gdiplus::Color GetColor( int color, int alpha ) Gdiplus::Color GetColor( int color, int alpha )
{ {
return Gdiplus::Color( IntToByte(alpha), GetRValue(color), GetGValue(color), GetBValue(color) ); return Gdiplus::Color( _IntToByte(alpha), GetRValue(color), GetGValue(color), GetBValue(color) );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment