Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Request for SetPixel in Form object.

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 01-01-2008, 07:00 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hello agraham,

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.

http://www.codeproject.com/KB/GDI-pl...select=1760928

Best regards

Klaus
Switzerland

Last edited by klaus : 01-01-2008 at 10:03 PM.
Reply With Quote
  #12 (permalink)  
Old 01-01-2008, 07:21 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by klaus View Post
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;
   }
}
Reply With Quote
  #13 (permalink)  
Old 01-01-2008, 07:34 PM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default

Thank you, Klaus, for the links : the last is a little complex!
I found this link, with a good solution but it require the SetPixel method :

http://www.cs.unc.edu/~mcmillan/comp...areaFills.html

and it uses a recoursive method. I will search for a raster method more simple.

And thank you to agraham for his explanations : very helpful!
__________________
HP HW6915 240x240 - Windows Mobile 5.0
Reply With Quote
  #14 (permalink)  
Old 01-01-2008, 10:54 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

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.

Best regards and thank's again.

Klaus
Switzerland
Reply With Quote
  #15 (permalink)  
Old 01-02-2008, 09:22 AM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default

In fact, Klaus, my problem is just this : i use, as design space, almost all the screen and b4ppc crash in effort to solve all the recoursions.

I'm studing a different solution. I will inform you about my progresses!

Thank you and ciao!
__________________
HP HW6915 240x240 - Windows Mobile 5.0
Reply With Quote
  #16 (permalink)  
Old 01-02-2008, 10:26 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

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.

Grazie e ciao

Klaus
Switzerland
Reply With Quote
  #17 (permalink)  
Old 01-02-2008, 11:46 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

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.
Reply With Quote
  #18 (permalink)  
Old 01-02-2008, 01:21 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

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.
Attached Files
File Type: zip FastFloodFill.zip (9.3 KB, 20 views)

Last edited by agraham : 01-02-2008 at 02:52 PM.
Reply With Quote
  #19 (permalink)  
Old 01-02-2008, 03:38 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

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.

Klaus
Switzerland
Reply With Quote
  #20 (permalink)  
Old 01-02-2008, 03:50 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by klaus View Post
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?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
request for squeeling counter demo! colin9876 Questions (Windows Mobile) 25 05-21-2008 11:25 PM
Object Reference not set to an instance of an object monster9999 Questions (Windows Mobile) 9 01-15-2008 10:56 PM
HTTP maximum request size and method problems willisgt Questions (Windows Mobile) 1 08-27-2007 08:10 PM
Tutorial Request - How to creat B4P library? conf Questions (Windows Mobile) 5 06-25-2007 12:26 PM
SetPixel do no work Put Claude Questions (Windows Mobile) 1 05-14-2007 06:21 AM


All times are GMT. The time now is 04:20 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0