Versie 2.80

svn path=/Slnkdwf/trunk/; revision=12530
This commit is contained in:
Jos Groot Lipman
2012-01-11 19:23:50 +00:00
parent 7e0c797a7b
commit 185babff53
29 changed files with 835 additions and 409 deletions

View File

@@ -11,9 +11,10 @@
/*static*/ WT_Integer32 CSLNKContourImpl::m_next_node_num = 0; // Eigenlijk initialiseren op laatste van planfile
CSLNKContourImpl::CSLNKContourImpl(void)
: m_DWGArea(-1), m_outlineAlpha(255)
: m_DWGArea(-1), m_outlineColor(WT_RGBA32(128,128,128,255))
{
m_Color = WT_RGBA32(0,0,0,0); // alpha==0, 100% transparant
m_Color = WT_RGBA32(0,0,0,0); // alpha==0, onzichtbaar
m_Lineweight = 10.0; // 10mm default
}
CSLNKContourImpl::~CSLNKContourImpl(void)
@@ -244,7 +245,7 @@ Subject 1.02: How do I find the distance from a point to a line?
}
// Signed Area needed for centroid!
// Negative is clockwise, Positve counterclockwise
// Negative is clockwise, Positive counterclockwise
/*static*/double CSLNKContourImpl::DWFArea(const WT_Point_Set &pg)
{
int i;
@@ -341,7 +342,7 @@ void CSLNKContourImpl::SerializeLabel(WT_File &my_file, LABELPOS pos,
else
my_file.desired_rendition().color() = WT_Color(255,255,255,0); //Teksten wit
CString tok(m_ExtraLabel); // strtok seems to modify
CString tok(m_ShowLabel); // strtok seems to modify
tok.Replace("~", "\n"); // We ondersteunen ook ~ als newline
tok.Replace("[br]", "\n"); // We ondersteunen ook [br] als newline
tok.Replace("[BR]", "\n"); // We ondersteunen ook [BR] als newline
@@ -583,7 +584,7 @@ WT_Logical_Point CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
Als solidOnly dan alleen als alpha==255 en een label (wel herkend)
****************************************************************************/
WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFind)
WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFind, double scale)
{
if (!m_fromSymbol && m_contLabel == "" && !solidOnly) // Alleen bij tweede slag
{ // May very well be a textobject itself, just emit it
@@ -662,21 +663,23 @@ WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFi
my_poly2.serialize(file);
file.desired_rendition().fill_pattern() = pOld;
}
//
// Nu nogmaals om de rand van de ruimte te tekenen
// Dikte is door de aanroeper al gezet
//
// TODO: Altijd contrasteren met achtergrond
if (m_outlineAlpha>0) // Voor symbolen niet nodig
{
file.desired_rendition().color() = WT_Color(128,128,128, m_outlineAlpha); // Set the color for the polyline
//my_file.desired_rendition().color() = WT_Color(0,0,0); // Zwart
WT_Polyline my_line( count(), points(), WD_False);
my_line.serialize(file);
}
file.desired_rendition().url().clear();
}
//
// Nu nogmaals om de zichtbare rand van de ruimte te tekenen
//
if (!solidOnly // Randje altijd alleen in de tweede slag zodat bij voorkeur bovenop
&& m_outlineColor.rgba().m_rgb.a>0) // Voor symbolen niet nodig
{
file.desired_rendition().color() = m_outlineColor; // Set the color for the polyline
file.desired_rendition().line_weight() = myRound(m_Lineweight * scale);
// Fraaier bij lijndikte aan begin/eind
file.desired_rendition().line_style().line_end_cap() = WT_Line_Style::Round_Cap;
WT_Polyline my_line( count(), points(), WD_False);
my_line.serialize(file);
}
}
return WT_Result::Success;
};

View File

@@ -3,7 +3,7 @@
#define FONT_SIZER 1000
class CWhipFileState; // Forward declaration
class CWhipFile; // Forward declaration
class CSLNKContourImpl :
public WT_Polygon
@@ -23,29 +23,32 @@ public:
int count, /**< The number of points in the array. */
WT_Logical_Point const * points, /**< Pointer to the array of points. */
WT_Boolean copy, /**< Whether the points should be copied or if their addresses should be used directly from the array. */
CWhipFileState *parent
CWhipFile *parent
)
: WT_Polygon(count, points, copy), m_outlineAlpha(255), m_fromSymbol(false)
: WT_Polygon(count, points, copy), m_outlineColor(128,128,128,255), m_fromSymbol(false), m_onTop(false)
{
m_Color = WT_RGBA32(0,0,0,0); // alpha==0, 100% transparant
m_parentWhipFileState = parent;
m_Lineweight = 10.0; // 10 mm default
m_parentWhipFile = parent;
}
~CSLNKContourImpl(void);
public:
WT_String m_contLabel; // As scanned from DWF-file
CString m_Key; // standaard m_contLabel voor contouren maar kan (en voor symbolen moet) een andere waarde krijgen
WT_Color m_Color;
int m_outlineAlpha; // Default 255, zet op 0 voor transparant
WT_Color m_Color; // Vul-kleur
WT_Color m_outlineColor; // Contour kleur
BOOL m_onTop; // Deze wordt later (bovenop) getekend dan degene die niet onTop hebben
BOOL m_fromSymbol; // Dan zijn onze bounds maar matig betrouwbaar zo lang ze niet getransformeerd zijn.
CWhipFileState *m_parentWhipFileState;
CWhipFile *m_parentWhipFile;
WT_Fill_Pattern m_Pattern;
WT_Logical_Point m_ptLabel; // Coordinates of the label
CString m_ExtraLabel; // Can be defined
CString m_ShowLabel; // As will be shown
WT_URL_Item m_Url; // Can be defined
double m_DWGArea; // As determined, original source drawing units
double m_Lineweight; // DWG coordinaten
WT_Result serialize(WT_File & file, BOOL solidOnly, BOOL forFind);
WT_Result serialize(WT_File & file, BOOL solidOnly, BOOL forFind, double scale);
static BOOL PointInPolygon(const WT_Logical_Point pt, const WT_Point_Set &ps);
static BOOL PointInPolygon(const CPoint pt, const CPoint *ps, int size);
static void EdgeAngle(const WT_Logical_Point pt, const WT_Point_Set &ps, double &EdgeAngle, double &EdgeDistance);

View File

