Commit 5b559b2b authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Исправлен баг с перевернутыми картинками. Исправлен баг с определением типа...

Исправлен баг с перевернутыми картинками. Исправлен баг с определением типа для стандартных 14 шрифтов. Реализовано чтение Jpeg2000.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62515 954022d7-b5bf-4e40-9824-e11837661b57
parent 10b32404
......@@ -42,7 +42,8 @@ Global
{29C4FC88-8442-46E1-A94B-6C3284DE13C0}.Release|Mixed Platforms.Build.0 = Release|Win32
{29C4FC88-8442-46E1-A94B-6C3284DE13C0}.Release|Win32.ActiveCfg = Release|Win32
{29C4FC88-8442-46E1-A94B-6C3284DE13C0}.Release|Win32.Build.0 = Release|Win32
{29C4FC88-8442-46E1-A94B-6C3284DE13C0}.Release|x64.ActiveCfg = Release|Win32
{29C4FC88-8442-46E1-A94B-6C3284DE13C0}.Release|x64.ActiveCfg = Release|x64
{29C4FC88-8442-46E1-A94B-6C3284DE13C0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -70,6 +70,9 @@
<IncludePath>../DesktopEditor/cximage/zlib;$(IncludePath)</IncludePath>
<LibraryPath>../DesktopEditor/cximage/zlib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ReferencePath>$(ReferencePath)</ReferencePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
......@@ -128,7 +131,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\DesktopEditor\agg-2.4\include;..\DesktopEditor\freetype-2.5.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\DesktopEditor\agg-2.4\include;..\DesktopEditor\freetype-2.5.2\include;..\DesktopEditor\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
......
......@@ -44,10 +44,12 @@ void ConvertFolder(PdfReader::CPdfReader& oReader, std::wstring wsFolderPath)
if (oReader.LoadFromFile(wsFilePath.c_str(), NULL, NULL, NULL))
{
int nPagesCount = oReader.GetPagesCount();
for (int nPageIndex = 0; nPageIndex < nPagesCount; nPageIndex++)
{
std::wstring wsDstFilePath = wsFilePathName + L"_" + std::to_wstring(nPageIndex) + L".png";
oReader.ConvertToRaster(nPageIndex, wsDstFilePath.c_str(), 4);
printf("%d of %d %S page %d / %d\n", nIndex, vFiles.size(), vFiles.at(nIndex).c_str(), nPageIndex, nPagesCount);
}
oReader.Close();
}
......
......@@ -133,6 +133,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\DesktopEditor\freetype-2.5.2\include;..\..\DesktopEditor\agg-2.4\include;..\..\DesktopEditor\cximage\zlib</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......
......@@ -390,8 +390,12 @@ namespace PdfReader
if (m_pGlobalParams && m_seName)
{
if (bBuiltin)
{
if (!GetEmbeddedFontFileRef(&m_oEmbFontFileRef))
{
m_wsExternalFontFilePath = m_pGlobalParams->GetBuiltinFontPath(m_seName);
m_eType = fontType1;
}
}
else
{
......
#include "MemoryUtils.h"
#include "JPXStream.h"
#include "File.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
#pragma comment(lib, "graphics.lib")
namespace PdfReader
{
......@@ -67,79 +72,48 @@ namespace PdfReader
fclose(pTempFile);
}
// TODO: Jpeg2000 DesktopEditor
CBgraFrame oFrame;
if (!oFrame.OpenFile(wsTempFile, _CXIMAGE_FORMAT_JP2))
{
NSFile::CFileBinary::Remove(wsTempFile);
return;
}
////
//MediaCore::IAVSUncompressedVideoFrame *pImageMediaData = NULL;
//CoCreateInstance(MediaCore::CLSID_CAVSMediaData, NULL, CLSCTX_ALL, MediaCore::IID_IAVSMediaData, (void**)(&pImageMediaData));
//if (!pImageMediaData)
//{
// _wunlink(wsTempFile.GetBuffer());
// return;
//}
////
//AVSImageJpeg2000::IJ2kFile *pJpeg = NULL;
//CoCreateInstance(__uuidof(AVSImageJpeg2000::CJ2kFile), NULL, CLSCTX_INPROC_SERVER, __uuidof(AVSImageJpeg2000::IJ2kFile), (void **)(&pJpeg));
//if (!pJpeg)
//{
// _wunlink(wsTempFile.GetBuffer());
// RELEASEINTERFACE(pImageMediaData);
// return;
//}
//IUnknown **ppImage = (IUnknown**)&pImageMediaData;
//pJpeg->J2kToInterface(wsTempFile.GetBuffer(), ppImage, L"<Jpeg2000-Options><OpenOptions><ConvertToRGBA value=\"0\"/></OpenOptions></Jpeg2000-Options>");
////
//_wunlink(wsTempFile.GetBuffer());
//if (NULL == ppImage || NULL == (*ppImage))
//{
// RELEASEINTERFACE(pImageMediaData);
// RELEASEINTERFACE(pJpeg);
// return;
//}
//MediaCore::IAVSUncompressedVideoFrame* pMediaDataIn = NULL;
//(*ppImage)->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)(&pMediaDataIn));
//if (NULL == pMediaDataIn)
//{
// RELEASEINTERFACE(pImageMediaData);
// RELEASEINTERFACE(pJpeg);
// return;
//}
//LONG lWidth = 0; pMediaDataIn->get_Width(&lWidth);
//LONG lHeight = 0; pMediaDataIn->get_Height(&lHeight);
//LONG lAspectX = 0; pMediaDataIn->get_AspectRatioX(&lAspectX);
//LONG lAspectY = 0; pMediaDataIn->get_AspectRatioY(&lAspectY);
//LONG lStride = 0; pMediaDataIn->get_Stride(0, &lStride);
//unsigned char *pBufferPointer = NULL; pMediaDataIn->get_BufferSize(&m_lBufferSize);
//pMediaDataIn->get_Buffer(&pBufferPointer);
////
//m_pSourceBuffer = (unsigned char*)MemUtilsMalloc(m_lBufferSize);
//if (!m_pSourceBuffer)
//{
// m_lBufferSize = 0;
// RELEASEINTERFACE(pMediaDataIn);
// RELEASEINTERFACE(pImageMediaData);
// RELEASEINTERFACE(pJpeg);
// return;
//}
////
//for (int nY = 0; nY < lHeight; nY++)
//{
// ::memcpy(m_pSourceBuffer + lStride * nY, pBufferPointer + lStride * (lHeight - nY - 1), lStride);
//}
////
//RELEASEINTERFACE(pMediaDataIn);
//RELEASEINTERFACE(pJpeg);
//RELEASEINTERFACE(pImageMediaData);
oFrame.SaveFile(L"D://Test Files//test.jp2", _CXIMAGE_FORMAT_JP2);
int nHeight = oFrame.get_Height();
int nWidth = oFrame.get_Width();
int nStride = oFrame.get_Stride();
BYTE* pBufferPointer = oFrame.get_Data();
m_lBufferSize = 3 * nWidth * nHeight;
m_pSourceBuffer = (unsigned char*)MemUtilsMalloc(m_lBufferSize);
if (!m_pSourceBuffer)
{
NSFile::CFileBinary::Remove(wsTempFile);
m_lBufferSize = 0;
return;
}
unsigned char* pDst = m_pSourceBuffer;
for (int nY = 0; nY < nHeight; nY++)
{
unsigned char* pSrc = pBufferPointer + nWidth * 4 * (nHeight - nY - 1);
for (int nX = 0; nX < nWidth; nX++)
{
pDst[0] = pSrc[2];
pDst[1] = pSrc[1];
pDst[2] = pSrc[0];
pDst += 3;
pSrc += 4;
}
}
NSFile::CFileBinary::Remove(wsTempFile);
}
void JPXStream::Close()
......
......@@ -20,7 +20,6 @@
// 2. m_pRenderer->SetAdditionalParam(L"TilingHtmlPattern", oWriter.GetXmlString());
// 3. GlobalParams->FindFontFile
// 4.
// 5. Jpeg2000
namespace PdfReader
{
......@@ -3095,7 +3094,7 @@ namespace PdfReader
return;
Aggplus::CImage oImage;
oImage.Create(pBufferPtr, nWidth, nHeight, 4 * nWidth);
oImage.Create(pBufferPtr, nWidth, nHeight, -4 * nWidth);
// pBufferPtr
ImageStream *pImageStream = new ImageStream(pStream, nWidth, 1, 1);
......@@ -3154,7 +3153,7 @@ namespace PdfReader
return;
Aggplus::CImage oImage;
oImage.Create(pBufferPtr, nWidth, nHeight, 4 * nWidth);
oImage.Create(pBufferPtr, nWidth, nHeight, -4 * nWidth);
// pBufferPtr
ImageStream *pImageStream = new ImageStream(pStream, nWidth, pColorMap->GetComponentsCount(), pColorMap->GetBitsPerComponent());
......@@ -3216,7 +3215,7 @@ namespace PdfReader
return;
Aggplus::CImage oImage;
oImage.Create(pBufferPtr, nWidth, nHeight, 4 * nWidth);
oImage.Create(pBufferPtr, nWidth, nHeight, -4 * nWidth);
// pBufferPtr
ImageStream *pImageStream = new ImageStream(pStream, nWidth, pColorMap->GetComponentsCount(), pColorMap->GetBitsPerComponent());
......@@ -3280,7 +3279,7 @@ namespace PdfReader
return;
Aggplus::CImage oImage;
oImage.Create(pBufferPtr, nWidth, nHeight, 4 * nWidth);
oImage.Create(pBufferPtr, nWidth, nHeight, -4 * nWidth);
// pBufferPtr
ImageStream *pImageStream = new ImageStream(pStream, nWidth, pColorMap->GetComponentsCount(), pColorMap->GetBitsPerComponent());
......
......@@ -463,6 +463,11 @@ namespace PdfReader
nLen = 0;
nWidth = uArg.iValue;
break;
default:
sTemp = sBuffer;
nLen = 0;
nWidth = uArg.iValue;
break;
}
// ,
if (!bReverseAlign && nLen < nWidth)
......
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