![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Please Erel, adds the SetPixel method (to change the color of a pixel) to Form object!!!
The Line method don't works correctly for some applications! Thank you! ![]()
__________________
HP HW6915 240x240 - Windows Mobile 5.0 |
|
|||
|
I'm working to my project GraPPC, a graphic program.
For the method FloodFill (fill an area with a color) i need to set the color for a single pixel but with the Line method i have some problems. For example, for this method i must to control the color of the adjacent pixels for any pixel and if i use the Line method i cover this pixels! This is my work in progress :
__________________
HP HW6915 240x240 - Windows Mobile 5.0 |
|
|||
|
I tryed to use the SetPixel method from the ImageLib library but i have the same problem : two pixel for each point! Why?
This is my code (bmp is a BitMap object): Code:
Sub App_Start Form1.Show bmp.New2(Form1.Width,Form1.Height) End Sub Sub Form1_MouseDown (x,y) bmp.SetPixel(x,y,cRed) Form1.Image = bmp.Value End Sub
__________________
HP HW6915 240x240 - Windows Mobile 5.0 |
|
||||
|
Using your code of SetPixel on a bitmap from ImageLib I too get two pixels. But they are not actually two solid pixels. Looking at them using the Magnifier tool I can see that they are combinations of two or more shaded (not solid colour) pixels. I don't fully understand what is happening here but the reason for this seems to be that although the bitmap is nominally the same size of the form in fact it is not! You can see this by clicking on the right side of the form and noticing that the pixel(s) do not appear under the mouse pointer. The pixels are being stretched in mapping the bitmap onto the form.
You can in fact get a single pixel by adding the BF parameter to Line Form1.Line(x,y,x+1,y+1,color,BF) I don't remember having to add this before but maybe my memory is at fault! EDIT :- Something HAS changed. My FormEx library uses something similar to provide a SetPixel function and it is now broken and produces two pixels? I wonder what has changed? Last edited by agraham : 12-31-2007 at 03:31 PM. |
|
|||
|
Klaus, if i use your Pen function in my FloodFill function i receive an error : Windows close the B4PPC with a standard message!!!
And it happen the same thing with the Line method suggested by agraham!!! For me, the problem is in the memory management of B4PPC. The recoursive method that i use for FloodFill function use a lot of memory. In Visual Basic 6 for Windows i obtain the same result if i use a large area to fill; if i use a small area all works fine. A question : it's possible to increase the memory used by B4PPC? Or it uses yet the maximum of available RAM memory? Note : with my code almost all works fine : with a SetPixel function for the Form i'm sure of solve my problem.
__________________
HP HW6915 240x240 - Windows Mobile 5.0 Last edited by forisco : 12-31-2007 at 06:10 PM. |
|
||||
|
I tested the different possibilities of the line function.
It seems having a somewhat strange behaviour: Line(x,y,x+1,y+1,color) gives a line of two pixels Line(x,y,x+1,y+1,color,B) gives a square of four pixels Line(x,y,x+1,y+1,color,BF) gives a single pixel ? Attached some examples. I have found some interesting articles about filling polygons with non recursive methods. http://www.cs.rit.edu/~icss571/filling/index.html http://alienryderflex.com/polygon_fill/ I have not yet looked in details, neither tested these methods, but hope they could be helpfull. I am also looking for a fill method for my IconEdit program. Klaus Switzerland |
|
||||
|
Quote:
Line(x1,y1,x2,y2,color) Draws a line from x1,y1 to x2,y2. This is the one whose behaviour seems to have changed for me but it is a .NET change not a B4PPC change as it happens in my FormExDesktop libarary which calls .NET directly. Previously it seemed to draw a line from x1,y1 to x2-1,y2-1 which gave a single pixel. Now it behaves as it is documented "Draws a line connecting two Point structures". Line(x1,y1,x2,y2,color,B) Draws the single pixel border of a rectangle defined by x1,y1, and x2,y2. So four pixels in the minimum case. Line(x1,y1,x2,y2,color,BF Fills the INTERIOR of a rectangle defined by x1,y1, and x2,y2. So theoretically 0 pixels in the minimum case but it seems to default to 1 pizel located at x1,y1. Actually it always starts the fill at x1,y1 rather than x1+1,y1+1 so you could argue that it is buggy although it IS documented to behave this way. Last edited by agraham : 01-01-2008 at 04:17 PM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| request for squeeling counter demo! | colin9876 | Questions & Help Needed | 25 | 05-21-2008 11:25 PM |
| Object Reference not set to an instance of an object | monster9999 | Questions & Help Needed | 9 | 01-15-2008 10:56 PM |
| HTTP maximum request size and method problems | willisgt | Questions & Help Needed | 1 | 08-27-2007 08:10 PM |
| Tutorial Request - How to creat B4P library? | conf | Questions & Help Needed | 5 | 06-25-2007 12:26 PM |
| SetPixel do no work | Put Claude | Questions & Help Needed | 1 | 05-14-2007 06:21 AM |