ImagickDraw::setGravity
(PECL imagick 2.0.0)
ImagickDraw::setGravity — Sets the text placement gravity
Description
bool ImagickDraw::setGravity
( int
$gravity
)Warning
This function is currently not documented; only its argument list is available.
Sets the text placement gravity to use when annotating with text.
Parameters
-
gravity
-
GRAVITY_ constant
Return Values
No value is returned.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Обработка и генерация изображений
- Обработка изображений (ImageMagick)
- Функция ImagickDraw::affine() - Adjusts the current affine transformation matrix
- Функция ImagickDraw::annotation() - Draws text on the image
- Функция ImagickDraw::arc() - Draws an arc
- Функция ImagickDraw::bezier() - Draws a bezier curve
- Функция ImagickDraw::circle() - Draws a circle
- Функция ImagickDraw::clear() - Clears the ImagickDraw
- Функция ImagickDraw::clone() - Makes an exact copy of the specified ImagickDraw object
- Функция ImagickDraw::color() - Draws color on image
- Функция ImagickDraw::comment() - Adds a comment
- Функция ImagickDraw::composite() - Composites an image onto the current image
- Функция ImagickDraw::__construct() - The ImagickDraw constructor
- Функция ImagickDraw::destroy() - Frees all associated resources
- Функция ImagickDraw::ellipse() - Draws an ellipse on the image
- Функция ImagickDraw::getClipPath() - Obtains the current clipping path ID
- Функция ImagickDraw::getClipRule() - Returns the current polygon fill rule
- Функция ImagickDraw::getClipUnits() - Returns the interpretation of clip path units
- Функция ImagickDraw::getFillColor() - Returns the fill color
- Функция ImagickDraw::getFillOpacity() - Returns the opacity used when drawing
- Функция ImagickDraw::getFillRule() - Returns the fill rule
- Функция ImagickDraw::getFont() - Returns the font
- Функция ImagickDraw::getFontFamily() - Returns the font family
- Функция ImagickDraw::getFontSize() - Returns the font pointsize
- ImagickDraw::getFontStretch
- Функция ImagickDraw::getFontStyle() - Returns the font style
- Функция ImagickDraw::getFontWeight() - Returns the font weight
- Функция ImagickDraw::getGravity() - Returns the text placement gravity
- Функция ImagickDraw::getStrokeAntialias() - Returns the current stroke antialias setting
- Функция ImagickDraw::getStrokeColor() - Returns the color used for stroking object outlines
- Функция ImagickDraw::getStrokeDashArray() - Returns an array representing the pattern of dashes and gaps used to stroke paths
- Функция ImagickDraw::getStrokeDashOffset() - Returns the offset into the dash pattern to start the dash
- Функция ImagickDraw::getStrokeLineCap() - Returns the shape to be used at the end of open subpaths when they are stroked
- Функция ImagickDraw::getStrokeLineJoin() - Returns the shape to be used at the corners of paths when they are stroked
- Функция ImagickDraw::getStrokeMiterLimit() - Returns the stroke miter limit
- Функция ImagickDraw::getStrokeOpacity() - Returns the opacity of stroked object outlines
- Функция ImagickDraw::getStrokeWidth() - Returns the width of the stroke used to draw object outlines
- Функция ImagickDraw::getTextAlignment() - Returns the text alignment
- Функция ImagickDraw::getTextAntialias() - Returns the current text antialias setting
- Функция ImagickDraw::getTextDecoration() - Returns the text decoration
- Функция ImagickDraw::getTextEncoding() - Returns the code set used for text annotations
- ImagickDraw::getTextInterlineSpacing
- ImagickDraw::getTextInterwordSpacing
- ImagickDraw::getTextKerning
- Функция ImagickDraw::getTextUnderColor() - Returns the text under color
- Функция ImagickDraw::getVectorGraphics() - Returns a string containing vector graphics
- Функция ImagickDraw::line() - Draws a line
- Функция ImagickDraw::matte() - Paints on the image's opacity channel
- Функция ImagickDraw::pathClose() - Adds a path element to the current path
- Функция ImagickDraw::pathCurveToAbsolute() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierAbsolute() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierRelative() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierSmoothRelative() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToRelative() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathCurveToSmoothAbsolute() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathCurveToSmoothRelative() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathEllipticArcAbsolute() - Draws an elliptical arc
- Функция ImagickDraw::pathEllipticArcRelative() - Draws an elliptical arc
- Функция ImagickDraw::pathFinish() - Terminates the current path
- Функция ImagickDraw::pathLineToAbsolute() - Draws a line path
- Функция ImagickDraw::pathLineToHorizontalAbsolute() - Draws a horizontal line path
- Функция ImagickDraw::pathLineToHorizontalRelative() - Draws a horizontal line
- Функция ImagickDraw::pathLineToRelative() - Draws a line path
- Функция ImagickDraw::pathLineToVerticalAbsolute() - Draws a vertical line
- Функция ImagickDraw::pathLineToVerticalRelative() - Draws a vertical line path
- Функция ImagickDraw::pathMoveToAbsolute() - Starts a new sub-path
- Функция ImagickDraw::pathMoveToRelative() - Starts a new sub-path
- Функция ImagickDraw::pathStart() - Declares the start of a path drawing list
- Функция ImagickDraw::point() - Draws a point
- Функция ImagickDraw::polygon() - Draws a polygon
- Функция ImagickDraw::polyline() - Draws a polyline
- Функция ImagickDraw::pop() - Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw
- Функция ImagickDraw::popClipPath() - Terminates a clip path definition
- Функция ImagickDraw::popDefs() - Terminates a definition list
- Функция ImagickDraw::popPattern() - Terminates a pattern definition
- Функция ImagickDraw::push() - Clones the current ImagickDraw and pushes it to the stack
- Функция ImagickDraw::pushClipPath() - Starts a clip path definition
- Функция ImagickDraw::pushDefs() - Indicates that following commands create named elements for early processing
- Функция ImagickDraw::pushPattern() - Indicates that subsequent commands up to a ImagickDraw::opPattern() command comprise the definition of a named pattern
- Функция ImagickDraw::rectangle() - Draws a rectangle
- Функция ImagickDraw::render() - Renders all preceding drawing commands onto the image
- ImagickDraw::resetVectorGraphics
- Функция ImagickDraw::rotate() - Applies the specified rotation to the current coordinate space
- Функция ImagickDraw::roundRectangle() - Draws a rounded rectangle
- Функция ImagickDraw::scale() - Adjusts the scaling factor
- Функция ImagickDraw::setClipPath() - Associates a named clipping path with the image
- Функция ImagickDraw::setClipRule() - Set the polygon fill rule to be used by the clipping path
- Функция ImagickDraw::setClipUnits() - Sets the interpretation of clip path units
- Функция ImagickDraw::setFillAlpha() - Sets the opacity to use when drawing using the fill color or fill texture
- Функция ImagickDraw::setFillColor() - Sets the fill color to be used for drawing filled objects
- Функция ImagickDraw::setFillOpacity() - Sets the opacity to use when drawing using the fill color or fill texture
- Функция ImagickDraw::setFillPatternURL() - Sets the URL to use as a fill pattern for filling objects
- Функция ImagickDraw::setFillRule() - Sets the fill rule to use while drawing polygons
- Функция ImagickDraw::setFont() - Sets the fully-specified font to use when annotating with text
- Функция ImagickDraw::setFontFamily() - Sets the font family to use when annotating with text
- Функция ImagickDraw::setFontSize() - Sets the font pointsize to use when annotating with text
- Функция ImagickDraw::setFontStretch() - Sets the font stretch to use when annotating with text
- Функция ImagickDraw::setFontStyle() - Sets the font style to use when annotating with text
- Функция ImagickDraw::setFontWeight() - Sets the font weight
- Функция ImagickDraw::setGravity() - Sets the text placement gravity
- ImagickDraw::setResolution
- Функция ImagickDraw::setStrokeAlpha() - Specifies the opacity of stroked object outlines
- Функция ImagickDraw::setStrokeAntialias() - Controls whether stroked outlines are antialiased
- Функция ImagickDraw::setStrokeColor() - Sets the color used for stroking object outlines
- Функция ImagickDraw::setStrokeDashArray() - Specifies the pattern of dashes and gaps used to stroke paths
- Функция ImagickDraw::setStrokeDashOffset() - Specifies the offset into the dash pattern to start the dash
- Функция ImagickDraw::setStrokeLineCap() - Specifies the shape to be used at the end of open subpaths when they are stroked
- Функция ImagickDraw::setStrokeLineJoin() - Specifies the shape to be used at the corners of paths when they are stroked
- Функция ImagickDraw::setStrokeMiterLimit() - Specifies the miter limit
- Функция ImagickDraw::setStrokeOpacity() - Specifies the opacity of stroked object outlines
- Функция ImagickDraw::setStrokePatternURL() - Sets the pattern used for stroking object outlines
- Функция ImagickDraw::setStrokeWidth() - Sets the width of the stroke used to draw object outlines
- Функция ImagickDraw::setTextAlignment() - Specifies a text alignment
- Функция ImagickDraw::setTextAntialias() - Controls whether text is antialiased
- Функция ImagickDraw::setTextDecoration() - Specifies a decoration
- Функция ImagickDraw::setTextEncoding() - Specifies specifies the text code set
- ImagickDraw::setTextInterlineSpacing
- ImagickDraw::setTextInterwordSpacing
- ImagickDraw::setTextKerning
- Функция ImagickDraw::setTextUnderColor() - Specifies the color of a background rectangle
- Функция ImagickDraw::setVectorGraphics() - Sets the vector graphics
- Функция ImagickDraw::setViewbox() - Sets the overall canvas size
- Функция ImagickDraw::skewX() - Skews the current coordinate system in the horizontal direction
- Функция ImagickDraw::skewY() - Skews the current coordinate system in the vertical direction
- Функция ImagickDraw::translate() - Applies a translation to the current coordinate system
Коментарии
Gravity constants are very useful as they can save having to calculate the placement of variable text strings and font sizes.
For example:
$draw->setGravity (Imagick::GRAVITY_CENTER);
$image->annotateImage($draw, 0, 0, 0, 'The quick brown fox jumps over the lazy dog');
Will horizontally and vertically center the text string.
Note, there are several gravity constants available. See, Constants — Imagick class constants
It appears that the GRAVITY constants have an integer equivalent:
NORTHWEST = 1
NORTH = 2
NORTHEAST = 3
WEST = 4
CENTER = 5
EAST = 6
SOUTHWEST = 7
SOUTH = 8
SOUTHEAST = 9