Cairo::Surface->create_for_rectangle vs. $surf->create_similar



I recently wrapped cairo_surface_create_for_rectangle for Cairo. The natural syntax seemed to be

  Cairo::Surface->create_for_rectangle($target, $x, $y, $width, $height)

But I now realize that this is at odds with the wrapper for cairo_surface_create_similar which was written a long time ago:

  $old->create_similar($content, $width, $height)

But since create_similar() really is a constructor, not a method, I now think this would make more sense:

  Cairo::Surface->create_similar($old, ...)

What would you prefer?

a) wrap cairo_surface_create_for_rectangle as $target->create_for_rectangle($target, ...) to maintain similarity with create_similar()

b) wrap cairo_surface_create_for_rectangle as Cairo::Surface->create_for_rectangle($target, ...) and make it possible to use Cairo::Surface->create_similar($old, ...)¹

¹ In addition to the old syntax, of course.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]