<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Undrawing Text in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Undrawing-Text/m-p/935516#M15792</link>
    <description>Well, generaly speaking, problem of undoing something is far from trivial... For &lt;BR /&gt;the actual question, I assume that you want to have the place where text was &lt;BR /&gt;drawn restored to the previous state. &lt;BR /&gt; &lt;BR /&gt;A good place to start would be to involve double (or, in this case, perhaps &lt;BR /&gt;triple) buffering of DC. This is common technique for drawing complex images on &lt;BR /&gt;the screen: you draw into a buffer (compatible DC) instead of &lt;BR /&gt;real window DC, and on WM_PAINT just "copy&amp;amp;paste" its contents into window DC. &lt;BR /&gt;I'm talking about something like: &lt;BR /&gt; &lt;BR /&gt;(In WinMain) &lt;BR /&gt; &lt;BR /&gt;(in WinMain "program"): &lt;BR /&gt;&lt;PRE&gt; 
hWinDC = GetDC(hChild)                        !Window's DC 
hMemDC = CreateCompatibleDC(hWinDC)       !A memory DC -- buffer 
hBmp = CreateCompatibleBitmap(hWinDC,jWidth,jHeight)    !Bitmap of appropriate 
size... 
iSt = SelectObject(xMemDC%hDC,hBmp)           !...must be selected into memory 
DC 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;In window procedure: &lt;BR /&gt;&lt;PRE&gt; 
CASE (WM_PAINT) 
      IF (GetUpdateRect(hWnd,Rect,.FALSE.)) THEN 
            hDC=BeginPaint(hWnd,ps) 
            iSt=SetMapMode(hDC,MM_TEXT) 
            !BitBlt copies the bit-by-bit from one DC (xMemDC%hDC) to another 
(hDC) 
            iSt=BitBlt(hDC,Rect%Left,Rect%Top,  &amp;amp; 
                       Rect%Right-Rect%Left,Rect%Bottom-Rect%Top, &amp;amp; 
                       hMemDC,Rect%Left,Rect%Top,SRCCOPY) 
 
            bSt=ValidateRect(hWnd,Rect) 
            bSt=EndPaint(hWnd,ps) 
      END IF 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;In the sample above, you draw into hMemDC wherever you want in your &lt;BR /&gt;program. (and call RedrawWindow at the end to get results updated). &lt;BR /&gt; &lt;BR /&gt;BitBlt has the capability you need (replacing SRCCOPY with another &lt;BR /&gt;flag). Now, you can create one or few compatible DCs (take into account &lt;BR /&gt;that each compatible bitmap consumes memory) and play with them: &lt;BR /&gt;say, keep one for previous screen state and another for the current &lt;BR /&gt;state; or, draw font into hMemDC and transfer the block into hDC using &lt;BR /&gt;...hell, I don't know exactly which flag is equivalent to R2_XORPEN... &lt;BR /&gt;experiment. &lt;BR /&gt; &lt;BR /&gt;Now, take into account that BitBlt uses orthogonal rectangles. &lt;BR /&gt;However, there are also MaskBlt and PlgBlt to look at (I have never used them, &lt;BR /&gt;though). &lt;BR /&gt; &lt;BR /&gt;HTH &lt;BR /&gt;Jugoslav</description>
    <pubDate>Sat, 20 Jan 2001 03:34:37 GMT</pubDate>
    <dc:creator>Jugoslav_Dujic</dc:creator>
    <dc:date>2001-01-20T03:34:37Z</dc:date>
    <item>
      <title>Undrawing Text</title>
      <link>https://community.intel.com/t5/Software-Archive/Undrawing-Text/m-p/935515#M15791</link>
      <description>I have been drawing lines with the MoveToEx &amp;amp; LineTo commands. &lt;BR /&gt; &lt;BR /&gt;To undraw them I just draw the line twice but set the SetROP2 function to R2_XORPEN in between the two draws to invert ther pixels. &lt;BR /&gt; &lt;BR /&gt;I am now trying to do the same with text where I am use the TextOut function. &lt;BR /&gt;Is there a function similar to SetROP2 (which just seems to be for pens) for text? &lt;BR /&gt; &lt;BR /&gt;Or is there another way to undraw the text by inverting the pixels. &lt;BR /&gt;I don't want to just draw the text again in black (the background colour). &lt;BR /&gt; &lt;BR /&gt;By the way, I have spent a long time searching the help and I am hoping to get 'the' book. &lt;BR /&gt; &lt;BR /&gt;Thanks, &lt;BR /&gt; &lt;BR /&gt;David</description>
      <pubDate>Thu, 18 Jan 2001 21:36:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Undrawing-Text/m-p/935515#M15791</guid>
      <dc:creator>davidgraham</dc:creator>
      <dc:date>2001-01-18T21:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Undrawing Text</title>
      <link>https://community.intel.com/t5/Software-Archive/Undrawing-Text/m-p/935516#M15792</link>
      <description>Well, generaly speaking, problem of undoing something is far from trivial... For &lt;BR /&gt;the actual question, I assume that you want to have the place where text was &lt;BR /&gt;drawn restored to the previous state. &lt;BR /&gt; &lt;BR /&gt;A good place to start would be to involve double (or, in this case, perhaps &lt;BR /&gt;triple) buffering of DC. This is common technique for drawing complex images on &lt;BR /&gt;the screen: you draw into a buffer (compatible DC) instead of &lt;BR /&gt;real window DC, and on WM_PAINT just "copy&amp;amp;paste" its contents into window DC. &lt;BR /&gt;I'm talking about something like: &lt;BR /&gt; &lt;BR /&gt;(In WinMain) &lt;BR /&gt; &lt;BR /&gt;(in WinMain "program"): &lt;BR /&gt;&lt;PRE&gt; 
