Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
91 user(s) are online (61 user(s) are browsing Forums)

Members: 0
Guests: 91

more...

Headlines

 
  Register To Post  

Problems with IGraphics->Flood()
Just popping in
Just popping in


See User information
I've got a problem with a function from graphics.library called Flood() which fills the given area with specified color or pattern.

I allocate all the neccessary data for RastPort - the AreaInfo and TmpRas:

Quote:

WORD areabuffer[200];
PLANEPTR buffer;
struct AreaInfo areainfo;
struct TmpRas tmpras;

// given is a rastport rp

IGraphics->InitArea( &areainfo, areabuffer, (200 * 2) / 5 );
rp->AreaInfo = &areainfo;
buffer = (PLANEPTR)IGraphics->AllocRaster( 256, 256 );
IGraphics->InitTmpRas( &tmpras, buffer, 256 * 256 );
rp->TmpRas = &tmpras;

IGraphics->Flood( rp, 1, 100, 100 );

The procedure gives incorrect results ie. the flooding is not performed or performed inappropriately. Anybody knows how to handle this function correctly? Thanks in advance.

Go to top
Re: Problems with IGraphics->Flood()
Not too shy to talk
Not too shy to talk


See User information
@RNS-AMiGA-Club

What does the destination bitmap/rastport contain?

Did you read the desctiption of Flood? It works differently than usual fill functions in paint programs for example.


Edit: your TmpRas ist not initialized correctly. The size should be RASSIZE(256,256), not 256*256. We are talking about a single bitplane, not a chunky bitmap.

Go to top
Re: Problems with IGraphics->Flood()
Just popping in
Just popping in


See User information
Hey, after some tests it turned out that the Flood() procedure in its current form works only on planar bitmaps.

@thomas

Quote:
What does the destination bitmap/rastport contain?

It contains bitmap allocated via AllocBitMap(), the RastPort is initialized by InitRastPort() and then the bitmap is attached to it.

Quote:
Did you read the desctiption of Flood? It works differently than usual fill functions in paint programs for example.

Yes, I did. When the 2nd argument equals to 1 it should act exactly like it is in paint programs.

Quote:
Edit: your TmpRas ist not initialized correctly. The size should be RASSIZE(256,256), not 256*256. We are talking about a single bitplane, not a chunky bitmap.

Thanks, yes, the RASSIZE(256, 256) gives the correct size of one bitplane. I was a bit confused whether this data should be in chunky or planar.

So it turned out that the Flood() in its current form works properly only on up-to 8 bit planar bitmaps. Chunky bitmaps aren't supported. I tested it with good results on AmigaOS3.5 and AmigaOS4.1.

Worth noticing is the fact that other areafill functions like AreaEllipse work correctly on any bitmap.

To allocate planar bitmap you need to provide NULL argument in the FriendBitMap field. So with bitmaps allocated with:

IGraphics->AllocBitMap( WIDTH, HEIGHT, DEPTH, BMF_CLEAR, NULL)

where 1 <= DEPTH <= 8 the Flood() procedure will work correctly, but with bitmaps allocated via:

IGraphics->AllocBitMap( WIDTH, HEIGHT, DEPTH, BMF_CLEAR, friendbm);

the Flood() procedure won't work correctly.

I need to use the Flood() on 24-bit chunky bitmaps so I probably will need to create my own 24-bit Flood() function. It should not be that hard to accomplish I hope.

Go to top
Re: Problems with IGraphics->Flood()
Just can't stay away
Just can't stay away


See User information
That non-working Flood() have been problem to me as well. Then I decided to just forget it.

Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top
Re: Problems with IGraphics->Flood()
Not too shy to talk
Not too shy to talk


See User information
@RNS-AMiGA-Club

I successfully tried Flood() on OS 3.9 directly into the window and the bitmap is 32 bit, so it does work correctly. I will try it with an off-screen bitmap later.

Go to top
Re: Problems with IGraphics->Flood()
Just popping in
Just popping in


See User information
@TSK

I need a substitute to Flood() function for my 32-bit icon editor. I'll probably use the Picasso96API.library bitmap rendering functions which works on >8 bit deep bitmaps.

Go to top
Re: Problems with IGraphics->Flood()
Just popping in
Just popping in


See User information
@thomas

So it may be an OS4.x problem.

Go to top
Re: Problems with IGraphics->Flood()
Quite a regular
Quite a regular


See User information
@RNS-AMiGA-Club

PerfectPaint demonstrates this. No flood-tool for deep graphics. (I got to remember that, start work in 8-bit.)

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project