No announcement yet.

Graphic Erase

  • Filter
  • Time
  • Show
Clear All
new posts

  • Graphic Erase

    Is there a "Graphic Erase" command that could be used to erase what I would call "Hidden lines"????

    Some of the shapes I am making I need to hide these lines, and the best I can figure out is to redraw the shape with a color but border color the same as the fill color.

    Is there a way to erase without painting over a line with another line of color to make it appear erased????
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    If you do not want a border, use a NULL_PEN. For example, the following SDK code draws a white rectangle.
      LOCAL trc           AS RECT     ' bounding or formatting rectangle
      LOCAL hDC           AS DWORD    ' handle of device context
      LOCAL hPenOld       AS DWORD    ' handle of original pen of device context
      LOCAL hBrushOld     AS DWORD    ' handle of original brush of device context
      hDC = GetDC(hWnd)
      ' Set the pen
      hPenOld = SelectObject(hDC, GetStockObject(%NULL_PEN))
      ' Set the brush
      hBrushOld = SelectObject(hDC, GetStockObject(%WHITE_BRUSH))
      trc.nLeft   = 105
      trc.nTop    = 85
      trc.nRight  = 246
      trc.nBottom = 181
      Rectangle hDC, trc.nLeft, trc.nTop, trc.nRight, trc.nBottom
      SelectObject hDC, hBrushOld
      SelectObject hDC, hPenOld 
      ReleaseDC hWnd, hDC
    Dominic Mitchell
    Phoenix Visual Designer


    • #3
      You can put the graphic target into a memory bitmap, change all pixels of the line color, and then copy the memory bitmap back to the target.

      This was given as an example in the help file.
      ' Change all red pixels to blue
       LOCAL PixelPtr AS LONG PTR
       xsize& = CVL(bmp$,1)
       ysize& = CVL(bmp$,5)
       PixelPtr = STRPTR(bmp$) + 8
       FOR i& = 1 TO xsize& * ysize&
         IF @PixelPtr = BGR(%red) THEN @PixelPtr = BGR(%blue)
         INCR PixelPtr
       GRAPHIC SET BITS bmp$
      This would be useful if the pixels making up the line(s) to be erased are the only pixels with that color, or are bounded within a definable area.

      On first guess, it's probably slower than redoing multiple lines but it has the advantage of not having to know anything about the lines except their color.

      It also has the advantage that if your "bad" line overlap your "good" lines, you won't see wrongly colored pixels where the bad lines were drawn over good lines (necessitating a redraw of the good lines).
      Last edited by Gary Beene; 10 Apr 2009, 04:51 PM.