@@ -16,8 +16,8 @@
// CWhip2DC
STDMETHODIMP CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream,
const CString &WhipPath,
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*/)
@@ -94,10 +94,10 @@ if (0) { // altijd 'gewoon' recht rekenen
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)
@@ -123,7 +123,7 @@ if (0) { // altijd 'gewoon' recht rekenen
m_State.SetExtents(WT_Logical_Box(dwfPtmin, dwfPtmax)); // m_mul wordt gezet en de loop eindigt
}
}
break;
break;
}
break;
}
@@ -168,7 +168,7 @@ if (0) { // altijd 'gewoon' recht rekenen
double old_mul = m_State.m_mul;
CSize old_size = m_State.m_Size;
m_State.m_mul = 1.0/dwgScale/dScale;
if (m_State.m_Maximize) // Eventueel centreren ongedaan maken
m_State.m_MinMax = m_State.m_orgMinMax;
@@ -178,11 +178,12 @@ if (0) { // altijd 'gewoon' recht rekenen
m_State.m_Size.cx = max(m_State.m_Size.cx, 1);
m_State.m_Size.cy = max(m_State.m_Size.cy, 1);
myDoTRACE("\nm_mul forced from %.8f to %.8f and size from (%d, %d) to (%d, %d)",
myDoTRACE("\nm_mul forced from %.8f to %.8f and size from (%d, %d) to (%d, %d)",
old_mul, m_State.m_mul, old_size.cx,old_size.cy,m_State.m_Size.cx,m_State.m_Size.cy);
}
ATLASSERT(m_State.m_mul!=0);
return S_OK;
}
@@ -197,8 +198,29 @@ STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, VARIANT_BOOL markers /* =
#ifdef _DEBUG
/// CneutralGDI neutralGDI("CWhip2DCImpl::Paint");
#endif
//#define EXPERIMENT
// Helaas: bij sterk inzoomen (lijkt: m_mul > 1) komen er af en toe zwarte
// randen in de viewer te voorschijn
#ifdef EXPERIMENT
SetMapMode(m_State.myDC, MM_ANISOTROPIC);
SIZE wsz, vsz;
if (m_State.m_mul < 1.0)
{
SetWindowExtEx(m_State.myDC, myRound(m_State.m_Size.cx / m_State.m_mul), myRound(m_State.m_Size.cy / m_State.m_mul), &wsz);
SetViewportExtEx(m_State.myDC, m_State.m_Size.cx, m_State.m_Size.cy, &vsz);
}
else
{
SetWindowExtEx(m_State.myDC, m_State.m_Size.cx, m_State.m_Size.cy, &wsz);
SetViewportExtEx(m_State.myDC, myRound(m_State.m_Size.cx * m_State.m_mul), myRound(m_State.m_Size.cy * m_State.m_mul), &vsz);
}
m_State.m_mul = 1.0;
int mm = GetMapMode(m_State.myDC);
#endif
CmyTimer Timer("CWhip2DCImpl::Paint");
m_State.m_forceBW = forceBW;
m_State.findIt = FALSE;
@@ -236,6 +258,9 @@ STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, VARIANT_BOOL markers /* =
// Alle callback functies zijn static. Die kunnen de variabele
// m_State niet benaderen. Daarom maar via set_user_data
// Voortschrijdend inzicht: doorgeven van (void *)this was eigenlijk
// veel praktischer geweest. Bij whipfile.cpp doen we dat al sinds
// 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
@@ -352,9 +377,9 @@ STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, VARIANT_BOOL markers /* =
{
CString txt;
txt.Format("%d", x);
TextOut(m_State.myDC, pt.x+5, pt.y, txt, txt.GetLength());
TextOut(m_State.myDC, pt.x+5, pt.y, txt, txt.GetLength());
txt.Format("%d", y);
TextOut(m_State.myDC, pt.x+5, pt.y+10, txt, txt.GetLength());
TextOut(m_State.myDC, pt.x+5, pt.y+10, txt, txt.GetLength());
}
}
}
@@ -367,9 +392,9 @@ STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, VARIANT_BOOL markers /* =
//CPoint pt1 = m_State.DWFToLP(WT_Logical_Point(INT_MAX, -100000000));
HPEN m_pen = CreatePen(PS_SOLID, 3, RGB(255,255,0));
HPEN oldpen = (HPEN) SelectObject(m_State.myDC, m_pen);
MoveToEx(m_State.myDC, pt0.x, pt0.y, NULL);
MoveToEx(m_State.myDC, pt0.x, pt0.y, NULL);
LineTo(m_State.myDC, pt1.x, pt1.y);
LineTo(m_State.myDC, pt1.x, pt1.y);
#endif
}
return S_OK;
@@ -440,12 +465,12 @@ STDMETHODIMP CWhip2DCImpl::FindTexts(const CString &findText)
* Return S_OK
*
* Called
* TODO: AsMap wordt voor steeds meer doeleinden gebruikt. Oppassen dat
* TODO: AsMap wordt voor steeds meer doeleinden gebruikt. Oppassen dat
* bijvoorbeeld extents wel correct worden bepaald
*****************************************************************************/
STDMETHODIMP CWhip2DCImpl::Find(LONG findX, LONG findY,
BYTE AsMap,
CString & pContourLabel,CString & pContourLayer,
STDMETHODIMP CWhip2DCImpl::Find(LONG findX, LONG findY,
BYTE AsMap,
CString & pContourKey, CString & pContourLayer,
CString & pTextLabel, CString & pTextLayer,
double &pEdgeAngle, double &pEdgeDistance)
{
@@ -468,7 +493,7 @@ STDMETHODIMP CWhip2DCImpl::Find(LONG findX, LONG findY,
CPoint ptback = m_State.DWFToLP(m_State.DWFfindXY);
myTRACE("\nTerugvertaling: (%d, %d)\n", ptback.x, ptback.y);
#endif
myWT_File my_input_file; // input file.
// For TextExtent32
@@ -515,7 +540,7 @@ STDMETHODIMP CWhip2DCImpl::Find(LONG findX, LONG findY,
my_input_file.close(); // closing Input file.
if (AsMap)
pContourLabel = m_State.MapBuilder;
pContourKey = m_State.MapBuilder;
else
{
if (m_State.foundTextLabel != "")
@@ -526,7 +551,7 @@ STDMETHODIMP CWhip2DCImpl::Find(LONG findX, LONG findY,
if (m_State.foundNode.object_node_name())
{
pContourLabel = CString(m_State.foundNode.object_node_name().ascii());
pContourKey = CString(m_State.foundNode.object_node_name().ascii());
pContourLayer = m_State.foundNodeLayer;
pEdgeAngle = m_State.foundEdgeAngle;
pEdgeDistance = m_State.foundEdgeDistance;
@@ -543,12 +568,12 @@ STDMETHODIMP CWhip2DCImpl::Find(LONG findX, LONG findY,
}
// Call Find() or Paint() first!!
STDMETHODIMP CWhip2DCImpl::DPtoDWG(LONG findX, LONG findY,
STDMETHODIMP CWhip2DCImpl::DPtoDWG(LONG findX, LONG findY,
DOUBLE* resX, DOUBLE* resY)
{
m_State.LPfindXY = CPoint(findX, findY);
DPtoLP(m_State.myDC, &m_State.LPfindXY, 1);
if ((resX != NULL) && (resY != NULL))
{
if (m_State.m_mul==0) // Geen extents, vast ook geen transform
@@ -566,7 +591,7 @@ STDMETHODIMP CWhip2DCImpl::DPtoDWG(LONG findX, LONG findY,
}
// Call Find() or Paint() first!!
STDMETHODIMP CWhip2DCImpl::DWGExtents(DOUBLE* resminX, DOUBLE* resminY,
STDMETHODIMP CWhip2DCImpl::DWGExtents(DOUBLE* resminX, DOUBLE* resminY,
DOUBLE* resmaxX, DOUBLE* resmaxY)
{
if (resminX && resminY && resmaxX && resmaxY)
@@ -663,27 +688,27 @@ WT_Result CWhip2DCImpl::my_process_viewport (WT_Viewport & viewport, WT_File & f
BOOL firstTime = (!file.rendition().viewport().contour());
file.rendition().viewport() = viewport;
// Voor de zekerheid opnieuw. ADT3_MTextFormattingCodesinScheduleTags.dwf had
// Voor de zekerheid opnieuw. ADT3_MTextFormattingCodesinScheduleTags.dwf had
// (waarschijnlijk door de DWFPrinter) de eerste (Font) voor de eerste (Viewport)
// en dan was de hoogte niet goed gezet
m_State->my_process_font(file.rendition().font());
double dScale = viewport.viewport_units().application_to_dwf_transform()(0,0);
myDoTRACE("\nThis viewport: 1 pixel = %.8f drawing units.", 1.0/(dScale*m_State->m_mul));
if (m_State->findIt) // When finding no need (or actually: support) for clipping
return WT_Result::Success;
if (!viewport.contour()) // dwftest_bc.dwf
{
SelectClipRgn(m_State->myDC, NULL);
return WT_Result::Success;
SelectClipRgn(m_State->myDC, NULL);
return WT_Result::Success;
}
// Viewports-ANSI A.dwf heeft diverse viewports
myTRACE("\nViewport met %d punten", viewport.contour()->total_points());
// TODO: Door afronding kan het gebeuren dat de clipregion ene pixel
// TODO: Door afronding kan het gebeuren dat de clipregion ene pixel
// te ver naar binnen valt waardoor meest rechtse lijntjes wegvallen
// Daarom viewport ter grootte van minmax niet aanzetten
// NOOT: Ook riskant als later symbolen net buiten de extents geplaatst zijn?
@@ -694,20 +719,20 @@ WT_Result CWhip2DCImpl::my_process_viewport (WT_Viewport & viewport, WT_File & f
return WT_Result::Success;
}
CPoint *vertexList =
m_State->new_DWFToLP(WT_Point_Set(viewport.contour()->total_points(),
CPoint *vertexList =
m_State->new_DWFToLP(WT_Point_Set(viewport.contour()->total_points(),
viewport.contour()->points(), false));
// LET OP: CreatePolyPolygonRgn verwacht Device Units!
LPtoDP(m_State->myDC, vertexList, viewport.contour()->total_points());
if (m_State->m_hrgn)
DeleteObject(m_State->m_hrgn);
m_State->m_hrgn = CreatePolyPolygonRgn(vertexList, (int *)viewport.contour()->counts(),
m_State->m_hrgn = CreatePolyPolygonRgn(vertexList, (int *)viewport.contour()->counts(),
viewport.contour()->contours(),
ALTERNATE);
ALTERNATE);
ATLASSERT(m_State->m_hrgn);
int res = SelectClipRgn(m_State->myDC, m_State->m_hrgn);
int res = SelectClipRgn(m_State->myDC, m_State->m_hrgn);
ATLASSERT(res != ERROR);
#ifdef _DEBUG
{
@@ -721,7 +746,7 @@ WT_Result CWhip2DCImpl::my_process_viewport (WT_Viewport & viewport, WT_File & f
myTRACE("\nRegion aangemaakt: %s", s);
}
#endif
return WT_Result::Success;
}
@@ -802,7 +827,7 @@ WT_Result CWhip2DCImpl::my_process_layer (WT_Layer & layer, WT_File & file)
m_State->bLayerVisible = FALSE;
// myTRACE("\nLayer %s .. does not match", ll->layer_name().ascii());
}
// myTRACE("\nLayer %s .. does not match", ll->layer_name().ascii());
m_State->bIsSymbolLayer = (m_State->m_activeLayerName == "SLNK Symbols");
//myDoTRACE("\nLayer %s %d", ll->layer_name().ascii(), m_State->bIsSymbolLayer);
@@ -909,8 +934,8 @@ WT_Result CWhip2DCImpl::my_process_Ellipse (WT_Ellipse & Ellipse, WT_File & file
pos.m_y+myRound(sin(end +tilt)*minor));
CPoint s = m_State->DWFToLP(ls);
CPoint e = m_State->DWFToLP(le);
MoveToEx(m_State->myDC, s.x, s.y, NULL);
LineTo(m_State->myDC, e.x, e.y);
MoveToEx(m_State->myDC, s.x, s.y, NULL);
LineTo(m_State->myDC, e.x, e.y);
return WT_Result::Success;
}
@@ -995,7 +1020,7 @@ CString CWhip2DCImpl::PolyToMap(WT_Polygon & polygon,
#endif
LPtoDP(m_State->myDC, &pt1, 1);
LPtoDP(m_State->myDC, &pt2, 1);
ptList.Format("%d,%d,%d,%d", min(pt1.x, pt2.x), min(pt1.y, pt2.y),
ptList.Format("%d,%d,%d,%d", min(pt1.x, pt2.x), min(pt1.y, pt2.y),
max(pt1.x, pt2.x), max(pt1.y, pt2.y));
}
else
@@ -1223,7 +1248,7 @@ WT_Result CWhip2DCImpl::my_process_pngGroup4Image (WT_PNG_Group4_Image & pngGrou
}
//CString s;
//s.Format("CWhip2DCImpl::my_process_pngGroup4Image sz=%d dx=%d dy=%d",
//s.Format("CWhip2DCImpl::my_process_pngGroup4Image sz=%d dx=%d dy=%d",
// pngGroup4Image.data_size(), dx, dy);
//CmyTimer p(s);
@@ -1244,7 +1269,7 @@ WT_Result CWhip2DCImpl::my_process_pngGroup4Image (WT_PNG_Group4_Image & pngGrou
pStream->Release();
if (SUCCEEDED(res))
{
::SetStretchBltMode(m_State->myDC, HALFTONE) ;
::SetStretchBltMode(m_State->myDC, HALFTONE) ;
m_pBitmap.Draw(m_State->myDC, Pt1.x, Pt2.y, dx, dy);
}
}
@@ -1294,12 +1319,12 @@ WT_Result CWhip2DCImpl::my_process_pngGroup4Image (WT_PNG_Group4_Image & pngGrou
// (GDI+ deed dat wel goed)
//img.SetTransIndex(-1);
//Draw2 (b)lijkt transparantie (op zwarte achtergrond) alleen goed te doen al we achtergrond/voorgrond zetten
COLORREF keepBk = SetBkColor(m_State->myDC, RGB(255, 255, 255));
COLORREF keepText = SetTextColor(m_State->myDC, RGB(0, 0, 0));
COLORREF keepBk = SetBkColor(m_State->myDC, RGB(255, 255, 255));
COLORREF keepText = SetTextColor(m_State->myDC, RGB(0, 0, 0));
img.Draw2(m_State->myDC, Pt1.x, Pt2.y, dx, dy);
SetBkColor(m_State->myDC, keepBk);
SetBkColor(m_State->myDC, keepBk);
SetTextColor(m_State->myDC, keepText);
}
else
@@ -1350,8 +1375,8 @@ WT_Result CWhip2DCImpl::my_process_image (WT_Image & image, WT_File & file)
HRESULT res = m_pBitmap.Load(pStream);
pStream->Release();
if (SUCCEEDED(res))
{
::SetStretchBltMode(m_State->myDC, HALFTONE) ;
{
::SetStretchBltMode(m_State->myDC, HALFTONE) ;
m_pBitmap.Draw(m_State->myDC, Pt1.x, Pt2.y, Pt2.x - Pt1.x, Pt1.y - Pt2.y);
}
}
@@ -1450,8 +1475,8 @@ if (!strcmp(text.string().ascii(),"TP036"))
return WT_Result::Success;
}
else
m_State->m_kfm.TextOutSpacing(m_State->myDC, acPt.x, acPt.y,
text.string().ascii(), text.string().length(),
m_State->m_kfm.TextOutSpacing(m_State->myDC, acPt.x, acPt.y,
text.string().ascii(), text.string().length(),
(m_State->m_spacing/1024.0));
//TextOut(m_State->myDC, acPt.x, acPt.y, text.string().ascii(), text.string().length());
}
@@ -1478,7 +1503,7 @@ WT_Result CWhip2DCImpl::my_process_text_scan (WT_Text & text, WT_File & file)
CString txt(text.string().ascii());
if (txt.Trim().GetLength() == 0) // Komt voor bij outlets van AC_C2_0
return WT_Result::Success;
CFoundText tFound;
tFound.m_FoundText = text;
WT_Integer32 layer_num = file.rendition().layer().layer_num();
@@ -1516,7 +1541,7 @@ WT_Result CWhip2DCImpl::my_process_text_find (WT_Text & text, WT_File & file)
if (text.bounds().bounds() != NULL)
{
CPoint pts[]=
{
{
m_State->DWFToLP(text.bounds().bounds()[0]),
m_State->DWFToLP(text.bounds().bounds()[1]),
m_State->DWFToLP(text.bounds().bounds()[2]),
@@ -1541,7 +1566,7 @@ WT_Result CWhip2DCImpl::my_process_text_find (WT_Text & text, WT_File & file)
// GetTextExtentPoint32W(m_State->myDC, text.string().unicode(), text.string().length(), &Size);
CPoint pts[]=
{
{
acPt,
CPoint(acPt.x+LPSize.cx, acPt.y),
CPoint(acPt.x+LPSize.cx, acPt.y-LPSize.cy),
@@ -1592,7 +1617,7 @@ WT_Result CWhip2DCImpl::my_process_background (WT_Background & background, WT_Fi
COLORREF DCclr = RGB(clr.m_rgb.r, clr.m_rgb.g, clr.m_rgb.b);
m_State->m_paperColor = DCclr; // Wordt later misschien opgevraagd.
if (m_State->findIt) // When finding no need for actuel painting
return WT_Result::Success;
@@ -1651,7 +1676,7 @@ WT_Result CWhip2DCImpl::my_process_gouraudPolyline (WT_Gouraud_Polyline & gourau
return WT_Result::Success;
//myTRACE("\n !! Don't know how to handle gouraudPolyline very well yet!! (%d points)", gouraudPolyline.count());
#if 1
int w=myRound(file.rendition().line_weight().weight_value()*m_State->m_mul);
@@ -1669,13 +1694,13 @@ WT_Result CWhip2DCImpl::my_process_gouraudPolyline (WT_Gouraud_Polyline & gourau
int j;
for (j = 0; j < dv; j++)
{
COLORREF DCclr = RGB((clr.m_rgb.r*j + prev_clr.m_rgb.r*(dv-j))/dv,
COLORREF DCclr = RGB((clr.m_rgb.r*j + prev_clr.m_rgb.r*(dv-j))/dv,
(clr.m_rgb.g*j + prev_clr.m_rgb.g*(dv-j))/dv,
(clr.m_rgb.b*j + prev_clr.m_rgb.b*(dv-j))/dv);
m_State->m_pen = CreatePen (PS_SOLID, w, DCclr);
HPEN oldpen = (HPEN) SelectObject(m_State->myDC, m_State->m_pen);
DeleteObject(oldpen);
LineTo(m_State->myDC, myRound(((double)pt.x*j+prev_pt.x*(dv-j))/dv),
LineTo(m_State->myDC, myRound(((double)pt.x*j+prev_pt.x*(dv-j))/dv),
myRound(((double)pt.y*j+prev_pt.y*(dv-j))/dv));
}
}
@@ -1711,18 +1736,18 @@ WT_Result CWhip2DCImpl::my_process_gouraudPolyline (WT_Gouraud_Polyline & gourau
for (int i = 0; i < gouraudPolyline.count(); i++)
{
WT_RGBA32 clr = gouraudPolyline.colors()[i];
vert[2*i].x = m_State->DWFToLP(gouraudPolyline.points()[i]).x;
vert[2*i].y = m_State->DWFToLP(gouraudPolyline.points()[i]).y;
vert[2*i].x = m_State->DWFToLP(gouraudPolyline.points()[i]).x;
vert[2*i].y = m_State->DWFToLP(gouraudPolyline.points()[i]).y;
// Pas op: TRIVERTEX verwacht 16 bit RGB!
vert[2*i].Red = clr.m_rgb.r<<8;
vert[2*i].Green = clr.m_rgb.g<<8;
vert[2*i].Blue = clr.m_rgb.b<<8;
vert[2*i+1].x = m_State->DWFToLP(gouraudPolyline.points()[i]).x;
vert[2*i+1].y = m_State->DWFToLP(gouraudPolyline.points()[i]).y+1;
vert[2*i].Red = clr.m_rgb.r<<8;
vert[2*i].Green = clr.m_rgb.g<<8;
vert[2*i].Blue = clr.m_rgb.b<<8;
vert[2*i+1].x = m_State->DWFToLP(gouraudPolyline.points()[i]).x;
vert[2*i+1].y = m_State->DWFToLP(gouraudPolyline.points()[i]).y+1;
// Pas op: TRIVERTEX verwacht 16 bit RGB!
vert[2*i+1].Red = clr.m_rgb.r<<8;
vert[2*i+1].Green = clr.m_rgb.g<<8;
vert[2*i+1].Blue = clr.m_rgb.b<<8;
vert[2*i+1].Red = clr.m_rgb.r<<8;
vert[2*i+1].Green = clr.m_rgb.g<<8;
vert[2*i+1].Blue = clr.m_rgb.b<<8;
vert[i].Alpha = clr.m_rgb.a<<8;
gTri[i].Vertex1 = 2*i;
gTri[i].Vertex2 = 2*(i+1);
@@ -1747,12 +1772,12 @@ WT_Result CWhip2DCImpl::my_process_gouraudPolytriangle (WT_Gouraud_Polytriangle
for (int i = 0; i < gouraudPolytriangle.count(); i++)
{
WT_RGBA32 clr = gouraudPolytriangle.colors()[i];
vert[i].x = m_State->DWFToLP(gouraudPolytriangle.points()[i]).x;
vert[i].y = m_State->DWFToLP(gouraudPolytriangle.points()[i]).y;
vert[i].x = m_State->DWFToLP(gouraudPolytriangle.points()[i]).x;
vert[i].y = m_State->DWFToLP(gouraudPolytriangle.points()[i]).y;
// Pas op: TRIVERTEX verwacht 16 bit RGB!
vert[i].Red = clr.m_rgb.r<<8;
vert[i].Green = clr.m_rgb.g<<8;
vert[i].Blue = clr.m_rgb.b<<8;
vert[i].Red = clr.m_rgb.r<<8;
vert[i].Green = clr.m_rgb.g<<8;
vert[i].Blue = clr.m_rgb.b<<8;
vert[i].Alpha = clr.m_rgb.a<<8;
gTri[i].Vertex1 = i;
gTri[i].Vertex2 = i+1;
@@ -1798,7 +1823,7 @@ STDMETHODIMP CWhip2DCImpl::get_TextItem(LONG i, CFoundText &pVal)
{
if (i<0 || i>=(LONG)m_State.m_FoundTexts.GetCount())
return E_INVALIDARG;
pVal = m_State.m_FoundTexts.GetAt(i);
return S_OK;
}
@@ -1807,7 +1832,7 @@ STDMETHODIMP CWhip2DCImpl::get_LayerItem(LONG i, CString* pVal)
{
if (i<0 || i>=(LONG)m_State.m_Layernames.GetSize())
return E_INVALIDARG;
(*pVal) = m_State.m_Layernames[i];
return S_OK;
}

View File

@@ -79,6 +79,7 @@ CPoint *CWhip2DCState::new_DWFToLP(WT_Point_Set const &pts)
}
// Schaal de Whip-coordinatenruimte terug naar een GDI geschikte ruimte
// TODO: Kan dit echt niet via setviewportext/setwindowext?
CPoint CWhip2DCState::DWFToLP(WT_Logical_Point const &pt)
{
return CPoint(myRound((pt.m_x - m_MinMax.minpt().m_x)*m_mul),
@@ -561,7 +562,7 @@ void CWhip2DCState::AlphaPolygon(LPPOINT lpPoints, int nCount ) const
#ifdef _DEBUG
if (!res)
{
myTRACE("\nHmmm, AlphaBlend failed?");
myTRACE("\nHmmm, AlphaBlend failed? Probeer je SaveAsWMF of zo?");
_CrtDbgBreak();
}
#endif