Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - FloodFill of bmp
Page 1 of 1

PostPosted: Thu Jun 10, 2004 2:14 am
by RunningUtes
I'm having problems with bitmaps and the floodfill command. I am able to take two bitmaps from a resource file, display them, but I want to fill part of them (the center of a square) with the color of my choice. This is what the program looks like:

Code: Select all
//BmpFill
library "PToolboxLib"

main() {
int e;
clear();
SetDepth(5);           //set screen to 256 colors
graph_on();            //Get ready for drawing
OpenBmpDb("#BmpRsrc"); //open resource file
FastBmp(2,0,1004);     //display 155x27 bmp
FastBmp(16,27,1005);   //display 141x133 bmp

while (true) {         //while loop to choose a color
e = event(1);
switch (e){
case 2: FloodFill(0, penx(), peny()); break; //fill where ever I tap
case 5: PickColor(); break; //page up button to choose color
} //end switch
} // end while
} // end main


I have tried this a couple of ways, but always end up in the end with a system lock up that requires a system reset. It displays alright, just doesn't fill the bmp. Any ideas?

PostPosted: Thu Jun 10, 2004 2:01 pm
by jstadolnik
Try setting the foreground color first. Your PickColor() call is returning a value but you are doing nothing with it. You want something like:

x=PickColor();
if(x>=0) SetFore(x);

It may be that the fill is actually occuring but that it's filling the whole screen with the background color... which may take a while and make it appear that things have locked up.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Thu Jun 10, 2004 3:31 pm
by RunningUtes
My changes:
Code: Select all
//BmpFill
library "PToolboxLib"

main() {
int e,x;
clear();
SetDepth(8);
graph_on();
OpenBmpDb("#BmpRsrc");
FastBmp(2,0,1004);//155,27
FastBmp(16,27,1005);//141,133

while (true) {

e = event(1);
switch(e){
case 2:
if (x>=0) SetFore(x);
FloodFill(0, penx(),peny());
//overwrites only pixels with color of point (x,y)

break;
case 5:x=PickColor();break;

}}}

Well, now I can choose the color (a nice red), but the flood fills the entire screen from the point that I tap downward and still locks up (requiring a reset). Now the area that I'm tapping on is a light yellow square with a black outline on a white background. Shouldn't the floodfill only fill the yellow area with red color if I tap in that area? (mode=0)
Thanks!

PostPosted: Thu Jun 10, 2004 5:08 pm
by jstadolnik
Are you by chance running on Samsung with one of those crazy screen sizes (e.g. 160x192)?

On these machines the PalmOS WinGetPixel() API is busted in that it will return the pixel color based on the the full height... essentially the point grabbed will be 32 (from what I remember) pixels too high. You get verify this with the GetPixel() PToolbox function (which calls WinGetPixel under the hood).

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Thu Jun 10, 2004 5:20 pm
by RunningUtes
Nope. I've got a Sony N760C. It has 320x320 screen size.

PostPosted: Thu Jun 10, 2004 6:10 pm
by jstadolnik
If you do a GetPixel() instead of FloodFill(), do you get the index of the yellow color when you tap within the box?

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Thu Jun 10, 2004 6:27 pm
by RunningUtes
Ok currently:
Code: Select all
//BmpFill
library "PToolboxLib"

main() {
int e,x=0;
clear();
SetDepth(8);
graph_on();
OpenBmpDb("#BmpRsrc");
//FastBmp(2,0,1004);//155,27
FastBmp(16,27,1005);//141,133

while (true) {
e = event(1);
switch(e){
case 2:
if (x>=0) SetFore(x);
alert(GetPixel(penx(),peny()) +" / " + x);
//FloodFill(0, penx(),peny());
//overwrites only pixels with color of point (x,y)

break;
case 5:x=PickColor();break;
case 6:return;
}}}


The alert is returning a GetPixel value of "0" at x,y where there should be a value of 12 (yellow)

PostPosted: Thu Jun 10, 2004 6:34 pm
by RunningUtes
Ok new twist. There are a few areas that are getting the correct pixel color (yellow) <i>but </i>these areas are tapped over the white background. I've even added a few more colored areas. The pink areas are value of 5. The circles are areas where I have tapped with the coresponding reported values. Something is not working quite right.
http://www.geocities.com/runningutes/screen00.gif
this is the final goal
http://www.geocities.com/runningutes/screen01.gif

PostPosted: Thu Jun 10, 2004 9:16 pm
by jstadolnik
Geocities doesn't support direct links to non-html files, so I can't view these.

The problem is likely in how WinGetPixel works when the scaling mode is 160x160, but the physical screen is actually larger. With the drawing mode set to 160x160 (the default), every coordinate actually coresponds to 4 pixels of a 320x320 (or 320x480) screen. So the issue is what does the OS return as the color index in this case.

It may be that one of the 4 sub-pixels is selected, they also may be averaged in some way. Or it may be that the WinGetPixel always treats it's coordinates as being native (in your case 320x480).

Try using npenx() & npeny() instead of penx() & peny(). You may also need to set the scaling to native (320x480) before calling FloodFill (or GetPixel). You can use either the PToolbox's SetScale() or PocketC's drawnative() function to do this.

Joe


The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm