Beispiel #1
0
static bool HHVM_METHOD(ImagickDraw, roundRectangle,
                        double x1, double y1, double x2, double y2,
                        double rx, double ry) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawRoundRectangle(wand->getWand(), x1, y1, x2, y2, rx, ry);
  return true;
}
Beispiel #2
0
static bool HHVM_METHOD(ImagickDraw, setStrokeColor,
    const Variant& stroke_pixel) {
  auto wand = getDrawingWandResource(Object{this_});
  auto pixel(buildColorWand(stroke_pixel));
  DrawSetStrokeColor(wand->getWand(), pixel->getWand());
  return true;
}
Beispiel #3
0
static bool HHVM_METHOD(ImagickDraw, setFillColor,
    const Variant& fill_pixel) {
  auto wand = getDrawingWandResource(this_);
  auto pixel(buildColorWand(fill_pixel));
  DrawSetFillColor(wand->getWand(), pixel->getWand());
  return true;
}
Beispiel #4
0
static bool HHVM_METHOD(ImagickDraw, pathCurveToRelative,
                        double x1, double y1, double x2, double y2,
                        double x, double y) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawPathCurveToRelative(wand->getWand(), x1, y1, x2, y2, x, y);
  return true;
}
Beispiel #5
0
static bool HHVM_METHOD(ImagickDraw, ellipse,
                        double ox, double oy, double rx, double ry,
                        double start, double end) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawEllipse(wand->getWand(), ox, oy, rx, ry, start, end);
  return true;
}
Beispiel #6
0
static bool HHVM_METHOD(ImagickDraw, setTextUnderColor,
    const Variant& under_color) {
  auto wand = getDrawingWandResource(Object{this_});
  auto pixel(buildColorWand(under_color));
  DrawSetTextUnderColor(wand->getWand(), pixel->getWand());
  return true;
}
Beispiel #7
0
static bool HHVM_METHOD(ImagickDraw, arc, double sx, double sy,
                                          double ex, double ey,
                                          double sd, double ed) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawArc(wand->getWand(), sx, sy, ex, ey, sd, ed);
  return true;
}
Beispiel #8
0
static bool HHVM_METHOD(ImagickDraw, pathCurveToAbsolute,
                        double x1, double y1, double x2, double y2,
                        double x, double y) {
  auto wand = getDrawingWandResource(this_);
  DrawPathCurveToAbsolute(wand->getWand(), x1, y1, x2, y2, x, y);
  return true;
}
Beispiel #9
0
static bool HHVM_METHOD(ImagickDraw, push) {
  auto wand = getDrawingWandResource(Object{this_});
  auto status = PushDrawingWand(wand->getWand());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to push the current ImagickDraw object");
  }
  return true;
}
Beispiel #10
0
static bool HHVM_METHOD(ImagickDraw, popPattern) {
  auto wand = getDrawingWandResource(Object{this_});
  auto status = DrawPopPattern(wand->getWand());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to terminate the pattern definition");
  }
  return true;
}
Beispiel #11
0
static bool HHVM_METHOD(ImagickDraw, setClipPath,
    const String& clip_mask) {
  auto wand = getDrawingWandResource(Object{this_});
  auto status = DrawSetClipPath(wand->getWand(), clip_mask.c_str());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to set clipping path");
  }
  return true;
}
Beispiel #12
0
static bool HHVM_METHOD(ImagickDraw, pathEllipticArcRelative,
                        double rx, double ry, double x_axis_rotation,
                        bool large_arc_flag, bool sweep_flag,
                        double x, double y) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawPathEllipticArcRelative(wand->getWand(), rx, ry, x_axis_rotation,
    toMagickBool(large_arc_flag), toMagickBool(sweep_flag), x, y);
  return true;
}
Beispiel #13
0
static bool HHVM_METHOD(ImagickDraw, setFillPatternURL,
    const String& fill_url) {
  auto wand = getDrawingWandResource(this_);
  auto status = DrawSetFillPatternURL(wand->getWand(), fill_url.c_str());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to set fill pattern URL");
  }
  return true;
}
Beispiel #14
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);
  }
}
Beispiel #15
0
static bool HHVM_METHOD(ImagickDraw, setStrokePatternURL,
    const String& stroke_url) {
  auto wand = getDrawingWandResource(Object{this_});
  auto status = DrawSetStrokePatternURL(wand->getWand(), stroke_url.c_str());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to set stroke pattern URL");
  }
  return true;
}
Beispiel #16
0
static bool HHVM_METHOD(ImagickDraw, setVectorGraphics,
    const String& xml) {
  auto wand = getDrawingWandResource(Object{this_});
  auto status = DrawSetVectorGraphics(wand->getWand(), xml.c_str());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to set the vector graphics");
  }
  return true;
}
Beispiel #17
0
static bool HHVM_METHOD(ImagickDraw, setFontWeight,
    int64_t font_weight) {
  auto wand = getDrawingWandResource(Object{this_});
  if (100 <= font_weight && font_weight <= 900) {
    DrawSetFontWeight(wand->getWand(), font_weight);
    return true;
  } else {
    IMAGICKDRAW_THROW("Font weight valid range is 100-900");
  }
}
Beispiel #18
0
static bool HHVM_METHOD(ImagickDraw, setStrokeDashArray,
    const Array& dashArray) {
  auto wand = getDrawingWandResource(Object{this_});
  auto dashes = toDoubleArray(dashArray);
  if (dashes.empty()) {
    IMAGICKDRAW_THROW("Cannot read stroke dash array parameter");
  }
  DrawSetStrokeDashArray(wand->getWand(), dashes.size(), dashes.data());
  return true;
}
Beispiel #19
0
static bool HHVM_METHOD(ImagickDraw, bezier,
    const Array& coordinates) {
  auto wand = getDrawingWandResource(Object{this_});
  auto points = toPointInfoArray(coordinates);
  if (points.empty()) {
    IMAGICKDRAW_THROW("Unable to read coordinate array");
  }
  DrawBezier(wand->getWand(), points.size(), points.data());
  return true;
}
Beispiel #20
0
static bool HHVM_METHOD(ImagickDraw, render) {
  auto wand = getDrawingWandResource(Object{this_});
  auto status = withMagickLocaleFix([&wand]{
    return DrawRender(wand->getWand());
  });
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to render the drawing commands");
  }
  return true;
}
Beispiel #21
0
static bool HHVM_METHOD(ImagickDraw, setFontFamily,
    const String& font_family) {
  auto wand = getDrawingWandResource(Object{this_});
  if (font_family.empty()) {
    IMAGICKDRAW_THROW("Can not set empty font family");
  }
  auto status = DrawSetFontFamily(wand->getWand(), font_family.c_str());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to set font family");
  }
  return true;
}
Beispiel #22
0
static bool HHVM_METHOD(ImagickDraw, affine, const Array& affine) {
  auto wand = getDrawingWandResource(Object{this_});
  AffineMatrix affineMatrix;
  getAffineMatrixElement(affine, s_sx, affineMatrix.sx);
  getAffineMatrixElement(affine, s_rx, affineMatrix.rx);
  getAffineMatrixElement(affine, s_ry, affineMatrix.ry);
  getAffineMatrixElement(affine, s_sy, affineMatrix.sy);
  getAffineMatrixElement(affine, s_tx, affineMatrix.tx);
  getAffineMatrixElement(affine, s_ty, affineMatrix.ty);
  DrawAffine(wand->getWand(), &affineMatrix);
  return true;
}
Beispiel #23
0
static bool HHVM_METHOD(ImagickDraw, composite,
                        int64_t compose,
                        double x, double y, double width, double height,
                        const Object& compositeWand) {
  auto wand = getDrawingWandResource(Object{this_});
  Object compositeWandObj(compositeWand);
  auto magick = getMagickWandResource(compositeWandObj);
  auto status = DrawComposite(wand->getWand(), (CompositeOperator)compose,
                              x, y, width, height, magick->getWand());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Compositing image failed");
  }
  return true;
}
Beispiel #24
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;
}
Beispiel #25
0
static bool HHVM_METHOD(ImagickDraw, setFont,
    const String& font_name) {
  auto wand = getDrawingWandResource(Object{this_});
  if (font_name.empty()) {
    IMAGICKDRAW_THROW("Can not set empty font");
  }
  auto font = magickResolveFont(font_name);
  if (font.isNull()) {
    IMAGICKDRAW_THROW("Unable to set font, file path expansion failed");
  }
  auto status = DrawSetFont(wand->getWand(), font.c_str());
  if (status == MagickFalse) {
    IMAGICKDRAW_THROW("Unable to set font");
  }
  return true;
}
Beispiel #26
0
static bool HHVM_METHOD(ImagickDraw, translate,
    double x, double y) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawTranslate(wand->getWand(), x, y);
  return true;
}
Beispiel #27
0
static bool HHVM_METHOD(ImagickDraw, skewY, double degrees) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawSkewY(wand->getWand(), degrees);
  return true;
}
Beispiel #28
0
static bool HHVM_METHOD(ImagickDraw, clear) {
  auto wand = getDrawingWandResource(Object{this_});
  ClearDrawingWand(wand->getWand());
  return true;
}
Beispiel #29
0
static bool HHVM_METHOD(ImagickDraw, setViewbox,
    int64_t x1, int64_t y1, int64_t x2, int64_t y2) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawSetViewbox(wand->getWand(), x1, y1, x2, y2);
  return true;
}
Beispiel #30
0
static bool HHVM_METHOD(ImagickDraw, setTextEncoding,
    const String& encoding) {
  auto wand = getDrawingWandResource(Object{this_});
  DrawSetTextEncoding(wand->getWand(), encoding.c_str());
  return true;
}