Changeset 179 for trunk/Lucide/SOURCE


Ignore:
Timestamp:
Jan 16, 2007, 5:56:52 PM (15 years ago)
Author:
Eugene Romanenko
Message:

Use raw data format for print queue, this avoid metafile creation during 'as image' printing and speedups printing. Removed NeuQuant? as not used anymore.

Location:
trunk/Lucide/SOURCE/gui
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/makefile

    r177 r179  
    3737       fontsInfoDlg.obj docInfoDlg.obj findDlg.obj progressDlg.obj \
    3838       aboutDlg.obj settingsDlg.obj lusettings.obj printDlg.obj \
    39        print.obj stbrowser.obj pipemon.obj lucidethumbs.obj neuquant.obj \
     39       print.obj stbrowser.obj pipemon.obj lucidethumbs.obj \
    4040       passwordDlg.obj
    4141
     
    7272file $(OBJDIR)\pipemon.obj
    7373file $(OBJDIR)\lucidethumbs.obj
    74 file $(OBJDIR)\neuquant.obj
    7574file $(OBJDIR)\passwordDlg.obj
    7675name $(EXEDIR)\lucide
     
    135134wwbtn.obj:          wwbtn.c
    136135stbrowser.obj:      stbrowser.c
    137 neuquant.obj:       neuquant.cpp
    138136passwordDlg.obj:    passwordDlg.cpp
    139137lcd.obj:            lcd.c               makefile
  • trunk/Lucide/SOURCE/gui/print.cpp

    r171 r179  
    5454#include "luutils.h"
    5555#include "messages.h"
    56 #include "neuquant.h"
    5756
    5857
     
    6564#define HIGH_IMAGE_ZOOM     3.0
    6665#define PS_PRINT_BUF_SIZE   32768
    67 
    68 void rgb_to_pal8( LuPixbuf *dst, LuPixbuf *src, int width, int height, BYTE *p_pal );
    6966
    7067
     
    7976    private:
    8077        bool queryCurrentForm( HAB lhab, PHCINFO pcurForm );
    81         void printPagePm( long page, HPS hpsPrinter, PHCINFO pcurForm, bool reduceColors );
     78        void printPagePm( long page, HPS hpsPrinter, PHCINFO pcurForm );
    8279        bool doPmPrint( HAB lhab );
    8380        bool doPsPrint( HAB lhab );
     
    146143    dos.pszDriverName      = achDriverName;                          // 2
    147144    dos.pdriv              = psetup->QueueInfo.pDriverData;          // 3
    148     dos.pszDataType        = "PM_Q_STD";                             // 4
     145    dos.pszDataType        = "PM_Q_RAW";                             // 4
    149146    dos.pszComment         = (PSZ)appName;                           // 5
    150147    dos.pszQueueProcName   = NULL;                                   // 6
     
    179176        delete buf;
    180177
    181         printPagePm( pg - 1, hpsPrinter, &curForm, ( totalpages > 1 ) );
     178        printPagePm( pg - 1, hpsPrinter, &curForm );
    182179
    183180        if ( pg != psetup->pgto ) {
     
    204201
    205202
    206 void LucidePrinting::printPagePm( long page, HPS hpsPrinter,
    207                                   PHCINFO pcurForm, bool reduceColors )
     203void LucidePrinting::printPagePm( long page, HPS hpsPrinter, PHCINFO pcurForm )
    208204{
    209205    long bpp = doc->getBpp( ev );
     
    268264
    269265        LONG lRop = ROP_SRCCOPY;
    270         if ( reduceColors )
    271         {
    272             LONG bhsz = sizeof( BITMAPINFOHEADER2 ) + ( sizeof( RGB2 ) * 256 );
    273             BITMAPINFO2 *pbmi = (BITMAPINFO2 *)malloc( bhsz );
    274             memset( pbmi, 0, bhsz );
    275             pbmi->cbFix = sizeof( BITMAPINFOHEADER2 );
    276             pbmi->cx = rclx;
    277             pbmi->cy = rcly;
    278             pbmi->cPlanes = 1;
    279             pbmi->cBitCount = 8;
    280             pbmi->ulCompression = BCA_UNCOMP;
    281             pbmi->cbImage = 0;
    282             pbmi->cxResolution = 0;
    283             pbmi->cyResolution = 0;
    284             pbmi->cclrUsed = 0;
    285             pbmi->cclrImportant = 0;
    286             pbmi->usUnits = BRU_METRIC;
    287             pbmi->usReserved = 0;
    288             pbmi->usRecording = BRA_BOTTOMUP;
    289             pbmi->usRendering = BRH_NOTHALFTONED;
    290             pbmi->cSize1 = 0;
    291             pbmi->cSize2 = 0;
    292             pbmi->ulColorEncoding = BCE_RGB;
    293             pbmi->ulIdentifier = 0;
    294 
    295             PBYTE pal = ((PBYTE)pbmi) + sizeof( BITMAPINFOHEADER2 );
    296             LuPixbuf *p = new LuPixbuf( ev, rclx, rcly, 1 );
    297 
    298             rgb_to_pal8( p, pixbuf, rclx, rcly, pal );
    299 
    300             GpiDrawBits( hpsPrinter, p->getDataPtr( ev ), pbmi, 4L,
    301                          aptlPoints, lRop, BBO_IGNORE );
    302             delete p;
    303             free( pbmi );
    304         }
    305         else
    306         {
    307             BITMAPINFO2 pbmi;
    308             pbmi.cbFix = 16L;
    309             pbmi.cx = rclx;
    310             pbmi.cy = rcly;
    311             pbmi.cPlanes = 1;
    312             pbmi.cBitCount = bpp * 8;
    313             GpiDrawBits( hpsPrinter, pixbuf->getDataPtr( ev ), &pbmi, 4L,
    314                          aptlPoints, lRop, BBO_IGNORE );
    315         }
     266        BITMAPINFO2 pbmi;
     267        pbmi.cbFix = 16L;
     268        pbmi.cx = rclx;
     269        pbmi.cy = rcly;
     270        pbmi.cPlanes = 1;
     271        pbmi.cBitCount = bpp * 8;
     272        GpiDrawBits( hpsPrinter, pixbuf->getDataPtr( ev ), &pbmi, 4L,
     273                     aptlPoints, lRop, BBO_IGNORE );
    316274        delete pixbuf;
    317275    }
     
    516474}
    517475
    518 
    519 // Convert RGB 24/32 bit pixbuf into 8 bit palettized
    520 static void rgb_to_pal8( LuPixbuf *dst, LuPixbuf *src, int width, int height, BYTE *p_pal )
    521 {
    522     NeuQuantizer *nq = new NeuQuantizer( src, 256 );
    523 
    524     nq->initnet();
    525     nq->learn( 10 );
    526     nq->unbiasnet();
    527 
    528     int *palette = (int *)nq->getNetwork();
    529     for ( int i = 0; i < ( 256 * 4 ); i++ ) {
    530         p_pal[ i ] = palette[ i ];
    531     }
    532     nq->inxbuild();
    533 
    534     unsigned char *p_src = (unsigned char *)src->getDataPtr( ev );
    535     unsigned char *p_dst = (unsigned char *)dst->getDataPtr( ev );
    536     long rowsize_src = src->getRowSize( ev );
    537     long rowsize_dst = dst->getRowSize( ev );
    538     long x = src->getWidth( ev );
    539     long y = src->getHeight( ev );
    540     long bpp = src->getBpp( ev );
    541 
    542     for ( long py = 0; py < y; py++ )
    543     {
    544         BYTE *row_src = p_src + ( rowsize_src * py );
    545         long row_dst = rowsize_dst * py;
    546         for ( long px = 0; px < x; px++ )
    547         {
    548             BYTE *pix = row_src + ( px * bpp );
    549             p_dst[ row_dst + px ] = nq->inxsearch( pix[0], pix[1], pix[2] );
    550         }
    551     }
    552 
    553     delete nq;
    554 }
    555 
Note: See TracChangeset for help on using the changeset viewer.