Announcement

Collapse
No announcement yet.

PB 8.04 vs 8.00: Different XPRINT COPY style support

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PB 8.04 vs 8.00: Different XPRINT COPY style support

    I have added bitmap support to a text print/preview utility I recently converted from VB6 to PBWin. During the course of this implementation, I have found that the predefined '%mix_MaskSrc' style does not work as advertised with XPRINT statements that support styles. Works fine only with corresponding GRAPHIC statements. :confused2:

    I compiled the same exact program (and used the same #include file) with PB 8.00 and it works as expected.

    I of course (and history.txt) of both compiler versions but cannot find any explanation on why styles support has changed since PB 8.00.

    Here is a complete sample code I wrote only to demonstrate this issue:

    Code:
    #PBFORMS CREATED V1.51
    #COMPILE EXE
    #DIM ALL
    #PBFORMS BEGIN INCLUDES
    %USEMACROS = 1
    #INCLUDE "WIN32API.INC"
    #PBFORMS END INCLUDES
    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1  =  101
    %IDC_GRAPHIC  = 1001
    %IDC_LABEL1   = 1002
    %IDC_CBSTYLE  = 1003
    %IDC_PRINT    = 1004
    %IDCANCEL     =    2
    %DEST_SCREEN  =    1
    %DEST_PRINTER =    2
    #PBFORMS END CONSTANTS
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    FUNCTION PBMAIN()
      ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    SUB Draw_Boxes(DestDevice AS LONG,hDlg AS LONG)
      LOCAL hBmp1  AS DWORD,hBmp2   AS DWORD
      LOCAL bWidth AS LONG ,bHeight AS LONG ,BStyle AS LONG
      ' Retrieve current style selection:
      CONTROL SEND hDlg, %IDC_CBSTYLE, %CB_GETCURSEL, 0,0 TO Bstyle
      Bstyle=CHOOSE&(Bstyle+1&,%MIX_NOTMERGESRC, _
                               %MIX_NOTCOPYSRC, _
                               %MIX_MASKSRCNOT,_
                               %MIX_XORSRC, _
                               %MIX_MASKSRC, _
                               %MIX_MERGENOTSRC, _
                               %MIX_COPYSRC, _
                               %MIX_MERGESRC)
      ' Need a larger size for most printers:
      IF DestDevice=%DEST_SCREEN THEN
        bWidth=160 :bHeight=80
      ELSE
        bWidth=1600:bHeight=800
      END IF
      ' Create bitmap 1
      GRAPHIC BITMAP NEW bWidth, bHeight TO hBmp1
      GRAPHIC ATTACH hBmp1,0
      GRAPHIC BOX (0,0)-(bWidth-1,bHeight-1),0,0,%YELLOW,0
      ' Create bitmap 2
      GRAPHIC BITMAP NEW bWidth, bHeight TO hBmp2
      GRAPHIC ATTACH hBmp2,0
      GRAPHIC BOX (0,0)-(bWidth-1,bHeight-1),0,0,%BLUE,0
      IF DestDevice=%DEST_SCREEN THEN
        ' Switch to graphic control
        GRAPHIC ATTACH hDlg,%IDC_GRAPHIC, REDRAW
        GRAPHIC COLOR -1, %WHITE
        GRAPHIC CLEAR
        ' Show bitmaps
        GRAPHIC COPY hBmp1,0 TO (10 ,10 ),BStyle
        GRAPHIC COPY hBmp2,0 TO (bWidth/2+10 ,bHeight/2+10 ),BStyle
        GRAPHIC REDRAW
      ELSE
        XPRINT ATTACH CHOOSE
        IF XPRINT$="" THEN BEEP:EXIT SUB
        ' Print bitmaps
        XPRINT COPY hBmp1,0  TO (100,100),BStyle
        XPRINT COPY hBmp2,0  TO (bWidth/2+100,bHeight/2+100),BStyle
        XPRINT FORMFEED
        XPRINT CLOSE
      END IF
      ' Cleanup
      GRAPHIC ATTACH hBmp1,0
      GRAPHIC BITMAP END
      GRAPHIC ATTACH hBmp2,0
      GRAPHIC BITMAP END
    END SUB
    CALLBACK FUNCTION ShowDIALOG1Proc()
      SELECT CASE AS LONG CBMSG
      CASE %WM_INITDIALOG
        CALL Draw_Boxes(%DEST_SCREEN,CBHNDL)
        CONTROL SET FOCUS CBHNDL,%IDC_CBSTYLE
      CASE %WM_COMMAND
        ' Process control notifications
        SELECT CASE AS LONG CBCTL
        CASE %IDC_CBSTYLE
          SELECT CASE CBCTLMSG
          CASE %CBN_SELCHANGE
            CALL Draw_Boxes(%DEST_SCREEN,CBHNDL)
          END SELECT
        CASE %IDC_PRINT
          IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
            CALL Draw_Boxes(%DEST_PRINTER,CBHNDL)
          END IF
        CASE %IDCANCEL
          IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
            DIALOG END CBHNDL, 0
          END IF
        END SELECT
      END SELECT
    END FUNCTION
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
      LOCAL hDlg  AS DWORD
      DIALOG NEW PIXELS, hParent, "Test Pixel Style", 250, 170, 290, 220, %WS_POPUP OR _
        %WS_BORDER OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
        %WS_MINIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR _
        %DS_SETFOREGROUND OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
        %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
        %WS_EX_RIGHTSCROLLBAR, TO hDlg
      CONTROL ADD LABEL,   hDlg, %IDC_LABEL1, "Style: ", 15,  10, 67, 20, _
        %WS_CHILD OR %WS_VISIBLE OR %SS_RIGHT OR %SS_CENTERIMAGE, %WS_EX_LEFT OR _
        %WS_EX_LTRREADING
      CONTROL ADD COMBOBOX, hDlg, %IDC_CBSTYLE, , 80, 10, 196, 200, %WS_CHILD _
        OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %CBS_DROPDOWNLIST, _
        %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
      CONTROL ADD GRAPHIC, hDlg, %IDC_GRAPHIC, "", 15, 35, 260, 140, %WS_CHILD OR _
        %WS_VISIBLE OR %WS_BORDER
      CONTROL ADD BUTTON,  hDlg, %IDC_PRINT, "Print", 110, 187, 75, 25
      CONTROL ADD BUTTON,  hDlg, %IDCANCEL, "Exit", 200, 187, 75, 25
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_NotMergeSrc"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_NotCopySrc"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_MaskSrcNot"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_XorSrc"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_MaskSrc"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_MergeNotSrc"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_CopySrc"
      COMBOBOX ADD hDlg, %IDC_CBSTYLE, "%mix_MergeSrc"
      COMBOBOX SELECT hDlg, %IDC_CBSTYLE,5
    #PBFORMS END DIALOG
      DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc
    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
    #PBFORMS END CLEANUP
    END FUNCTION
    My configuration: PbWin 8.04 + XP Home SP2 all updates. I have checked this with a Canon I550 printer and, to save trees , with PdfCreator virtual printer.

    What am I missing here?lease:
    Julien Tosoni - Goodyear France

  • #2
    Julien, it seems to be working ok on my system with PBWin 8.04.

    If I just load your program and print, not changing the default %mix_MaskSrc style, the print looks just like the graphics on the screen. I'm using an HP psc 2100 series printer on both Windows XP Home and Vista Home Premium OS.

    I'm just not seeing the difference You're seeing. Hope I have understood your problem correctly.

    Comment


    • #3
      Charles,

      Thanks for testing the program on your system. I then decided to waste a few more sheets of paper on my Canon printer and guess what? Problem is gone ! It appears that the bad guy is PdfCreator (build 0.8.0.0 installed back in 2005). Whatever style I chose, it was 'printing' a blue box partially overwriten by a yellow one (the colors are inverted and no pixel mask applied).

      I guess that, at some point in time, I got confused and chose the wrong style to print to the physical printer (I didn't throw away one of the sheets of paper I wasted earlier, my eyes did not lie to me :laugh.

      So, thanks again for your help :wavey:, I now need to get a fresher copy of PdfCreator...
      Julien Tosoni - Goodyear France

      Comment

      Working...
      X