[Mono-list] new color.cs for inclusion in CVS
Dennis Hayes
DENNISH@Raytek.com
Wed, 6 Mar 2002 15:39:39 -0800
Thanks for the info.
I will make the change and test, then repost assuming it works.
I am way fuzzy on structures and classes in C#.
I *think* I copied this type of constructor from the point class which is
also a static structure.
Assuming this works, I will make the change to all the appropriate classes
in the system.drawing tree.
Dennis
-----Original Message-----
From: Ben Houston [mailto:ben@exocortex.org]
Sent: Wednesday, March 06, 2002 3:31 PM
To: mono-list@ximian.com
Cc: 'Dennis Hayes'
Subject: RE: [Mono-list] new color.cs for inclusion in CVS
Hi Dennis,
Many of your constructors look like the following:
> public static Color FromArgb (int a,int r, int g, int b)
> {
> return new Color (a,r,g,b);
> }
The above may be really slow since it could require a box/unbox
operation to the struct when using the new operator (i.e. remember that
we are not using classes). Although, I find that I am sometimes wrong
about this stuff so maybe someone should check my facts. ;-)
I would have written it like this instead:
> public static Color FromArgb (int a,int r, int g, int b)
> {
> Color color;
> color.a = a;
> color.r = r;
> color.g = g;
> color.b = b;
> return color;
> }
Cheers,
-ben houston
4th Year Cognitive Science/Neuroscience
Carleton University, Ottawa, Canada
( ben@exocortex.org / 613-266-0637 )
> -----Original Message-----
> From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]
On
> Behalf Of Dennis Hayes
> Sent: Wednesday, March 06, 2002 3:50 PM
> To: 'mono-list@ximian.com'
> Subject: [Mono-list] new color.cs for inclusion in CVS
>
> Here is a decent start on the Color structure for
System.Drawing.Color.
> I plan to finish this and the System.Drawing.KnownColor structure in
the
> next few days.
> Could someone (mkestner?) put this in CVS for me?
> This compiles using Visual Studio, and passes some simple test.
> Will also try to add tests to nunit in next few days as well.
> Thanks.
> Dennis