Click here to Skip to main content
15,913,722 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: save my codes source Pin
Abhinav S24-May-13 1:24
Abhinav S24-May-13 1:24 
AnswerRe: save my codes source Pin
MaulikDusara26-May-13 18:15
MaulikDusara26-May-13 18:15 
Questionvalidating on custom datagridview column Pin
sh-a19-May-13 23:56
sh-a19-May-13 23:56 
AnswerRe: validating on custom datagridview column Pin
sh-a22-May-13 4:27
sh-a22-May-13 4:27 
QuestionDialogBasics asin MFC. Pin
Bram van Kampen15-May-13 13:58
Bram van Kampen15-May-13 13:58 
AnswerRe: DialogBasics asin MFC. Pin
Richard MacCutchan15-May-13 22:10
mveRichard MacCutchan15-May-13 22:10 
GeneralRe: DialogBasics as in MFC. Pin
Bram van Kampen16-May-13 14:05
Bram van Kampen16-May-13 14:05 
GeneralRe: DialogBasics as in MFC. Pin
Richard MacCutchan16-May-13 21:07
mveRichard MacCutchan16-May-13 21:07 
GeneralRe: DialogBasics as in MFC. Pin
Bram van Kampen17-May-13 9:35
Bram van Kampen17-May-13 9:35 
GeneralRe: DialogBasics as in MFC. Pin
Richard MacCutchan17-May-13 22:45
mveRichard MacCutchan17-May-13 22:45 
QuestionI suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger15-May-13 11:43
M-Badger15-May-13 11:43 
AnswerRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
Eddy Vluggen16-May-13 5:01
professionalEddy Vluggen16-May-13 5:01 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 8:34
M-Badger16-May-13 8:34 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
Eddy Vluggen16-May-13 9:13
professionalEddy Vluggen16-May-13 9:13 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 9:57
M-Badger16-May-13 9:57 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
Eddy Vluggen16-May-13 11:25
professionalEddy Vluggen16-May-13 11:25 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 9:58
M-Badger16-May-13 9:58 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
Eddy Vluggen16-May-13 11:26
professionalEddy Vluggen16-May-13 11:26 
AnswerRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
jschell16-May-13 7:57
jschell16-May-13 7:57 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger16-May-13 8:37
M-Badger16-May-13 8:37 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
jschell17-May-13 10:13
jschell17-May-13 10:13 
AnswerRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
TnTinMn16-May-13 13:37
TnTinMn16-May-13 13:37 
It looks like you found a solution that you are happy with, but I thought that I would throw my 2 cents worth into the fray.

Based on my understanding of your code, the Luminosity method is the only one that needs a second parameter. Why not remove Luminosity from your methods enum and change:

Public Overloads Sub ToGreyScale(ByVal method As RGBGreyScaleMethod, ByVal factors as LumaEnum)

to:

Public Overloads Sub ToGreyScale(ByVal factors as LumaEnum)

I think that this would given you the intuitiveness factor that you are seeking.

As I don't know what it all is that you are doing in this "Class" the following may not be relevant, but I will throw it out as an alternative. It appears that all you are using it for is to convert a Color structure to its equivalent greyscale color. Perhaps, this may be a case for using extension methods to the Color Structure.
XML
Module GreyScaleExtentions
   Public Enum RBGMethods
       Average
       BlueChannel
       Decompose
       Desaturate
       Lightness
       RedChannel
       GreenChannel
   End Enum

   Public Enum LumaEnum
       BT709
       BT601
       GIMP
   End Enum

   ''' <summary>
   ''' Converts Color to greyscale equivalent using RGBGreyScaleMethod
   ''' </summary>
   ''' <param name="c"></param>
   ''' <param name="RGBMethod"></param>
   ''' <returns></returns>
   ''' <remarks></remarks>
   <Runtime.CompilerServices.Extension()> _
   Public Function ToGreyScale(ByVal c As Color, ByVal RGBMethod As RBGMethods) As Color

   End Function

   ''' <summary>
   ''' Converts Color to greyscale equivalent using luminosity method
   ''' </summary>
   ''' <param name="c"></param>
   ''' <param name="factors"></param>
   ''' <returns></returns>
   ''' <remarks></remarks>
   <Runtime.CompilerServices.Extension()> _
   Public Function ToGreyScale(ByVal c As Color, ByVal factors As LumaEnum) As Color

   End Function
End Module

Then you could use like this:
VB
Sub test()
   Dim c As Color = Color.FromArgb(230, 134, 231, 10)
   Dim gs As Color
   gs = c.ToGreyScale(LumaEnum.BT601)
   gs = c.ToGreyScale(RBGMethods.Average)
End Sub

GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger17-May-13 6:49
M-Badger17-May-13 6:49 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
TnTinMn17-May-13 8:33
TnTinMn17-May-13 8:33 
GeneralRe: I suspect there's a Pattern for This: Optional Parameters vs. Overloading Pin
M-Badger17-May-13 21:47
M-Badger17-May-13 21:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.