示例#1
0
static void HHVM_METHOD(ImagickDraw, __construct) {
  auto wand = NewDrawingWand();
  if (wand == nullptr) {
    IMAGICKDRAW_THROW("Failed to create ImagickDraw object");
  } else {
    setWandResource(s_ImagickDraw, Object{this_}, wand);
  }
}
示例#2
0
static void HHVM_METHOD(ImagickDraw, __clone) {
  auto wand = getDrawingWandResource(Object{this_});
  auto newWand = CloneDrawingWand(wand->getWand());
  if (newWand == nullptr) {
    IMAGICKDRAW_THROW("Failed to allocate DrawingWand structure");
  } else {
    setWandResource(s_ImagickDraw, Object{this_}, newWand);
  }
}
示例#3
0
static void HHVM_METHOD(ImagickPixel, __construct, const String& color) {
  auto wand = NewPixelWand();
  if (wand == nullptr) {
    IMAGICKPIXEL_THROW("Failed to allocate PixelWand structure");
  } else {
    setWandResource(s_ImagickPixel, this_, wand);
  }
  if (!color.isNull() && !color.empty()) {
    if (PixelSetColor(wand, color.c_str()) == MagickFalse) {
      IMAGICKPIXEL_THROW("Unable to construct ImagickPixel");
    }
  }
}
示例#4
0
static bool HHVM_METHOD(ImagickDraw, setResolution,
    double x, double y) {
  auto wand = getDrawingWandResource(Object{this_});
  std::ostringstream density;
  density << x << "x" << y;

  auto drawInfo = PeekDrawingWand(wand->getWand());
  drawInfo->density = AcquireString(density.str().c_str());
  auto drawWand = DrawAllocateWand(drawInfo, nullptr);
  if (drawWand == nullptr) {
    IMAGICKDRAW_THROW("Failed to allocate new DrawingWand structure");
  }
  setWandResource(s_ImagickDraw, Object{this_}, drawWand);
  return true;
}
示例#5
0
Object createImagickPixel(PixelWand* wand, bool owner) {
  Object ret = ImagickPixel::allocObject();
  setWandResource(s_ImagickPixel, ret, wand, owner);
  return ret;
}