<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bildinformationen aus CBitmap auslesen]]></title><description><![CDATA[<p>Hallo,<br />
ich habe ein Problem mit dem Auslesen der Bildinformationen aus einem CBitmap.</p>
<pre><code>CDC* pDC = m_view-&gt;GetDC();
    CDC memDC; memDC.CreateCompatibleDC(pDC); 
    CBitmap* pBitmap = new CBitmap;
    pBitmap-&gt;CreateCompatibleBitmap(pDC, r.Width(), r.Height());

    memDC.BitBlt( 0, 0, r.Width(), r.Height(),pDC, r.left, r.top, SRCCOPY ); 

    BITMAP bm;
    pBitmap-&gt;GetBitmap(&amp;bm);

    BITMAPINFO bmi;

    bmi.bmiHeader.biSize         = sizeof(BITMAPINFOHEADER);
    bmi.bmiHeader.biWidth        = bm.bmWidth;
    bmi.bmiHeader.biHeight       = bm.bmHeight;
    bmi.bmiHeader.biBitCount     = bm.bmBitsPixel;
    bmi.bmiHeader.biPlanes       = bm.bmPlanes;
    bmi.bmiHeader.biCompression  = BI_RGB;
    bmi.bmiHeader.biSizeImage    = bm.bmBitsPixel * bm.bmWidth * bm.bmHeight / 8;

    BYTE *byteArr = new BYTE[bmi.bmiHeader.biSizeImage];

    ::GetDIBits( memDC.GetSafeHdc(), 
                 (HBITMAP)&amp;pBitmap,
                 0,
                 bmi.bmiHeader.biHeight,
                 byteArr,
                 &amp;bmi,
                 DIB_RGB_COLORS );
</code></pre>
<p>Eigentlich sollten die Bilddaten jetzt in byteArr enthalten sein, sind sie aber nicht! Was mache ich falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/177727/bildinformationen-aus-cbitmap-auslesen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 18:27:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/177727.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Apr 2007 13:24:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bildinformationen aus CBitmap auslesen on Tue, 03 Apr 2007 13:24:44 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe ein Problem mit dem Auslesen der Bildinformationen aus einem CBitmap.</p>
<pre><code>CDC* pDC = m_view-&gt;GetDC();
    CDC memDC; memDC.CreateCompatibleDC(pDC); 
    CBitmap* pBitmap = new CBitmap;
    pBitmap-&gt;CreateCompatibleBitmap(pDC, r.Width(), r.Height());

    memDC.BitBlt( 0, 0, r.Width(), r.Height(),pDC, r.left, r.top, SRCCOPY ); 

    BITMAP bm;
    pBitmap-&gt;GetBitmap(&amp;bm);

    BITMAPINFO bmi;

    bmi.bmiHeader.biSize         = sizeof(BITMAPINFOHEADER);
    bmi.bmiHeader.biWidth        = bm.bmWidth;
    bmi.bmiHeader.biHeight       = bm.bmHeight;
    bmi.bmiHeader.biBitCount     = bm.bmBitsPixel;
    bmi.bmiHeader.biPlanes       = bm.bmPlanes;
    bmi.bmiHeader.biCompression  = BI_RGB;
    bmi.bmiHeader.biSizeImage    = bm.bmBitsPixel * bm.bmWidth * bm.bmHeight / 8;

    BYTE *byteArr = new BYTE[bmi.bmiHeader.biSizeImage];

    ::GetDIBits( memDC.GetSafeHdc(), 
                 (HBITMAP)&amp;pBitmap,
                 0,
                 bmi.bmiHeader.biHeight,
                 byteArr,
                 &amp;bmi,
                 DIB_RGB_COLORS );
</code></pre>
<p>Eigentlich sollten die Bilddaten jetzt in byteArr enthalten sein, sind sie aber nicht! Was mache ich falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258615</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258615</guid><dc:creator><![CDATA[newbii]]></dc:creator><pubDate>Tue, 03 Apr 2007 13:24:44 GMT</pubDate></item></channel></rss>