CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Posts
    43

    Bit-blt- Source coordinates, relativitey of units

    BOOL BitBlt(
    HDC hdcDest, // handle to destination DC
    int nXDest, // x-coord of destination upper-left corner
    int nYDest, // y-coord of destination upper-left corner
    int nWidth, // width of destination rectangle
    int nHeight, // height of destination rectangle
    HDC hdcSrc, // handle to source DC
    int nXSrc, // x-coordinate of source upper-left corner
    int nYSrc, // y-coordinate of source upper-left corner
    DWORD dwRop // raster operation code
    That is from MSDN.
    Now obviously the destination rectangle makes sense as this is the place it is supposed to go.

    So my question is what does the term "source coordinates" mean and how would they have to do with loading a bitmap which comes from a separate file, not a previous place on the screen?

    Also are these units relative to the screen or relative to the window? It doesn't make sense if it's relative to the screen because then what happens if you make the window smaller or move it around?

    These are a couple of questions which I had trouble finding the answers for in documentation (they assume you already know) so I posted this here. Thank you for even reading this.

  2. #2
    Join Date
    Mar 2004
    Location
    (Upper-) Austria
    Posts
    2,899

    Re: Bit-blt- Source coordinates, relativitey of units

    Those are relative to the DC. If the DC comes from a window, it is relative to the window. If it is the DC of the entire screen the coordinates are relative to the entire screen.

    And for what the source coords are? Well for example you could just copy 100 pixels left, right, up and down of a source bitmap which has 400 pixels width and height into a destination.
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

  3. #3
    Join Date
    Jul 2005
    Posts
    43

    Re: Bit-blt- Source coordinates, relativitey of units

    Thank you. It makes sense now.

  4. #4
    Join Date
    Jul 2005
    Location
    Germany
    Posts
    1,194

    Re: Bit-blt- Source coordinates, relativitey of units

    You have also to take in account the difference between GetDC() and GetWindowDC(). GetDC() retrieves a device context for the client area only. GetWindowDC() retrieves a device context for the whole window including title bar, menus and scroll bars.
    If you want the window without the titlebar you have to take for example y-coordinate 0 if you got the device context via GetDC(), if you got it via GetWindowDC() you will have to take 0 + the height of the titlebar and menus.
    Please don't forget to rate users who helped you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured