AROS World Exec
Development => Development (General) => Topic started by: NathanH on January 20, 2023, 05:43:59 PM
-
Hi,
When I call this routine it works very slowly when filling small shapes and fails after filling about an eighth of the window when trying to flood the whole window. I must be doing something wrong but can't figure out what. I'm working in parForth and don't know C so let me explain what I'm doing in words. Thanks for helping me find out what I'm doing wrong.
1. There is a C-macro defined in gfx_h called RASSIZE which I wrote in parForth as:
(add 15 to width, arithmetic shift 3 right, bitwise AND with $FFFE) times height
2. I allocate space in the forth dictionary for a TmpRas structure called MyTmpRas.
3. I call AllocRaster with a window width x height of 960 x 540. This gives me a pointer I call RWorkspace.
4. I call InitTmpRas with parameters MyTmpRas, RWorkSpace,, 64800
5. I store MyTmpRas in the rastport rp_TmpRas field.
6. I set the APen with red ink
7. I call Flood with with the ptr to my rastport, mode 1, and Width/2, Height/2
The window slowly starts filling with red up from the center and then flood returns a zero (fail) after about an eight of the window is filled. If I flood a small shape it works okay but is very slow compared to paint programs and the like.
Any idea what I'm doing wrong? Thanks!!!
NathanH
-
I'm assuming you are trying to use graphics.library.
Instead of using Graphics Library for drawing (which is very slow in some cases) consider using CyberGraphx Library.
You could also look at one of the Flood/Fill routines in an AROS paint program such as ZunePaint or LunaPaint.
-
Thanks,
I'm a beginner and am translating code from "Programmer's Guide to the Amiga" by Robert A. Peck copyright 1987. It doesn't talk about a CyberGraphics library. Once I get some simple code from there to work I might have the skills to look at other than AmigaDOS system libraries. I'm currently getting function numbers by library from the ROM directory of the AROS SDK. It doesn't have CyberGraphics calls in it either. Perhaps these are located elsewhere.
NathanH
-
I can't directly help, but here is C code that fills a polygon:
https://github.com/deadw00d/AROS/blob/alt-abiv0/developer/debug/test/graphics/areatest2.c
You will find the binary in Development:Debug/Tests/graphics/areatest2 and you can see how it works.
-
Wow, thanks Deadwood,
I translated some of the AreaDraw code you provided to parForth and drew a box around the entire window and it filled completely and instantaneously. I guess Flood just doesn't work as well at this time. Thanks.
NathanH
-
Glad I could help :)