- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
All,
I'm wanting to modify a contouring program to go from just plotting contour lines to doing color shading between the contours as well. The contours are being drawn with the MOVETO/LINETO commands. The problems I'm running into are easier explained with the FloodFillRGB demo program included in the CVF documentation.
! Build as a QuickWin or Standard Graphics App.
USE DFLIB
INTEGER(2) status
INTEGER(4) result, bcolor
INTEGER(2) x1, y1, x2, y2, xinterior, yinterior
x1 = 80; y1 = 50
x2 = 240; y2 = 150
result = SETCOLORRGB(#008080) ! red
status = RECTANGLE( $GBORDER, x1, y1, x2, y2 )
bcolor = GETCOLORRGB( )
result = SETCOLORRGB (#FF0000) ! blue
xinterior = 160; yinterior = 100
result = FLOODFILLRGB (xinterior, yinterior, bcolor)
END
For first, the demo code works fine. However, when I modify the code to place a smaller rectangle within the first rectangle and FloodFillRGB the area between the rectangles with the same color red as the first border, I want the FloodFill to stop at the outer rectangle border. However, the FloodFill continues to the edge of the screen. Is there a way to make it stop at the outer border? The documentation states; "Filling occurs in all directions, stopping at pixels of the boundary color color." It is not doing that. It is stoping at the boundary of the last drawn object & not any boundary on the screen.
Thanks in advance,
Jeff Krob
I'm wanting to modify a contouring program to go from just plotting contour lines to doing color shading between the contours as well. The contours are being drawn with the MOVETO/LINETO commands. The problems I'm running into are easier explained with the FloodFillRGB demo program included in the CVF documentation.
! Build as a QuickWin or Standard Graphics App.
USE DFLIB
INTEGER(2) status
INTEGER(4) result, bcolor
INTEGER(2) x1, y1, x2, y2, xinterior, yinterior
x1 = 80; y1 = 50
x2 = 240; y2 = 150
result = SETCOLORRGB(#008080) ! red
status = RECTANGLE( $GBORDER, x1, y1, x2, y2 )
bcolor = GETCOLORRGB( )
result = SETCOLORRGB (#FF0000) ! blue
xinterior = 160; yinterior = 100
result = FLOODFILLRGB (xinterior, yinterior, bcolor)
END
For first, the demo code works fine. However, when I modify the code to place a smaller rectangle within the first rectangle and FloodFillRGB the area between the rectangles with the same color red as the first border, I want the FloodFill to stop at the outer rectangle border. However, the FloodFill continues to the edge of the screen. Is there a way to make it stop at the outer border? The documentation states; "Filling occurs in all directions, stopping at pixels of the boundary color color." It is not doing that. It is stoping at the boundary of the last drawn object & not any boundary on the screen.
Thanks in advance,
Jeff Krob
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following works for me as expected on both CVF 6.6 and IVF 8.048 -- perhaps you did something wrong?
USE DFLIB
INTEGER(2) status
INTEGER(4) result, bcolor
INTEGER(2) x1, y1, x2, y2, xinterior, yinterior
x1 = 80; y1 = 50
x2 = 240; y2 = 150
result = SETCOLORRGB(#008080) ! red
status = RECTANGLE( $GBORDER, x1, y1, x2, y2 )
bcolor = GETCOLORRGB( )
status = RECTANGLE( $GBORDER, x1+40, y1+40, x2-40, y2-40)
INTEGER(2) status
INTEGER(4) result, bcolor
INTEGER(2) x1, y1, x2, y2, xinterior, yinterior
x1 = 80; y1 = 50
x2 = 240; y2 = 150
result = SETCOLORRGB(#008080) ! red
status = RECTANGLE( $GBORDER, x1, y1, x2, y2 )
bcolor = GETCOLORRGB( )
status = RECTANGLE( $GBORDER, x1+40, y1+40, x2-40, y2-40)
result = SETCOLORRGB (#FF0000) ! blue
xinterior = 81; yinterior = 51
result = FLOODFILLRGB (xinterior, yinterior, bcolor)
END
xinterior = 81; yinterior = 51
result = FLOODFILLRGB (xinterior, yinterior, bcolor)
END
Note that both inner and outer contour have to be of the same color for FloodFillRgb to work. For efficiency reasons, I recommend using filled POLYGONs wherever applicable instead of FLOODFILLxxx.
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page