From b228085cedf1a6b5ed5001447c9e4292b62c3183 Mon Sep 17 00:00:00 2001 From: Jos Groot Lipman Date: Tue, 13 Mar 2012 10:13:08 +0000 Subject: [PATCH] Versie 2.82, roteren gehele bitmap svn path=/Slnkdwf/trunk/; revision=12537 --- SlnkDWFCom/SLNKDWFVersion.h | 2 +- SlnkDWFCom/Whip2PNG.cpp | 12 ++++++------ SlnkDWFImpl/Whip2DCImpl.cpp | 34 +--------------------------------- SlnkDWFImpl/Whip2DCImpl.h | 2 +- SlnkDWFImpl/Whip2DCState.cpp | 1 - SlnkDWFImpl/Whip2DCState.h | 2 -- 6 files changed, 9 insertions(+), 44 deletions(-) diff --git a/SlnkDWFCom/SLNKDWFVersion.h b/SlnkDWFCom/SLNKDWFVersion.h index f6c410d..a9035bb 100644 --- a/SlnkDWFCom/SLNKDWFVersion.h +++ b/SlnkDWFCom/SLNKDWFVersion.h @@ -1,6 +1,6 @@ // Zorg dat versies alfabetisch altijd op elkaar volgen! #define SLNK_MAJOR_VERSION 2 -#define SLNK_MINOR_VERSION 81 +#define SLNK_MINOR_VERSION 82 #define SLNK_BUILD_VERSION 0 // Define resource strings diff --git a/SlnkDWFCom/Whip2PNG.cpp b/SlnkDWFCom/Whip2PNG.cpp index 98cce6b..d045142 100644 --- a/SlnkDWFCom/Whip2PNG.cpp +++ b/SlnkDWFCom/Whip2PNG.cpp @@ -160,18 +160,17 @@ bool CWhip2PNG::CreateCxImage(CxImage *img) myDoTRACE("CreateFromHBITMAP faalt??"); return false; } -#ifdef BITMAPROTATOR + // Voor het gehele plaatje ondersteunen we alleen rechte hoeken + // Wil je andere hoeken dan moet het via een geroteerd symbool if (m_lRotation%360 == 90 || m_lRotation%360 == -270) img->RotateLeft(); if (m_lRotation%360 == -90 || m_lRotation%360 == 270) img->RotateRight(); - if (m_lRotation == -180 || m_lRotation == 180) // Voor te draggen symbolen + if (m_lRotation == -180 || m_lRotation == 180) img->Rotate180(); - img->Rotate(m_lRotation); -#endif putDWGInfo(); // Generieke info naar het event DeleteObject(TmpBmp); @@ -184,7 +183,8 @@ bool CWhip2PNG::CreateCxImage(CxImage *img) m_sizeY /= m_AAFactor; m_offsetX /= m_AAFactor; m_offsetY /= m_AAFactor; - img->Resample(m_sizeX, m_sizeY, m_AAMethod); + // Let op dat hij al geroteerd kan zijn en dan is m_sizeX != img->GetWidth() + img->Resample(img->GetWidth()/2, img->GetHeight()/2, m_AAMethod); } return res; @@ -564,7 +564,7 @@ void CWhip2PNG::InitDC(HDC &myDC) m_iWhip2DC.Load(myDC, epli, m_WhipPath, m_RegExp, myRound(m_sizeX*m_dScale), myRound(m_sizeY*m_dScale), - VARIANT_TRUE /*center*/, m_Maximize, m_dwgScale, m_lRotation); + VARIANT_TRUE /*center*/, m_Maximize, m_dwgScale); // Als m_dwgScale was gespecificeerd moeten we wel een goede bitmapgrootte kiezen if (m_dwgScale > 0.0) diff --git a/SlnkDWFImpl/Whip2DCImpl.cpp b/SlnkDWFImpl/Whip2DCImpl.cpp index d63a05d..71f1e70 100644 --- a/SlnkDWFImpl/Whip2DCImpl.cpp +++ b/SlnkDWFImpl/Whip2DCImpl.cpp @@ -20,7 +20,7 @@ STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream, const CString &WhipPath, const CString & RegExp, long sizeX, long sizeY, VARIANT_BOOL centerImage, VARIANT_BOOL maximize,/*=FALSE*/ - double dwgScale/*=0.0*/, long lRotation /*=0*/) + double dwgScale/*=0.0*/) { m_State.Reset(); @@ -29,7 +29,6 @@ STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream, m_State.m_Layernames.RemoveAll(); m_State.m_centerImage = centerImage; m_State.m_Maximize = maximize; - m_State.m_lRotation = lRotation; m_iEPlotSection = EPlotStream; @@ -62,16 +61,6 @@ STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream, m_State.m_mul=0; my_input_file.set_file_mode(WT_File::File_Read); -if (0) { // altijd 'gewoon' recht rekenen - if (m_State.m_lRotation != 0) - { - WT_Logical_Point lCenter(0,0); - m_State.m_Trans = WT_Transform(lCenter, 1.0, 1.0, m_State.m_lRotation); - my_input_file.heuristics().set_transform(m_State.m_Trans); - my_input_file.heuristics().set_apply_transform(true); - my_input_file.rendition().font().rotation() = MulDiv(m_State.m_lRotation,16384,90); - } -} WT_Result result; if (my_input_file.open() != WT_Result::Success) throw myCString("\nCWhip2DCImpl::Load: unable to open file '%s'", m_WhipPath.ascii()); @@ -93,21 +82,6 @@ if (0) { // altijd 'gewoon' recht rekenen WT_View *view = (WT_View *)my_input_file.current_object(); if (!maximize) m_State.SetExtents(view->view()); // m_mul wordt gezet en de loop eindigt - else - { - // 'Move' alles naar het midden van het eerste kwadrant - // Anders kunnen we later bij bounds bepaling overflow krijgen - - // Waar roteren we eigenlijk omheen? - WT_Logical_Point lCenter; - if (m_State.m_lRotation==0||m_State.m_lRotation==90||m_State.m_lRotation==180||m_State.m_lRotation==270) - lCenter = WT_Logical_Point(INT_MAX/2,INT_MAX/2); - else - lCenter = WT_Logical_Point(0, 0); - - m_State.m_Trans = WT_Transform (lCenter, 1.0, 1.0, m_State.m_lRotation); - my_input_file.heuristics().set_transform(m_State.m_Trans); - } break; } if (obj->object_id() == WT_Object::Viewport_ID) @@ -263,12 +237,6 @@ STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, VARIANT_BOOL markers /* = // 2.80 maar hier is me dat nog even te veel werk. my_input_file.heuristics().set_user_data((void *)&m_State); - if (m_State.m_lRotation != 0) // Tijdens het laden roteren - { - my_input_file.heuristics().set_transform(m_State.m_Trans); - my_input_file.heuristics().set_apply_transform(true); - } - my_input_file.set_file_mode(WT_File::File_Read); if (my_input_file.open() == WT_Result::Success) diff --git a/SlnkDWFImpl/Whip2DCImpl.h b/SlnkDWFImpl/Whip2DCImpl.h index 4f0f3e1..ef40941 100644 --- a/SlnkDWFImpl/Whip2DCImpl.h +++ b/SlnkDWFImpl/Whip2DCImpl.h @@ -125,7 +125,7 @@ public: STDMETHOD(Load)(HDC hDC, CEPlotSectionImpl *EPlotSection, const CString &WhipPath, const CString &RegExp, long sizeX, long sizeY, VARIANT_BOOL centerImage, VARIANT_BOOL maximize=FALSE, - double dwgScale=0.0, long lRotation=0); + double dwgScale=0.0); STDMETHOD(Paint)(VARIANT_BOOL forceBW, VARIANT_BOOL markers = VARIANT_FALSE); STDMETHOD(Find)(LONG findX, LONG findY, BYTE AsMap, CString &pContourKey, CString &pContourLayer, diff --git a/SlnkDWFImpl/Whip2DCState.cpp b/SlnkDWFImpl/Whip2DCState.cpp index 0c95b4d..0f10b2e 100644 --- a/SlnkDWFImpl/Whip2DCState.cpp +++ b/SlnkDWFImpl/Whip2DCState.cpp @@ -31,7 +31,6 @@ void CWhip2DCState::Reset() m_font = NULL; m_forcePaper = false; m_Maximize = false; - m_lRotation = 0; } CWhip2DCState::~CWhip2DCState() diff --git a/SlnkDWFImpl/Whip2DCState.h b/SlnkDWFImpl/Whip2DCState.h index f8125cc..2a307ff 100644 --- a/SlnkDWFImpl/Whip2DCState.h +++ b/SlnkDWFImpl/Whip2DCState.h @@ -67,8 +67,6 @@ public: BOOL m_forceBW; BOOL m_Maximize; BOOL m_centerImage; - long m_lRotation; - WT_Transform m_Trans; // Voor tijdens rotatie double m_mul; // schaal onze DWF-coordinaten naar bitmap coordinaten CSize m_Size;