Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Pixel Pipe Demo

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pixel Pipe Demo

    Click image for larger version  Name:	PixelPipes.jpg Views:	0 Size:	12.6 KB ID:	778816

    Intention:
    Create and modify an image in memory and BitBlt the changes to the screen control via
    a pixel block matrix.

    Fills the Memory DC with a color and then draws a new black line across the graphic.
    The black line will travel across the screen as the background image changes color.

    The background image is produced by 20 32x32 pixel pipe threads. Once the pixel pipes
    have completed drawing their portion of the main image then the blocks are assembled
    together on the MemDC and the MemDC is then displayed.

    When replacing all the control pixels with a new color the basic speed is
    ~16 frames/second.
    When just replacing a few pixels in one block then the frame rate becomes
    ~33 frames/second.
    NOTE:
    Frame rates will be lower if the dialog is moved during presentation.

    App uses 21 threads and has 768 predefined colors.

    Pixel_Pipe_Demo.zip
    Attached Files

  • #2

    Click image for larger version  Name:	PixelPipeDemo.jpg Views:	0 Size:	31.2 KB ID:	778979

    Pixel Pipe Demo V2
    App uses 61 threads and has 768 predefined colors.

    Generic displays for time and temperature.
    Time is Standard or Military.
    Temperature range is fixed at -999 to 999.
    Time and Temperature readings are auto centered in display region.
    Colon strobes but is not synchronized with elapsed seconds.
    App uses pixel masks to produce characters.

    PixelPipeDemo.zip
    Attached Files

    Comment


    • #3
      Suggestions as code (no comments link.)

      The 20 unique thread functions and associated variables for each could be replaced with a single function called 20-times.
      Handles and other arrays could be placed into one type array.
      The logic is the same with a single function and should eliminate lots of duplicated code and IF statements.

      Thanks for the code!
      Code:
      TYPE MyType
       nLeft    AS LONG
       nTop     AS LONG
       nRight   AS LONG
       nBottom  AS LONG
       hBMP  AS LONG
       hDOC AS LONG
       MemDC  AS LONG
       Section(1 to 20) AS LONG
       PlgPts (1 to 20) AS POINT
       PipeRect (1 to 20) AS RECT
      END TYPE
      THREADED t() AS MyType
      
      SUB Init
         LOCAL x,hThread AS LONG
      
         DIM t(1 TO 20) AS MyType
         t(1).nLeft =0: t(1).nTop=0:t(1).nLeft=32:t(1).nTop=32 'init startup values
      
         FOR x = 1 TO 20
            THREAD CREATE MyThread(x) TO hThread
            THREAD CLOSE hThread TO hThread
         NEXT
      
      END SUB
      
      THREAD FUNCTION MyThread(BYVAL n AS LONG) AS LONG
        LOCAL p AS RECT
        p.nLeft  = rr.nLeft + t(n).nLeft
        p.nTop   = rr.ntop  + t(n).nTop
        p.nRight = rr.nLeft + t(n).nleft
        p.nBottom= rr.nTop  + t(n).nTop
      END FUNCTION
      Last edited by Mike Doty; 24 Feb 2019, 08:10 AM.
      https://duckduckgo.com instead of google

      Comment


      • #4
        Pixel Pipe Demo Version 3
        Click image for larger version  Name:	PixelPipeDemo.jpg Views:	1 Size:	27.4 KB ID:	779412
        1) Added create your mask for a simulated incoming signal.
        2) Added XPTheme.
        3) The graphic drawing window is no longer in a thread.
        4) Moved drawing timer to its own thread.
        5) Added a few Sprites.
        6) Added a video presentation which originally was TTV (text-to-video).
        7) Added an Alien Vista game. Click on the saucer 12 times to
        score a point. Be careful though. If you miss 10 times you will
        reset the round and have to click back up again.
        The saucer produces an interesting explosion.
        Note: The misses and hits are displayed next to the reset button.
        8) Improved Oscilloscope trace demo by using a sprite.

        Enjoy!

        As yet Mike I have not implemented your code reduction method.
        Thank you

        PPD_320x192.zip
        Attached Files

        Comment

        Working...
        X