<?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[Im Dialogfeld aus einem Farbbild ein Grauwertbild erstellen?]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich habe ein Dialogfeld erstellt, wo 2 Bilder per [CPictureEx-Klasse (von CodeGuru)] angezeigt werden --- das funktioniert auch soweit...</p>
<p>Aber nun möchte ich in einer [bzw für beide Bilder an zwei] ander(en) Stellen aus den jeweiligen Bildern ein Grauwertbild erzeugen und darstellen.</p>
<p>Dafür habe ich im Dialogfeld 2 Static-Text-Felder erzeugt (IDC_GREYPICTURE1 &amp; IDC_GREYPICTURE2) wo ich diese dann anzeigen will.</p>
<p>Der untenstehende Code (Funktion wird aufgerufen und es wird auch ordnetlich angezeigt, jedoch nachdem allse erledigt ist (auch das 2 . Bild in Graustufen umgerechnet ist und auch angezeigt wurde) zeichnet sich die Dialogbox neu (hab ich ja auch erzwungen mit</p>
<pre><code>Invalidate(TRUE);
</code></pre>
<p>jedoch sind danach beide Static Boxen wieder leer???</p>
<pre><code class="language-cpp">void CImage_ManipDlg::GetGrayedBitmap() 
{ 

CPaintDC pdc1(GetDlgItem(IDC_MYPICTURE1)); 
CPaintDC pdc2(GetDlgItem(IDC_MYPICTURE2)); 
CPaintDC pdc_grey1(GetDlgItem(IDC_GREYPICTURE1)); 
CPaintDC pdc_grey2(GetDlgItem(IDC_GREYPICTURE2)); 
   COLORREF cr; 
   BYTE     val; 
   INT      x, y; 
   INT      bmHeight; 
   INT      bmWidth; 

   /// Bild 1 umwandeln 
bmHeight=rect1.bottom; 
bmWidth=rect1.right; 

   for(y = 0; y &lt; bmHeight; y++) 
   { 
      for(x = 0; x &lt; bmWidth; x++) 
      { 
       cr = pdc1.GetPixel(x, y); 
         val = (BYTE)(((DOUBLE)GetRValue(cr) * 0.3) + ((DOUBLE)GetGValue(cr) * 0.59) + ((DOUBLE)GetBValue(cr) * 0.11)); 
         pdc_grey1.SetPixel( x, y, RGB(val,val, val)); 

     } 
   } 
   /// Bild 2 umwandeln 
bmHeight=rect1.bottom; 
bmWidth=rect1.right; 

   for(y = 0; y &lt; bmHeight; y++) 
   { 
      for(x = 0; x &lt; bmWidth; x++) 
      { 
       cr = pdc2.GetPixel(x, y); 
         val = (BYTE)(((DOUBLE)GetRValue(cr) * 0.3) + ((DOUBLE)GetGValue(cr) * 0.59) + ((DOUBLE)GetBValue(cr) * 0.11)); 
         pdc_grey2.SetPixel( x, y, RGB(val,val, val)); 

     } 
   } 
   Invalidate(TRUE); 
}
</code></pre>
<p><strong>Warum blos sind diese nur ganz kurz sichtbar???</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/43003/im-dialogfeld-aus-einem-farbbild-ein-grauwertbild-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 10:58:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/43003.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Jul 2003 19:44:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Im Dialogfeld aus einem Farbbild ein Grauwertbild erstellen? on Thu, 17 Jul 2003 19:44:58 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich habe ein Dialogfeld erstellt, wo 2 Bilder per [CPictureEx-Klasse (von CodeGuru)] angezeigt werden --- das funktioniert auch soweit...</p>
<p>Aber nun möchte ich in einer [bzw für beide Bilder an zwei] ander(en) Stellen aus den jeweiligen Bildern ein Grauwertbild erzeugen und darstellen.</p>
<p>Dafür habe ich im Dialogfeld 2 Static-Text-Felder erzeugt (IDC_GREYPICTURE1 &amp; IDC_GREYPICTURE2) wo ich diese dann anzeigen will.</p>
<p>Der untenstehende Code (Funktion wird aufgerufen und es wird auch ordnetlich angezeigt, jedoch nachdem allse erledigt ist (auch das 2 . Bild in Graustufen umgerechnet ist und auch angezeigt wurde) zeichnet sich die Dialogbox neu (hab ich ja auch erzwungen mit</p>
<pre><code>Invalidate(TRUE);
</code></pre>
<p>jedoch sind danach beide Static Boxen wieder leer???</p>
<pre><code class="language-cpp">void CImage_ManipDlg::GetGrayedBitmap() 
{ 

CPaintDC pdc1(GetDlgItem(IDC_MYPICTURE1)); 
CPaintDC pdc2(GetDlgItem(IDC_MYPICTURE2)); 
CPaintDC pdc_grey1(GetDlgItem(IDC_GREYPICTURE1)); 
CPaintDC pdc_grey2(GetDlgItem(IDC_GREYPICTURE2)); 
   COLORREF cr; 
   BYTE     val; 
   INT      x, y; 
   INT      bmHeight; 
   INT      bmWidth; 

   /// Bild 1 umwandeln 
bmHeight=rect1.bottom; 
bmWidth=rect1.right; 

   for(y = 0; y &lt; bmHeight; y++) 
   { 
      for(x = 0; x &lt; bmWidth; x++) 
      { 
       cr = pdc1.GetPixel(x, y); 
         val = (BYTE)(((DOUBLE)GetRValue(cr) * 0.3) + ((DOUBLE)GetGValue(cr) * 0.59) + ((DOUBLE)GetBValue(cr) * 0.11)); 
         pdc_grey1.SetPixel( x, y, RGB(val,val, val)); 

     } 
   } 
   /// Bild 2 umwandeln 
bmHeight=rect1.bottom; 
bmWidth=rect1.right; 

   for(y = 0; y &lt; bmHeight; y++) 
   { 
      for(x = 0; x &lt; bmWidth; x++) 
      { 
       cr = pdc2.GetPixel(x, y); 
         val = (BYTE)(((DOUBLE)GetRValue(cr) * 0.3) + ((DOUBLE)GetGValue(cr) * 0.59) + ((DOUBLE)GetBValue(cr) * 0.11)); 
         pdc_grey2.SetPixel( x, y, RGB(val,val, val)); 

     } 
   } 
   Invalidate(TRUE); 
}
</code></pre>
<p><strong>Warum blos sind diese nur ganz kurz sichtbar???</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/post/311692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/311692</guid><dc:creator><![CDATA[nobber]]></dc:creator><pubDate>Thu, 17 Jul 2003 19:44:58 GMT</pubDate></item><item><title><![CDATA[Reply to Im Dialogfeld aus einem Farbbild ein Grauwertbild erstellen? on Fri, 18 Jul 2003 06:29:26 GMT]]></title><description><![CDATA[<p>Nimm mal CWindowDC oder CClientDC statt CPaintDC</p>
]]></description><link>https://www.c-plusplus.net/forum/post/311862</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/311862</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Fri, 18 Jul 2003 06:29:26 GMT</pubDate></item><item><title><![CDATA[Reply to Im Dialogfeld aus einem Farbbild ein Grauwertbild erstellen? on Fri, 18 Jul 2003 15:08:31 GMT]]></title><description><![CDATA[<p>Leider hat das genau den selben Mißerfolg gebracht.</p>
<p>Muß man den den DC irgendwo anders anfordern (in der OnPaint Methode oder so ???</p>
<p>MFG (Nobber)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/312319</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/312319</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 18 Jul 2003 15:08:31 GMT</pubDate></item></channel></rss>