hWinDC = GetDC(hChild)                        !Window's DC 
hMemDC = CreateCompatibleDC(hWinDC)       !A memory DC -- buffer 
hBmp = CreateCompatibleBitmap(hWinDC,jWidth,jHeight)    !Bitmap of appropriate 
size... 
iSt = SelectObject(xMemDC%hDC,hBmp)           !...must be selected into memory 
DC 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;In window procedure: &lt;BR /&gt;&lt;PRE&gt; 
CASE (WM_PAINT) 
      IF (GetUpdateRect(hWnd,Rect,.FALSE.)) THEN 
            hDC=BeginPaint(hWnd,ps) 
            iSt=SetMapMode(hDC,MM_TEXT) 
            !BitBlt copies the bit-by-bit from one DC (xMemDC%hDC) to another 
(hDC) 
            iSt=BitBlt(hDC,Rect%Left,Rect%Top,  &amp;amp; 
                       Rect%Right-Rect%Left,Rect%Bottom-Rect%Top, &amp;amp; 
                       hMemDC,Rect%Left,Rect%Top,SRCCOPY) 
 
            bSt=ValidateRect(hWnd,Rect) 
            bSt=EndPaint(hWnd,ps) 
      END IF 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;In the sample above, you draw into hMemDC wherever you want in your &lt;BR /&gt;program. (and call RedrawWindow at the end to get results updated). &lt;BR /&gt; &lt;BR /&gt;BitBlt has the capability you need (replacing SRCCOPY with another &lt;BR /&gt;flag). Now, you can create one or few compatible DCs (take into account &lt;BR /&gt;that each compatible bitmap consumes memory) and play with them: &lt;BR /&gt;say, keep one for previous screen state and another for the current &lt;BR /&gt;state; or, draw font into hMemDC and transfer the block into hDC using &lt;BR /&gt;...hell, I don't know exactly which flag is equivalent to R2_XORPEN... &lt;BR /&gt;experiment. &lt;BR /&gt; &lt;BR /&gt;Now, take into account that BitBlt uses orthogonal rectangles. &lt;BR /&gt;However, there are also MaskBlt and PlgBlt to look at (I have never used them, &lt;BR /&gt;though). &lt;BR /&gt; &lt;BR /&gt;HTH &lt;BR /&gt;Jugoslav</description>
      <pubDate>Sat, 20 Jan 2001 03:34:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Undrawing-Text/m-p/935516#M15792</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-01-20T03:34:37Z</dc:date>
    </item>
  </channel>
</rss>

