Beetje dode code opruimen
svn path=/Slnkdwf/trunk/; revision=18416
This commit is contained in:
@@ -268,94 +268,6 @@ WT_Result CSLNKSymbolDefinition::calculateBoundary (CSLNKContourImpl &BoundingCo
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef NO_BITMAPPEREN
|
||||
WT_Drawable *CSLNKSymbolDefinition::asBitmap(int pixeldx, int pixeldy, long paperColor)
|
||||
{
|
||||
if (m_AsBitmap)
|
||||
{
|
||||
// TODO: Wat als pixeldy != m_AsBitmap->rows()
|
||||
// Dat dwfdx anders is is minder boeiend, dat verschaalt wel
|
||||
WT_PNG_Group4_Image *newBitmap = new
|
||||
WT_PNG_Group4_Image(
|
||||
m_AsBitmap->rows(), /*rows*/
|
||||
m_AsBitmap->columns(), /*cols*/
|
||||
WT_PNG_Group4_Image::PNG,
|
||||
3,
|
||||
NULL,
|
||||
m_AsBitmap->data_size(),
|
||||
(WT_Byte *)m_AsBitmap->data(),
|
||||
m_BoundingBox.minpt(),
|
||||
m_BoundingBox.maxpt(),
|
||||
WD_False); // Don't copy
|
||||
m_AsBitmap = newBitmap;
|
||||
return m_AsBitmap; // Dan zijn we rap klaar. Dat is onze winst
|
||||
}
|
||||
|
||||
// Blijkbaar de eerste keer hier. Tijd om de bitmap te bakken
|
||||
CWhip2DCImpl iWhip2DC;
|
||||
HDC pDC = ::GetDC(0);
|
||||
HDC myDC = CreateCompatibleDC(pDC);
|
||||
//ReleaseDC(pDC);
|
||||
CEPlotSectionImpl *epli = NULL;
|
||||
m_iEPlotSection->get_EPlotSectionImpl((BYTE **)&epli);
|
||||
iWhip2DC.Load(myDC, epli,
|
||||
"", ".*",
|
||||
myRound(pixeldx), myRound(pixeldy),
|
||||
VARIANT_TRUE /*center*/, VARIANT_TRUE /*m_Maximize*/);
|
||||
|
||||
BITMAPINFO bmInfo;
|
||||
memset(&bmInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
||||
bmInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
||||
bmInfo.bmiHeader.biWidth=pixeldx;
|
||||
bmInfo.bmiHeader.biHeight=pixeldy;
|
||||
bmInfo.bmiHeader.biPlanes=1;
|
||||
bmInfo.bmiHeader.biCompression=BI_RGB; // Geen compressie
|
||||
bmInfo.bmiHeader.biBitCount=24;
|
||||
//create a new bitmap and select it in the memory dc
|
||||
BYTE *pbase;
|
||||
HBITMAP TmpBmp = CreateDIBSection(pDC, &bmInfo,DIB_RGB_COLORS,(void**)&pbase,0,0);
|
||||
HGDIOBJ TmpObj=SelectObject(myDC,TmpBmp);
|
||||
|
||||
iWhip2DC.put_paperColor(paperColor); // Op zich maken we hem transparant maar onze zwart/wit toggle moet wel kloppen
|
||||
SUCCEEDED(iWhip2DC.Paint(VARIANT_FALSE /*m_forceBW*/));
|
||||
CxImage img;
|
||||
img.CreateFromHBITMAP(TmpBmp);
|
||||
|
||||
img.DecreaseBpp(8, FALSE); // Werkt averechts voor kleine plaatjes (pallette is groot?)
|
||||
// Maar CxImage::Draw2 lijkt alleen te werken met palette achtergrond dus het moet maar
|
||||
RGBQUAD back = {GetBValue(paperColor), // RGBQUAD is BGR!!
|
||||
GetGValue(paperColor),
|
||||
GetRValue(paperColor),0};
|
||||
///RGBQUAD back = {0,0,0,0};
|
||||
img.SetTransIndex(img.GetNearestIndex(back));
|
||||
// img.SetTransColor(back); // Voor als we zonder pallette werken
|
||||
|
||||
BYTE *m_Buffer=NULL;
|
||||
long m_size;
|
||||
img.Encode(m_Buffer, m_size, CXIMAGE_FORMAT_PNG);
|
||||
myDoTRACE("\nCreates symbol bitmap (%d,%d)->PNG %d byte (W2D was %d)", pixeldx,pixeldy,m_size, epli->size());
|
||||
|
||||
DeleteObject(TmpBmp);
|
||||
DeleteDC(myDC);
|
||||
ReleaseDC( NULL, pDC ); //Do not forget!
|
||||
|
||||
m_AsBitmap = new
|
||||
WT_PNG_Group4_Image(
|
||||
pixeldy, /*rows*/
|
||||
pixeldy, /*cols*/
|
||||
WT_PNG_Group4_Image::PNG,
|
||||
3,
|
||||
NULL,
|
||||
m_size,
|
||||
(WT_Byte*)m_Buffer,
|
||||
m_BoundingBox.minpt(),
|
||||
m_BoundingBox.maxpt(),
|
||||
WD_False); // Geen copy, we verwijderen zelf expliciet
|
||||
|
||||
return m_AsBitmap;
|
||||
}
|
||||
#endif
|
||||
|
||||
WT_Result CSLNKSymbolDefinition::serialize(WT_File & file, WT_Color pColor, BOOL pColorSet)
|
||||
{
|
||||
if (m_AsBitmap)
|
||||
|
||||
@@ -29,7 +29,7 @@ CSLNKSymbolImpl::CSLNKSymbolImpl(double dwgX, double dwgY, WT_Units units)
|
||||
}
|
||||
|
||||
WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units,
|
||||
CSLNKSymbolDefinition *symbdef, double hintScale,
|
||||
CSLNKSymbolDefinition *symbdef, double hintScale,
|
||||
BOOL forFind, double scale)
|
||||
{
|
||||
ATLASSERT(symbdef != NULL);
|
||||
@@ -113,37 +113,12 @@ WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units,
|
||||
file.heuristics().set_transform(SymbolTrans);
|
||||
file.heuristics().set_apply_transform(true);
|
||||
|
||||
#ifdef NO_BITMAPPEREN
|
||||
// Vooralsnog uitgeschakeld: we hebben de (hoognodige) achtergrondkleur niet
|
||||
Merk op dat builtin symbols (star) nog geen boundingbox ingevuld hebben
|
||||
int pixeldx = 1000;
|
||||
int pixeldy = 1000;
|
||||
if (hintScale>0)
|
||||
if (m_ColorSet && m_Color.rgba().m_rgb.a==0)
|
||||
{
|
||||
WT_Logical_Box bx = symbdef->m_BoundingBox;
|
||||
pixeldx = myRound((bx.maxpt().m_x - bx.minpt().m_x)*m_Scale/symbdef->m_dwgScale/hintScale);
|
||||
pixeldy = myRound((bx.maxpt().m_y - bx.minpt().m_y)*m_Scale/symbdef->m_dwgScale/hintScale);
|
||||
//myDoTRACE("\nbx=(%d,%d)-(%d,%d)",bx.minpt().m_x,bx.minpt().m_y,bx.maxpt().m_x,bx.maxpt().m_y);
|
||||
//myDoTRACE(" makes (%d,%d) pixels",pixeldx,pixeldy);
|
||||
}
|
||||
if ( 0 && pixeldx < 100 && pixeldy < 100 ) // Heel weinig pixels
|
||||
{ // Bitmap versie van het symbool gebruiken
|
||||
//double rescale = 1.0; //m_Scale/symbdef->m_dwgScale*dScale;
|
||||
if (pixeldx > 0 && pixeldy > 0)
|
||||
{
|
||||
symbdef->asBitmap(pixeldx, pixeldy, 0xffffff)->serialize(file);
|
||||
}
|
||||
// Skip want toch onzichtbaar
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{ //Gewone vector versie
|
||||
if (m_ColorSet && m_Color.rgba().m_rgb.a==0)
|
||||
{
|
||||
// Skip want toch onzichtbaar
|
||||
}
|
||||
else
|
||||
symbdef->serialize(file, m_Color, m_ColorSet);
|
||||
}
|
||||
symbdef->serialize(file, m_Color, m_ColorSet);
|
||||
|
||||
#ifdef _DEBUG
|
||||
WT_Comments cmt;
|
||||
@@ -181,12 +156,12 @@ WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units,
|
||||
|
||||
WT_Color().serialize(file); // Op de default zetten.
|
||||
file.desired_rendition().color() = file.rendition().color() = WT_Color();
|
||||
|
||||
|
||||
WT_Fill().serialize(file); // Ook op de default zetten.
|
||||
file.desired_rendition().fill() = file.rendition().fill() = WT_Fill();
|
||||
|
||||
|
||||
file.heuristics().set_apply_transform(WD_False); // Hebben we al rechtstreeks op de contour gedaan
|
||||
m_SLNKContour.serialize(file, true, forFind, scale);
|
||||
m_SLNKContour.serialize(file, true, forFind, scale);
|
||||
// Nog een keer voor een mogelijke outline
|
||||
m_SLNKContour.serialize(file, false, forFind, scale);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user