Announcement

Collapse
No announcement yet.

Bitmap New/Graphic Window

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

  • Bitmap New/Graphic Window

    When defining a memory bitmap or a graphic window the width and height are specified, e.g.

    BITMAP NEW 80, 80 TO BmpHndl
    GRAPHIC WINDOW "", 0, 0, 80, 80 TO WinHndl

    Does the width/height parameters define the bmp/graphic window from 0 (zero) to width/height or from 0 (zero) to width/height - 1?
    Walt Decker

  • #2
    If it works the same as the API, then a bitmap which is 80 x 80 would have coordinates:

    X - 0 to 79
    Y - 0 to 79

    when drawing, unless you change the viewport (which most don't).
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      Hi,

      I must admit I am little bit confused here.

      Try following code:
      Code:
      #COMPILE EXE
      #DIM ALL
      
      FUNCTION PBMAIN () AS LONG
      
        ' Create and show a Graphic window on screen
      
        LOCAL hWin AS DWORD
        LOCAL hBmp AS DWORD
        LOCAL sBits AS STRING
                                
        GRAPHIC BITMAP NEW 130, 130 TO hBmp
        GRAPHIC WINDOW "Box", 300, 300, 130, 130 TO hWin
        GRAPHIC ATTACH hWin, 0
        GRAPHIC BOX (0, 0) - (130, 130), 0, %WHITE, %RED
      
        SLEEP 1000  ' show it for 5 seconds, then end
        
        GRAPHIC GET BITS TO sBits
        MSGBOX "Window resolution"+STR$(CVL(sBits,1))+STR$(CVL(sBits,5))
        
        GRAPHIC ATTACH hBmp, 0
        GRAPHIC GET BITS TO sBits
        MSGBOX "Bitmap resolution"+STR$(CVL(sBits,1))+STR$(CVL(sBits,5))
      
        GRAPHIC BITMAP END
        
        GRAPHIC ATTACH hWin, 0
        GRAPHIC WINDOW END
                            
      END FUNCTION
      Resolution for both bitmap and window is returned as 130x130. But in such a case one of the white contours of box should not be rendered, because (0,0)-(130,130) means having side of 131 pixels.
      On my PC the box is rendered completely, nothing is missing.

      Let me know if it is just my PC ( PowerBASIC for Windows, 8.04 ) or feature.


      Petr
      Attached Files
      Petr Schreiber jr
      Member
      Last edited by Petr Schreiber jr; 13 Jul 2008, 09:47 AM.
      [email protected]

      Comment


      • #4
        Petr, I see two white lines, top and left.
        Walt Decker

        Comment


        • #5
          Thanks, Chris. I thought that was the way it worked, but wasn't sure.
          Walt Decker

          Comment


          • #6
            Thanks Walt,

            output on your PC is what I would expect.
            I will send report to PB tomorrow.


            Petr
            [email protected]

            Comment

            Working...
            X