[futurebasic] SetCPixel too slow.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: Sean Sharkey <mags@...>
Date: Sat, 29 May 1999 09:06:29 +0100
>SETCPIXEL is not exactly the speed burner I'd like. Anyone got anything
>faster for setting pixels in a window.
>
>Sure miss those old days of "poking" into the video ram...;-)
>
Mel,

Try something like this,


LONG IF gGWorld& <>_false
   gPixMap& = FN GETGWORLDPIXMAP(gGworld&)
      LONG IF gPixMap& <> _false
         LONG IF FN LOCKPIXELS(gPixMap&)
            CALL GETGWORLD(OldPort&, OldDev&)
            CALL SETGWORLD(gGWorld&, 0)
            BaseAddress& = FN GETPIXBASEADDR (gPixMap&)
            RowBytes& = PEEK WORD ([gPixMap&]+_rowBytes) AND &H3FFF
            PixelAddr& = BaseAddress& + gPixelV% * RowBytes& + (gPixelH% << 2)
            PixValue& = FN COLOR2INDEX(gNewPixRGB)
            POKE LONG PixelAddr&, PixValue&
            CALL SETGWORLD(OldPort&, OldDev&)
            CALL UNLOCKPIXELS (gPixMap&)
          END IF
      END IF
END IF

NOTES!

gPixelV%,   is the Vertical position in the window of the pixel you want to
            change.
gPixelH%,   is the Horizontal position in the window of the pixel you want to
            change.
gNewPixRGB, is the 6 byte variable you are using to store the new settings for
            the pixel, ie DIM gNewPixRGB.6


Hope this helps,


Sean.