What is a Bitmap's memory layout?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • \Frank\

    What is a Bitmap's memory layout?

    On the Internet there are many descriptions of the memory layout for a DIB.

    But none that I can find for a Bitmap.

    Is that because a Bitmap's layout depends on a related device.

    If that's the case, is a clipboard's Bitmap layout always related to the
    screen?



    Thanx


  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: What is a Bitmap's memory layout?

    Hi,

    A bitmap is just that, a map of bits

    Each pixel is represented by a given number of bytes (Depending of the
    resolution) and they are row after row.

    Is that enuogh?

    ""Frank"" <Frank@a-znet.comwrote in message
    news:ewS5ugN4HH A.5852@TK2MSFTN GP02.phx.gbl...
    On the Internet there are many descriptions of the memory layout for a
    DIB.
    >
    But none that I can find for a Bitmap.
    >
    Is that because a Bitmap's layout depends on a related device.
    >
    If that's the case, is a clipboard's Bitmap layout always related to the
    screen?
    >
    >
    >
    Thanx
    >

    Comment

    • =?ISO-8859-1?Q?G=F6ran_Andersson?=

      #3
      Re: What is a Bitmap's memory layout?

      "Frank" wrote:
      On the Internet there are many descriptions of the memory layout for a DIB.
      >
      But none that I can find for a Bitmap.
      Do you mean the System.Drawing. Bitmap class?

      If so, use the LockBits method to access the image data. It provides you
      with a BitmapData object that contains the information you need to
      access the data. You don't have to bother about details of the memory
      layout, like if it's stored top-down or bottom-up.
      Is that because a Bitmap's layout depends on a related device.
      What related device? The layout depends on the pixel format of the bitmap.
      If that's the case, is a clipboard's Bitmap layout always related to the
      screen?
      Why would it be? Any program can place a Bitmap in the clipboard, so the
      format would be decided by the program.

      --
      Göran Andersson
      _____
      Göran Anderssons privata hemsida.

      Comment

      • \Frank\

        #4
        Re: What is a Bitmap's memory layout?

        I meant the Windows Bitmap
        I did find the description of how to save a Windows GDI Bitmap on a file and
        it's the same as that for saving a DIB.

        But often I see on the Clipboard "Bitmap" as well as "DIB Bitmap"
        There is also CF_Bitmap and CF_DIB

        Are they really saved the same on a file?

        What is the difference between what is retrieved from a Bitmap (CF_Bitmap)
        and a DIB(CF_DIB) from the clipboard?


        Thanx


        Added "pointed to by HBITMAP"
        >On the Internet there are many descriptions of the memory layout for a
        >DIB.
        >But none that I can find for a Bitmap pointed to by HBITMAP
        >Is that because a Bitmap's layout depends on a related device.
        >If that's the case, is a clipboard's Bitmap layout always related to the
        >screen?
        >

        Comment

        • \Frank\

          #5
          Re: What is a Bitmap's memory layout?

          I meant the Windows Bitmap
          I did find the discription of how to save a Windows GDI Bitmap on a file and
          it's the same as that for saving a DIB.

          But often I see on the Clipboard "Bitmap" as well as "DIB Bitmap"
          There is also CF_Bitmap and CF_DIB

          Are they really saved the same on a file?

          What is the difference between what is retrieved from a Bitmap (CF_Bitmap)
          and a DIB(CF_DIB) from the clipboard?


          Thanx


          Comment

          • =?ISO-8859-1?Q?G=F6ran_Andersson?=

            #6
            Re: What is a Bitmap's memory layout?

            "Frank" wrote:
            I meant the Windows Bitmap
            There are several different ways of representing a bitmap, both in
            memory and as files.
            I did find the description of how to save a Windows GDI Bitmap on a file and
            it's the same as that for saving a DIB.
            That's not surprising. A GDI Bitmap can't be saved as a useful format,
            so you save a GDI Bitmap in DIB format.
            But often I see on the Clipboard "Bitmap" as well as "DIB Bitmap"
            There is also CF_Bitmap and CF_DIB
            The clipboard format values all start with CF_, so "Bitmap" and "DIB
            Bitmap" are only descriptions of the formats.

            MSDN: Clipboard Formats:

            Are they really saved the same on a file?
            >
            What is the difference between what is retrieved from a Bitmap (CF_Bitmap)
            and a DIB(CF_DIB) from the clipboard?
            CF_BITMAP is a handle to a bitmap object. CF_DIB is a DIB bitmap object.
            You can retrieve any of those as either of those, as the system can
            convert between them.

            --
            Göran Andersson
            _____
            Göran Anderssons privata hemsida.

            Comment

            • \Frank\

              #7
              Re: What is a Bitmap's memory layout?

              CF_BITMAP is a handle to a bitmap object.

              I'm having trouble phrasing my question because of lack of background.

              But given the above handle, assuming I can use it to get an object from the
              clipboard. what is that object like?

              Is it a DDB that is oriented to the screen?

              Or something else?



              Thanks for staying with me on this


              Comment

              Working...