From 09f6c3f4e81933872ba7949ced556d58c20e9788 Mon Sep 17 00:00:00 2001 From: SergeyLuzyanin Date: Tue, 29 May 2018 19:03:58 +0300 Subject: [PATCH] . --- .../fontengine/ApplicationFontsWorker.cpp | 27 ++++---- DesktopEditor/graphics/Graphics.h | 22 +------ DesktopEditor/graphics/Matrix.cpp | 5 ++ DesktopEditor/graphics/Matrix.h | 2 +- DesktopEditor/graphics/pro/Fonts.h | 4 ++ DesktopEditor/graphics/pro/Graphics.h | 61 +++++++++++++++++++ 6 files changed, 86 insertions(+), 35 deletions(-) diff --git a/DesktopEditor/fontengine/ApplicationFontsWorker.cpp b/DesktopEditor/fontengine/ApplicationFontsWorker.cpp index 114d236a30..acb141a948 100644 --- a/DesktopEditor/fontengine/ApplicationFontsWorker.cpp +++ b/DesktopEditor/fontengine/ApplicationFontsWorker.cpp @@ -29,14 +29,15 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -#include "ApplicationFonts.h" +//#include "ApplicationFonts.h" #include "ApplicationFontsWorker.h" #include "../common/File.h" +#include "../common/Array.h" #include "../common/Directory.h" -#include "./MemoryStream.h" -#include "./../graphics/pro/Fonts.h" - -using namespace NSFonts; +#include "./MemoryStream.h" +#include "./../graphics/pro/Fonts.h" + +using namespace NSFonts; namespace NSFontsApplication { @@ -347,11 +348,11 @@ namespace NSFontsApplication } }; - static std::vector SaveAllFontsJS(CApplicationFonts& applicationFonts, CStringWriter& oWriterJS) + static std::vector SaveAllFontsJS(NSFonts::IApplicationFonts* applicationFonts, CStringWriter& oWriterJS) { std::vector arrNames; - std::vector* pList = applicationFonts.GetList()->GetFonts(); + std::vector* pList = applicationFonts->GetList()->GetFonts(); #ifdef _IOS @@ -361,7 +362,7 @@ namespace NSFontsApplication CFontInfo* pInfo = pList->operator [](i); if (pInfo->m_wsFontName.find(L".") == 0) - { + { pList->erase(pList->begin() + i); // странные шрифты какие-то есть в ios //pList->RemoveAt(i); @@ -556,7 +557,7 @@ namespace NSFontsApplication { BYTE* pData = NULL; LONG lLen = 0; - applicationFonts.GetList()->ToBuffer(&pData, &lLen, L"", true); + applicationFonts->GetList()->ToBuffer(&pData, &lLen, L"", true); char* cData64 = NULL; int nData64Dst = 0; @@ -658,14 +659,14 @@ std::vector CApplicationFontsWorker::CheckApplication(bool bIsNeed std::vector arrNames; std::vector fonts; - CApplicationFonts oFonts; + NSFonts::IApplicationFonts* pFonts = NSFonts::NSApplication::Create(); pDataDst = NULL; nLenDst = 0; if (bIsNeedSystemFonts) { - fonts = oFonts.GetSetupFontFiles(); + fonts = pFonts->GetSetupFontFiles(); } for (std::vector::iterator iter = m_arAdditionalFolders.begin(); iter != m_arAdditionalFolders.end(); ++iter) @@ -720,10 +721,10 @@ std::vector CApplicationFontsWorker::CheckApplication(bool bIsNeed } // произошли изменения - oFonts.InitializeFromArrayFiles(fonts); + pFonts->InitializeFromArrayFiles(fonts); NSFontsApplication::CStringWriter oWriterJS; - arrNames = NSFontsApplication::SaveAllFontsJS(oFonts, oWriterJS); + arrNames = NSFontsApplication::SaveAllFontsJS(pFonts, oWriterJS); // теперь нужно записать новую дату NSMemoryStream::CMemoryStream oStream; diff --git a/DesktopEditor/graphics/Graphics.h b/DesktopEditor/graphics/Graphics.h index 5785e1878c..5b74128cfc 100644 --- a/DesktopEditor/graphics/Graphics.h +++ b/DesktopEditor/graphics/Graphics.h @@ -152,27 +152,7 @@ static inline unsigned char Div255(int nValue) //------------------------------------------------------------------------------------------------------------------------------- -class CDIB : public IGrObject -{ -public: - BYTE* m_pBits; - LONG m_lWidth; - LONG m_lHeight; - -public: - CDIB() : IGrObject() - { - m_pBits = NULL; - m_lWidth = 0; - m_lHeight = 0; - } - virtual ~CDIB() - { - // delete all in system wrapper - } - - virtual INT Create(LONG lWidth, LONG lHeight, double dDPIX, double dDPIY) = 0; -}; +class CDIB; class CGraphics_ClipStateRecord { diff --git a/DesktopEditor/graphics/Matrix.cpp b/DesktopEditor/graphics/Matrix.cpp index 38d737114e..12f935076e 100644 --- a/DesktopEditor/graphics/Matrix.cpp +++ b/DesktopEditor/graphics/Matrix.cpp @@ -213,8 +213,13 @@ namespace Aggplus double CMatrix::ty() const { return m_internal->m_agg_mtx.ty; + } + double CMatrix::rotation() + { + return m_internal->m_agg_mtx.rotation(); } + void CMatrix::SetElements(const double& sx, const double& shy, const double& shx, const double& sy, const double& tx, const double& ty) { m_internal->m_agg_mtx.sx = sx; diff --git a/DesktopEditor/graphics/Matrix.h b/DesktopEditor/graphics/Matrix.h index 51ed6585c3..234bf2e956 100644 --- a/DesktopEditor/graphics/Matrix.h +++ b/DesktopEditor/graphics/Matrix.h @@ -71,7 +71,7 @@ namespace Aggplus double shy() const; double tx() const; double ty() const; - + double rotation(); void SetElements(const double& sx, const double& shy, const double& shx, const double& sy, const double& tx = 0, const double& ty = 0); Status GetElements(float* m) const; diff --git a/DesktopEditor/graphics/pro/Fonts.h b/DesktopEditor/graphics/pro/Fonts.h index dd2d3d74e2..ad1f64a7dd 100644 --- a/DesktopEditor/graphics/pro/Fonts.h +++ b/DesktopEditor/graphics/pro/Fonts.h @@ -460,6 +460,10 @@ namespace NSFonts virtual bool IsItalic() = 0; virtual bool IsBold() = 0; + + virtual void SetItalic(const INT& value) = 0; + virtual void SetNeedBold(const INT& value) = 0; + virtual bool IsSymbolic(bool bIsOS2Check = false) = 0; virtual int IsUnicodeRangeAvailable(unsigned long ulBit, unsigned int un4ByteIndex) = 0; diff --git a/DesktopEditor/graphics/pro/Graphics.h b/DesktopEditor/graphics/pro/Graphics.h index 7cda5ad38a..ba81667fe6 100644 --- a/DesktopEditor/graphics/pro/Graphics.h +++ b/DesktopEditor/graphics/pro/Graphics.h @@ -40,7 +40,31 @@ #include "./Image.h" #include "../IRenderer.h" +#include "../structures.h" +namespace Aggplus { + class CDIB : public IGrObject + { + public: + BYTE* m_pBits; + LONG m_lWidth; + LONG m_lHeight; + + public: + CDIB() : IGrObject() + { + m_pBits = NULL; + m_lWidth = 0; + m_lHeight = 0; + } + virtual ~CDIB() + { + // delete all in system wrapper + } + + virtual INT Create(LONG lWidth, LONG lHeight, double dDPIX, double dDPIY) = 0; + }; +} namespace NSGraphics { class GRAPHICS_DECL IGraphicsRenderer : public IRenderer @@ -63,9 +87,46 @@ namespace NSGraphics public: virtual void CreateFromBgraFrame(CBgraFrame* pFrame) = 0; virtual void SetCoordTransformOffset(double dOffsetX, double dOffsetY) = 0; + + + virtual void SavePen(NSStructures::CPen& oPen) = 0; + virtual void RestorePen(const NSStructures::CPen& oPen) = 0; + + virtual void SaveBrush(NSStructures::CBrush& oBrush) = 0; + virtual void RestoreBrush(const NSStructures::CBrush& oBrush) = 0; + + virtual void put_GlobalAlphaEnabled(const bool& bEnabled, const double& dVal) = 0; + virtual void put_IntegerGrid(const bool& bEnabled) = 0; + virtual bool get_IntegerGrid() = 0; + virtual void AddRect(const double& x, const double& y, const double& w, const double& h) = 0; + virtual void SetFontAttack() = 0; + + virtual void Create(BYTE* pPixels, const Aggplus::CDoubleRect& oRect, LONG lWidthControl, LONG lHeightControl, Aggplus::CDIB* pDib = NULL) = 0; + virtual void CreateFlip(BYTE* pPixels, const Aggplus::CDoubleRect& oRect, LONG lWidthControl, LONG lHeightControl, Aggplus::CDIB* pDib = NULL) = 0; + + virtual Aggplus::CMatrix* GetFullTransform() = 0; + virtual Aggplus::CMatrix* GetTransformMatrix() = 0; + virtual void CalculateFullTransform() = 0; + virtual void PathCommandRect(double x, double y, double w, double h) = 0; + virtual Aggplus::CMatrix* GetCoordTransform() = 0; + virtual void Fill() = 0; + virtual void Stroke() = 0; + virtual double GetPixW() = 0; + virtual double GetPixH() = 0; + + // smart methods + virtual void drawHorLine(BYTE align, double y, double x, double r, double penW) = 0; + virtual void drawHorLine2(BYTE align, double y, double x, double r, double penW) = 0; + + virtual void drawVerLine(BYTE align, double x, double y, double b, double penW) = 0; + virtual void drawHorLineExt(BYTE align, double y, double x, double r, double penW, double leftMW, double rightMW) = 0; + + }; GRAPHICS_DECL IGraphicsRenderer* Create(); } + + #endif // _GRAPHICS_EXPORTS_GRAPHICS_H_