It's interesting to know that
Line(x,y,X+1,y+1,color,BF) equals SetPixel(x,y,color)
could this behaviour be added to the help file ?
From a logical point of view, I would have expected the same result with
Line(x,y,x+1,y+1,color,B) equal to Line(x,y,x+1,y+1,color,BF)
because in the first case it's the border with nothing in there
and in the second case the internal square is ZERO, so nothing to fill in but the border remains the same.
But knowing that Line(x,y,x+1,y+1,color,BF) equals SetPixel(x,y,color) it's OK for me.
Additional question: can the border and fill colors be different ?
Hello forisco
The two links in my previous post are for vector graphics with known vertex coordinates, here is one for raster graphics.
Additional question: can the border and fill colors be different ?
No. BF doesn't mean Border and Fill separately it is just a flag to say which actual .NET graphics function is called. Here is the code from my FormExDesktop library to show what I mean. It is in C# but it should be reasonably clear what's happening. Inside Basic4PPC the code will be very similar.
Code:
public void bLine(int x1, int y1, int x2, int y2, int col, String fmt) { Rectangle rect = new Rectangle(x1, y1, x2 - x1, y2 - y1); switch (fmt.ToLower()) { case"b" : PaintGraphics.DrawRectangle(new Pen(Color.FromArgb(col)), rect); break; case"bf" : PaintGraphics.FillRectangle(new SolidBrush(Color.FromArgb(col)), rect); break; default : PaintGraphics.DrawLine(new Pen(Color.FromArgb(col)), x1, y1, x2, y2); break; } }
Hello forisco
Grazie for your link, I had also seen this link but, I don't know why, I was somewhat afraid to use a recursive routine. I implemented the routine in my program and it works fine, with SetPixel. I have only 32*32 pixels so no problem with execution time.
Hello agraham,
Thank's for the complementary information, I had in mind, was it from another language, I don't remember, that B=border and F=fill with two different colors.
But now know that it is not the case.
I was yesterday a little bit euphoric because the routine worked on the desktop, but on the device I have the same problem as you 'out of stack memory' even with only 32*32 pixels.
I must also look for another routine, as soon as I have found a solution I will of course also inform you.
Here you are. A data stack based non-recursive flood fill routine. It uses two Array List controls StackX and StackY. It is rather slow on the device but it works. I will try to speed it up a bit now I've got it working - in the mean time you can progress with your projects.
And here's a fast version. I've put the data stack algorithm in a library where I can do manipulation of the bitmap directly. It's very fast now, even on the device.
EDIT :- I should have mentioned that this library needs Compact Framework 2.0 as Compact Framework 1.0 lacks the facility to manipulate bitmaps at a low level.
Hello agraham
Thank you very much for your precious help.
I have implemented the routine, works well.
Unfortunately a have to use the slow version becaus I don't only use bitmap but also a magnified area. On the device it takes about 9s to fill the whole 32*32 square, it's not too bad.
Unfortunately a have to use the slow version becaus I don't only use bitmap but also a magnified area. On the device it takes about 9s to fill the whole 32*32 square, it's not too bad
If I knew how you were implementing the magnified area I might be able to help. Do you want to post some example code?