Versie 2.82, roteren gehele bitmap

svn path=/Slnkdwf/trunk/; revision=12537
This commit is contained in:
Jos Groot Lipman
2012-03-13 10:13:08 +00:00
parent 200ea1b237
commit b228085ced
6 changed files with 9 additions and 44 deletions

View File

@@ -1,6 +1,6 @@
// Zorg dat versies alfabetisch altijd op elkaar volgen! // Zorg dat versies alfabetisch altijd op elkaar volgen!
#define SLNK_MAJOR_VERSION 2 #define SLNK_MAJOR_VERSION 2
#define SLNK_MINOR_VERSION 81 #define SLNK_MINOR_VERSION 82
#define SLNK_BUILD_VERSION 0 #define SLNK_BUILD_VERSION 0
// Define resource strings // Define resource strings

View File

@@ -160,18 +160,17 @@ bool CWhip2PNG::CreateCxImage(CxImage *img)
myDoTRACE("CreateFromHBITMAP faalt??"); myDoTRACE("CreateFromHBITMAP faalt??");
return false; 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) if (m_lRotation%360 == 90 || m_lRotation%360 == -270)
img->RotateLeft(); img->RotateLeft();
if (m_lRotation%360 == -90 || m_lRotation%360 == 270) if (m_lRotation%360 == -90 || m_lRotation%360 == 270)
img->RotateRight(); img->RotateRight();
if (m_lRotation == -180 || m_lRotation == 180) // Voor te draggen symbolen if (m_lRotation == -180 || m_lRotation == 180)
img->Rotate180(); img->Rotate180();
img->Rotate(m_lRotation);
#endif
putDWGInfo(); // Generieke info naar het event putDWGInfo(); // Generieke info naar het event
DeleteObject(TmpBmp); DeleteObject(TmpBmp);
@@ -184,7 +183,8 @@ bool CWhip2PNG::CreateCxImage(CxImage *img)
m_sizeY /= m_AAFactor; m_sizeY /= m_AAFactor;
m_offsetX /= m_AAFactor; m_offsetX /= m_AAFactor;
m_offsetY /= 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; return res;
@@ -564,7 +564,7 @@ void CWhip2PNG::InitDC(HDC &myDC)
m_iWhip2DC.Load(myDC, epli, m_iWhip2DC.Load(myDC, epli,
m_WhipPath, m_RegExp, m_WhipPath, m_RegExp,
myRound(m_sizeX*m_dScale), myRound(m_sizeY*m_dScale), 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 // Als m_dwgScale was gespecificeerd moeten we wel een goede bitmapgrootte kiezen
if (m_dwgScale > 0.0) if (m_dwgScale > 0.0)

View File

@@ -20,7 +20,7 @@ STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream,
const CString &WhipPath, const CString &WhipPath,
const CString & RegExp, long sizeX, long sizeY, const CString & RegExp, long sizeX, long sizeY,
VARIANT_BOOL centerImage, VARIANT_BOOL maximize,/*=FALSE*/ VARIANT_BOOL centerImage, VARIANT_BOOL maximize,/*=FALSE*/
double dwgScale/*=0.0*/, long lRotation /*=0*/) double dwgScale/*=0.0*/)
{ {
m_State.Reset(); m_State.Reset();
@@ -29,7 +29,6 @@ STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream,
m_State.m_Layernames.RemoveAll(); m_State.m_Layernames.RemoveAll();
m_State.m_centerImage = centerImage; m_State.m_centerImage = centerImage;
m_State.m_Maximize = maximize; m_State.m_Maximize = maximize;
m_State.m_lRotation = lRotation;
m_iEPlotSection = EPlotStream; m_iEPlotSection = EPlotStream;
@@ -62,16 +61,6 @@ STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream,
m_State.m_mul=0; m_State.m_mul=0;
my_input_file.set_file_mode(WT_File::File_Read); 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; WT_Result result;
if (my_input_file.open() != WT_Result::Success) if (my_input_file.open() != WT_Result::Success)
throw myCString("\nCWhip2DCImpl::Load: unable to open file '%s'", m_WhipPath.ascii()); 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(); WT_View *view = (WT_View *)my_input_file.current_object();
if (!maximize) if (!maximize)
m_State.SetExtents(view->view()); // m_mul wordt gezet en de loop eindigt 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; break;
} }
if (obj->object_id() == WT_Object::Viewport_ID) 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. // 2.80 maar hier is me dat nog even te veel werk.
my_input_file.heuristics().set_user_data((void *)&m_State); 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); my_input_file.set_file_mode(WT_File::File_Read);
if (my_input_file.open() == WT_Result::Success) if (my_input_file.open() == WT_Result::Success)

View File

@@ -125,7 +125,7 @@ public:
STDMETHOD(Load)(HDC hDC, CEPlotSectionImpl *EPlotSection, const CString &WhipPath, STDMETHOD(Load)(HDC hDC, CEPlotSectionImpl *EPlotSection, const CString &WhipPath,
const CString &RegExp, long sizeX, long sizeY, const CString &RegExp, long sizeX, long sizeY,
VARIANT_BOOL centerImage, VARIANT_BOOL maximize=FALSE, 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(Paint)(VARIANT_BOOL forceBW, VARIANT_BOOL markers = VARIANT_FALSE);
STDMETHOD(Find)(LONG findX, LONG findY, BYTE AsMap, STDMETHOD(Find)(LONG findX, LONG findY, BYTE AsMap,
CString &pContourKey, CString &pContourLayer, CString &pContourKey, CString &pContourLayer,

View File

@@ -31,7 +31,6 @@ void CWhip2DCState::Reset()
m_font = NULL; m_font = NULL;
m_forcePaper = false; m_forcePaper = false;
m_Maximize = false; m_Maximize = false;
m_lRotation = 0;
} }
CWhip2DCState::~CWhip2DCState() CWhip2DCState::~CWhip2DCState()

View File

@@ -67,8 +67,6 @@ public:
BOOL m_forceBW; BOOL m_forceBW;
BOOL m_Maximize; BOOL m_Maximize;
BOOL m_centerImage; BOOL m_centerImage;
long m_lRotation;
WT_Transform m_Trans; // Voor tijdens rotatie
double m_mul; // schaal onze DWF-coordinaten naar bitmap coordinaten double m_mul; // schaal onze DWF-coordinaten naar bitmap coordinaten
CSize m_Size; CSize m_Size;