線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:863
推到 Plurk!
推到 Facebook!

bitmap 列印問題。

尚未結案
powmien
初階會員


發表:27
回覆:80
積分:41
註冊:2004-10-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-05-06 16:00:07 IP:211.22.xxx.xxx 未訂閱
這是一個將一張bitmap 檔印出的function , 如果我要在印出的bitmap 某特 定位置加上日期時間或字串一同印出,不知道怎麼做比較好呢? 謝謝。
GLOBALOBJECT2_API int DoPrint(char *filename)
{
 
 FILE *fp;
 int iTemp,iWidth,iHeight,iLine,i,iWidthByte,iPrintByte;             fp=fopen(filename,"rb ");      // open file
        //fseek(fp,lOffset,SEEK_SET);    // fseek
        //for(i=0;i<10;i  ) temp[i]=fgetc(fp);  // get data from file
        
        if(fp!=NULL){
        
                // to get file width
                fseek(fp,18,SEEK_SET);
                iWidth=fgetc(fp);
                iTemp=fgetc(fp)*16*16;
                iWidth =iTemp;                    // to get file height
                fseek(fp,22,SEEK_SET);
                iHeight=fgetc(fp);
                iTemp=fgetc(fp)*16*16;
                iHeight =iTemp;                    // to calculate width with Byte unit
                if((iWidth%8)>0) 
                        iWidthByte=iWidth/8 1;
                else iWidthByte=iWidth/8;                    if((iWidthByte%4)>0) 
                        iWidthByte=iWidthByte/4 1;
                else iWidthByte=iWidthByte/4;                    iWidthByte*=4;                    iPrintByte=iWidth/8;
                iLine=iHeight-1;                    DoCmd2(BmpPrint1,5);
                if(iWidth<580){ // Width less than 580                            //DoCmd2(BmpPrint1,5);                    
                        while(iLine>0){
                        fseek(fp,62 iLine*iWidthByte,SEEK_SET);
                        
                        for(i=0;i0){
                        fseek(fp,62 iLine*iWidthByte,SEEK_SET);
                        
                        for(i=0;i580
                
                    fclose(fp);   // close file            }                while(i<10000) {
        DoCmd(PrtMode,3);
        i  ;
        }
         // cut paper
        DoCmd(PrtCut,4);      return 0;    }    
RedSnow
版主


發表:79
回覆:1322
積分:845
註冊:2003-12-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-05-12 17:09:18 IP:218.19.xxx.xxx 未訂閱
powmien 您好:    您那個函式看起來並不合適加上您所說的動作,我建議您做如下的處理: 1. 在呼叫該函式之前,先將欲列印圖檔作前置處理,也就是在圖像上添加您要合併列印出來的文字。 2. 將處理好的圖像資料另存成一個暫存圖檔。 3. 以前述的暫存圖檔的路徑及名稱為參數,呼叫 DoPrint() 函式。 將文字添加到圖像上的動作很簡單,您可以參考下列這幾篇的討論: 請教如何在Image上放文字? http://delphi.ktop.com.tw/topic.php?topic_id=34336 Image上放上text http://delphi.ktop.com.tw/topic.php?topic_id=50218 當用TextOut時要如何實作Transparent屬性 http://delphi.ktop.com.tw/topic.php?topic_id=42737 請教大家該如何把image上加入文字的畫面存下來? http://delphi.ktop.com.tw/topic.php?topic_id=36012
系統時間:2024-05-18 17:10:22
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!