Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

IVF/CVF FloodFillRGB Questions

jkrob
Beginner
508 Views
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
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
508 Views
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)
result = SETCOLORRGB (#FF0000) ! blue
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
0 Kudos
Reply