Results 1 to 13 of 13

Thread: General "Graphics" question

Hybrid View

  1. #1
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: General "Graphics" question

    a Bitmap contains a Bitmap. a Graphics object points to a bitmap or a drawing surface.

    you can use the graphics copyfromscreen method instead of BitBlt

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: General "Graphics" question

    Yep, but is this possible without API's?
    Code:
        Public Shared Sub TransferGraphics(ByVal source As Graphics, ByVal dest As Graphics, ByVal destrect As Rectangle)
            Dim shdc As IntPtr = source.GetHdc
            Dim dhdc As IntPtr = dest.GetHdc
            BitBlt(dhdc, destrect.X, destrect.Y, destrect.Width, destrect.Height, shdc, 0, 0, SRCCOPY Or CAPTUREBLT)
            source.ReleaseHdc(shdc)
            dest.ReleaseHdc(dhdc)
        End Sub
        Private Const SRCCOPY = &HCC0020
        Private Const CAPTUREBLT = &H40000000
        Private Declare Function BitBlt Lib "gdi32" (ByVal hdc As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As UInteger) As Boolean
    I failed to find these types of operations in the Graphics class. How come I can't make my Graphics object write to another source, or, obtain data from another source.
    E.g. DrawGraphics(g)

    Ow and thanks for pointing me on the "CopyFromScreen", it seems to contain some sort of BitBlt but it does not allow you to specify a source.
    CopyFromScreen is nice, but if it is the only function for "BitBlt" the Graphics object is a pretty lousy wrapper.

    BTW: it did help me so far, I now understand it is useless to make a DC class since the Graphics class has this mostly implemented.
    I will just make some functions to extend the Graphics class, as long it is required. But still...why aren't these logical functions added?!

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