Paint Routine - Test 
Author Message
 Paint Routine - Test

Hi Guys,

  I'm working on an SVGA library and have put together a model of a PAINT
routine. It <<SEEMS>> to work but I'd like you to give it a test. Throw
whatever you can think of at it and see if it crashes. Also, if you've got any
ideas that will speed it up, I'd appreciate your comments.

  The final version, of course, will need to be in ASM but before I start THAT
mess I want to be sure of the logic. So, let me know if it works or not.

  BTW, the included test code leaves 1 pixel unpainted and that is as it
should be.

NOTE: I'll send the final BASIC version for inclusion in the ABC packets.

TIA,

  d83
  ____    _    ____      ____  _____
 |  _ \  / \  / ___) __ | ___)(_   _)
 | |_)  / _ \ \____\/  \|  _)   | |
 |____//_/ \_\(____/\__/|_|     |_|

     www.basicguru.com/schullian

'--------------------------------------------------------------------------
'-----------------  start of test code  -----------------------------------
'--------------------------------------------------------------------------
$STACK 32766                                 ' recursive routine needs room
$OPTIMIZE SPEED                              ' make it fast Bob!
                                             '
PUBLIC pMaxX%                                ' screen boundries
PUBLIC pMaxY%                                '
                                             '
SCREEN 12                                    ' graphics screen
pMaxX% = 639                                 ' set screen boundries
pMaxY% = 479                                 '
                                             '
DELAY 2                                      ' give monitor time to switch
                                             '
CIRCLE (320, 240), 100, 15, -2.7, -1.9, .83  ' an oddball pie shape
LINE (0,0)-(pMaxX%,pMaxY%), 15, B            ' border around the screen
LINE (pMaxX%,0) - (pMaxX%,pMaxY%), 0         ' (remove right side)
LINE (pMaxX%,0)-(500,240), 15                ' put in a divit
LINE (500,240) - (pMaxX%,pMaxY%), 15         '
                                             '
MyPaint -10, 1000, 3, 15                     ' test stupid
                                             '
T1! = TIMER                                  '
MyPaint 340, 200,  4, 15                     ' fill pie shape
T1! = TIMER - T1!                            '
DELAY 1                                      '
T2! = TIMER                                  '
MyPaint 242,   2, 12, 15                     ' fill large screen area
T2! = TIMER - T2!                            '
DELAY 1                                      '
T3! = TIMER                                  '
MyPaint 503, 240, 13, 15                     ' fill in divit
T3! = TIMER - T3!                            '
LOCATE 2, 2                                  '
PRINT USING "##.#### "; T1!, T2!, T3!        ' display times
                                             '
WHILE INSTAT : G$ = INKEY$ : WEND            ' wait for the user
WHILE NOT INSTAT : WEND                      '
SCREEN 0                                     '
END                                          ' END OF PROGRAM

' --------------------------------------------------------------------------
' --------------------------------------------------------------------------
' --------------------------------------------------------------------------

SUB MyPaint( BYVAL Xstart AS INTEGER, _
             BYVAL Ystart AS INTEGER, _
             BYVAL Colour AS INTEGER, _
             BYVAL Border AS INTEGER  ) LOCAL PUBLIC

  DIM Clr   AS LOCAL INTEGER
  DIM LastX AS LOCAL INTEGER
  DIM LeftX AS LOCAL INTEGER
  DIM X     AS LOCAL INTEGER
  DIM Y     AS LOCAL INTEGER

  FOR X% = Xstart% TO 0 STEP -1
    IF ( POINT(X%,Ystart%) = Border% ) THEN EXIT FOR
    PSET (X%,Ystart%), Colour%
  NEXT
  LeftX% = X% + 1

  FOR X% = Xstart% +1 TO pMaxX%
    IF ( POINT(X%,Ystart%) = Border% ) THEN EXIT FOR
    PSET (X%,Ystart%), Colour%
  NEXT
  LastX% = X% - 1

  FOR Y% = Ystart% -1 TO Ystart% + 1 STEP 2        ' this part SHOULD be
    IF ( Y% < 0      ) THEN ITERATE                ' able to be cleaned up
    IF ( Y% > pMaxY% ) THEN ITERATE                ' and speeded up by NOT
    FOR X% = LeftX% TO LastX%                      ' checking EVERY pixel
      Clr% = POINT(X%,Y%)                          ' who knows how many
      IF Clr% = Colour% THEN ITERATE               ' times
      IF Clr% = Border% THEN ITERATE
      IF ( POINT(X%-1,Y%) = Border% ) AND _
         ( POINT(X%+1,Y%) = Border% ) THEN ITERATE
      MyPaint X%, Y%, Colour%, Border%
    NEXT
  NEXT

END SUB



Fri, 20 Oct 2000 03:00:00 GMT  
 Paint Routine - Test

Quote:

> Hi Guys,

Hi,

[enormous CUT]

Quote:
> '--------------------------------------------------------------------------
> '-----------------  start of test code  -----------------------------------
> '--------------------------------------------------------------------------

[more CUT]

Quote:
>                                              '
> CIRCLE (320, 240), 100, 15, -2.7, -1.9, .83  ' an oddball pie shape
> LINE (0,0)-(pMaxX%,pMaxY%), 15, B            ' border around the screen
> LINE (pMaxX%,0) - (pMaxX%,pMaxY%), 0         ' (remove right side)
> LINE (pMaxX%,0)-(500,240), 15                ' put in a divit
> LINE (500,240) - (pMaxX%,pMaxY%), 15         '
>                                              '

try to add the following lines over here :

for i = 2 to 200 step 2
for j = 2 to 100 step 2
  pset (i,j),15
next j
next i
for i=0 to 20 step .01
  pset (i*3*sin(i)+60,i*3*cos(i)+60),15
next i

they didn't work with me
(sorry ;)

Quote:
> MyPaint -10, 1000, 3, 15                     ' test stupid
>                                              '
> T1! = TIMER                                  '



Fri, 20 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST

2. paint routine help

3. Memory Test Routine - HELP

4. How can I paint a Picture in a Form in a Form Paint method

5. TEST TEST TEST TEST

6. UserControl VB5 Paint NOT Painting in Compiled EXE !?!

7. alt.test,comp.test,misc.test,news.test

8. TEST TEST TEST

9. TEST TEST TEST

10. Testing,testing,testing

11. test test test

12. A VB routine to fill (paint) areas in a code drawn graphic needed.

 

 
Powered by phpBB® Forum Software