|
thanks.
the solution looks great. my region is actually a curve and i know the coordinates of every pixel. can i consider the curve to be a polygon??
can i form the arrays polyX and polyY from the coordinate values of every pixel??
|
|
|
|
|
If you already know the co-ords of every pixel on your region boundary, it is even easier isn't it? Just count the number of pixels with the same x (or y) value which have a lower y (or x) value, and if it is zero or even you are outside, odd and you are inside.
You would have to count intersections twice, but that is just a tweak.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Oops! I forgot - you will need to check if the border is a horizontal (or veritical) line!
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
ya ok. i'll try it out n let u know. thanks!
|
|
|
|
|
|
adding to the excellent answers so far, here is a simple trick that sometimes fits the job:
if you are working in an integer coordinate system with limited range, you could fill your region with one foreground color onto a different background color once, then just ask the pixel what color it has...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
this will work great if i knew the color values of the values. but i know only the positions and nothing else
|
|
|
|
|
You set the values yourself. If it is inside the shape, assign a specific value(say magenta), else use default.
Ask pixel what color it is. If magenta then inside polygon = true.
|
|
|
|
|
It doesn't matter. Just call it black, or whatever. There are only 2 colours so you could use a single bit per pixel to cut down on memory usage. It seems logical to me to visualize that as white on a black background, but it doesn't matter since you only need to know which colour it is, not what colour it is (if you know what I mean), you might as well visualize it as yellow on pink, it doesn't change the result
|
|
|
|
|
there are only two colors involved. Build a GraphicsPath and use Graphics.FillPath; I am not sure how it fills when edges intersect, you'll have to test it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
I may be making a mistake here but doesn't GraphicsPath has a method to do exactly this?
bool GraphicsPath.IsVisible(Point)
[Indicates whether the specified point is contained within this GraphicsPath.]
|
|
|
|
|
Nice, I keep forgetting that method exists. It means we don't need a bitmap after all, which makes overall sizes and integral values irrelevant. Construct the path and interrogate it!
FWIW: when lots of points have to be checked, a bitmapped approach may still be the faster solution.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
HA HA HA... I thought that when many people have suggested such elite answers, i might not be understanding problem correctly... ha ha ha...
cheers!!!
|
|
|
|
|
I just finished a little article on the subject, see here[^]. Hope you like it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
i made web application to scan pages from scanner and worked well but when i made the project on IIS it is not work well and get me this problem
Description: An unhandled exception occurred during the execution<br/> of the current web request. Please review the stack trace<br/> for more information about the error and where it originated in the code<br/> Exception Details: System.UnauthorizedAccessException: Creating<br/> an instance of the COM component with CLSID {850D1D11-70F3-4BE5-9A11-77AA6B2BB201}<br/>from the IClassFactory failed due to the following<br/> error: 80070005. ASP.NET is not authorized to access the requested resource.<br/> Consider granting access rights to the resource to the ASP.NET request identity.<br/> ASP.NET has a base process identity </br>(typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is <br/>not impersonating. If the application is impersonating via <br/>identity impersonate="true, the identity will be the anonymous user (typically IUSR_MACHINENAME)<br/> or the authenticated request user.<br/> To grant ASP.NET access to a file, right-click the file in Explorer,<br/> choose "Properties" and select the Security tab.<br/> Click "Add" to add the </br>appropriate user or group. Highlight the ASP.NET account,<br/> and check the boxes for the desired access.Source Error:
Line 26: int x = 0;<br />
Line 27: <br />
Line 28: CommonDialogClass class1 = new CommonDialogClass();<br />
Line 29: Device d = class1.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true, false);<br />
Line 30: if (d != null)
please any one know the Answer please reply to me quickly i need this now
|
|
|
|
|
I am also getg the same pblm tried all gave rights to all users for the dll still getg the same error can sme one post me the solution....
|
|
|
|
|
Hi,
Did any one got solution, am also facing same problem
Chandrashekar T N
|
|
|
|
|
I want to deploy my application which requires .Net framework, SQL Express as prerequisites. So i created a setup project in VS2008 and selected .Net framework and SQL Server 2005 Express.
Now while installing my application at client's site, it first installs .Net framework followed by SQL Express 2005. But while installing SQL Express it does not prompt for the user to set the password for 'sa' user. There is no dialog displayed for user selection. It installs windows authentication mode. Is there a way to set the SQL Server autentication mode. Please note that i dont want to install SQL Server Management studio.
Your help is appreciated
Thanks
|
|
|
|
|
I have an managed C++ dll lib. It has claas info like below
namespace tests
{
public enum class clours
{
Start = 0;
Red = 1;
Green = 2;
Blue = 3;
End = 4;
}
}
I have written a client application in C# and load the dll dynamically(I am using reflection). I want to access the enum members and values between 'Start' and 'End' from the client application.
|
|
|
|
|
var fields = (from field in type.GetFields()
where (field.Attributes & System.Reflection.FieldAttributes.Literal) != 0
select field).ToArray();
Don't forget that without enum class or enum struct this code won't work.
The criteria in the where clause assumes that for a CLR enum, no fields other than the enum's constants marked as literal. I'm not completely sure if there are no special cases but you should research that a little bit before trusting that criteria.
Eslam Afifi
|
|
|
|
|
GetRawConstantValue() Method is not supported in .NET CF 2.0
anyone have any idea about how to get the value of enum constant?
Enum.GetNames() is not supported in .NET CF 2.0, but i could getting the name of enum constants.
Thanks.
---
Hossam Ahmed
|
|
|
|
|
Is there a way to display digital waveform in c# and also change its values?
|
|
|
|
|
You could always use this[^] to display the graph. If you want to change values, you want to manipulate the underlying data rather than the graph itself, and let the graph reflect those changes.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
How can i call image from a folder in my Solution to picturebox by coding (dynamically)!
|
|
|
|