Announcement

Collapse
No announcement yet.

Bitmap New/Graphic Window

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

  • Petr Schreiber jr
    replied
    Thanks Walt,

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


    Petr

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • Petr Schreiber jr
    replied
    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
    Last edited by Petr Schreiber jr; 13 Jul 2008, 08:47 AM.

    Leave a comment:


  • Chris Boss
    replied
    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).

    Leave a comment:


  • Walt Decker
    started a topic Bitmap New/Graphic Window

    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?
Working...
X