C ++指向类内部函数的指针

时间:2014-09-22 14:41:00

标签: c++

我有一个名为maker的类,类中的以下代码无法编译,错误是:

cannot convert from 'void (__cdecl maker::* )(const int,const int,const FT_Span *const ,void *const )' to 'FT_SpanFunc'

void
RasterCallback(const int y,
               const int count,
               const FT_Span * const spans,
               void * const user) 
{
  Spans *sptr = (Spans *)user;
  for (int i = 0; i < count; ++i) 
    sptr->push_back(Span(spans[i].x, y, spans[i].len, spans[i].coverage));
}

void
RenderSpans(FT_Library &library,
            FT_Outline * const outline,
            Spans *spans) 
{
  FT_Raster_Params params;
  memset(&params, 0, sizeof(params));
  params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
  params.gray_spans = &RasterCallback;//here is the error
  params.user = spans;

  FT_Outline_Render(library, outline, &params);
}

上面的代码在课堂外运行得非常好。有人可以帮助我吗?

0 个答案:

没有答案