I have the following in C
typedef void (*procfunc)(V2fT2f *, float);
typedef struct {
procfunc func;
procfunc degen;
} Filter;
const Filter filter[] = {
{ brightness },
{ contrast },
{ extrapolate, greyscale },
{ hue },
{ extrapolate, blur }, // The blur could be exaggerated by downsampling to half size
};
which I have brought over to C# to give me this
public delegate void procfunc(ImagingDefs.V2fT2f[] quad,float t);
public class Filter
{
public procfunc func;
public procfunc degen;
};
public Filter[] filter = new Filter[]
{
new Filter { func = brightness },
new Filter { func = contrast },
new Filter { func = extrapolate, degen = greyscale },
new Filter { func = hue },
new Filter { func = extrapolate, degen = blur } // The blur could be exaggerated by downsampling to half size
};
My issue is that I'm getting the error
A field initializer cannot reference the nonstatic field, method or property.
I have a feeling that the issue is with the delegate, but I'm not sure - I've never needed to port this sort of code before.
Neither ImagingDefs nor V2fT2f are declared as static
The methods being called are typically
public void foo(ImagingDefs.V2fT2f[]quad, float t)
with nothing anywhere being static.
The name V2fT2f comes from the original source code
V2fT2fis not a particularly descriptive type name. I'd highly suggest using a more meaningful name.