[Mono-list] System.Drawing.Color.FromArgb(), why int parameters?

Stifu stifu at free.fr
Thu Aug 25 03:48:02 EDT 2011


Yes, I did double check CLS compliance, and bytes are alright.
I thought maybe it could be performance related, like ints are faster / more
optimized in some cases, although they take more memory... *shrugs*

I think I'll just use bytes, indeed, unless someone else has another
opinion.

Thanks for your help.


Alex wrote:
> 
> Hi,
> 
> I don't think the framework design guidelines nor the CLS are against
> using bytes here, so I think you should do just that.
> 
> Regards,
> Alex
> 
> On Thu, Aug 25, 2011 at 9:32 AM, Stifu <stifu at free.fr> wrote:
>> Hmm, okay.
>> Maybe some sort of mistake they couldn't fix later due to backward
>> compatibility, or something.
>>
>> I'm asking about this because I'm working on an open-source project, and
>> a
>> contributor submitted patches that do similar stuff: color-related
>> methods
>> that take int parameters. When I asked the contributor why he used ints
>> rather than bytes, he answered he just did it like Color.FromArgb(),
>> although he didn't know why it was like that in Color.FromArgb()...
>>
>>
>> Alex wrote:
>>>
>>> Hi,
>>>
>>> I would guess for some sort of crazy API design guideline. Other than
>>> that, I can't see any reason.
>>>
>>> Regards,
>>> Alex
>>>
>>> On Thu, Aug 25, 2011 at 8:15 AM, Stifu <stifu at free.fr> wrote:
>>>> Hi,
>>>>
>>>> I have a quick question about the System.Drawing.Color.FromArgb()
>>>> method
>>>> (which also applies to other similar methods).
>>>>
>>>> http://msdn.microsoft.com/en-us/library/at1k42eh.aspx
>>>>
>>>> Does anyone know why it takes int parameters, rather than bytes,
>>>> considering
>>>> expected values should go from 0 to 255?
>>>>
>>>> Thanks!
>>>>
>>>> --
>>>> View this message in context:
>>>> http://mono.1490590.n4.nabble.com/System-Drawing-Color-FromArgb-why-int-parameters-tp3767434p3767434.html
>>>> Sent from the Mono - General mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>>>
>>> _______________________________________________
>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>>
>>
>>
>> --
>> View this message in context:
>> http://mono.1490590.n4.nabble.com/System-Drawing-Color-FromArgb-why-int-parameters-tp3767434p3767558.html
>> Sent from the Mono - General mailing list archive at Nabble.com.
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 


--
View this message in context: http://mono.1490590.n4.nabble.com/System-Drawing-Color-FromArgb-why-int-parameters-tp3767434p3767580.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list