|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.appengine.api.images.ImagesServiceFactory
public final class ImagesServiceFactory
Factory for creating an ImagesService
, Image
s and
Transform
s.
Method Summary | |
---|---|
static ImagesService |
getImagesService()
Creates an implementation of the ImagesService. |
static Composite |
makeComposite(Image image,
int xOffset,
int yOffset,
float opacity,
Composite.Anchor anchor)
Creates an image composition operation. |
static CompositeTransform |
makeCompositeTransform()
Creates a composite transform that can represent multiple transforms applied in series. |
static CompositeTransform |
makeCompositeTransform(java.util.Collection<Transform> transforms)
Creates a composite transform that can represent multiple transforms applied in series. |
static Transform |
makeCrop(double leftX,
double topY,
double rightX,
double bottomY)
Creates a transform that will crop an image to fit within the bounding box specified. |
static Transform |
makeCrop(float leftX,
float topY,
float rightX,
float bottomY)
Creates a transform that will crop an image to fit within the bounding box specified. |
static Transform |
makeHorizontalFlip()
Creates a transform that will horizontally flip an image. |
static Image |
makeImage(byte[] imageData)
Creates an image from the provided imageData . |
static Image |
makeImageFromBlob(BlobKey blobKey)
Create an image backed by the specified blobKey . |
static Transform |
makeImFeelingLucky()
Creates a transform that automatically adjust contrast and color levels. |
static Transform |
makeResize(int width,
int height)
Creates a transform that will resize an image to fit within a box with width width and height height . |
static Transform |
makeResize(int width,
int height,
boolean allowStretch)
Creates a resize transform that will resize an image to fit within a box of width width and height height . |
static Transform |
makeResize(int width,
int height,
double cropOffsetX,
double cropOffsetY)
Creates a transform that will resize an image to exactly fit a box with width width and height height by resizing to the less
constraining dimension and cropping the other. |
static Transform |
makeResize(int width,
int height,
float cropOffsetX,
float cropOffsetY)
Creates a transform that will resize an image to exactly fit a box with width width and height height by resizing to the less
constraining dimension and cropping the other. |
static Transform |
makeRotate(int degrees)
Creates a transform that rotates an image by degrees degrees
clockwise. |
static Transform |
makeVerticalFlip()
Creates a transform that will vertically flip an image. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ImagesService getImagesService()
public static Image makeImage(byte[] imageData)
imageData
.
imageData
- image data to store in the image
java.lang.IllegalArgumentException
- If imageData
is null or empty.public static Image makeImageFromBlob(BlobKey blobKey)
blobKey
. Note
that the returned Image
object can be used with all
ImagesService
methods, but most of the methods on the
Image itself will currently throw UnsupportedOperationException
.
blobKey
- referencing the image
public static Transform makeResize(int width, int height)
width
and height height
.
width
- width of the bounding boxheight
- height of the bounding box
java.lang.IllegalArgumentException
- If width
or height
are
negative or greater than MAX_RESIZE_DIMENSIONS
or if both
width
and height
are 0.public static Transform makeResize(int width, int height, boolean allowStretch)
width
and height height
. If allowStretch
is true
, the aspect ratio of the original image will be ignored.
width
- width of the bounding boxheight
- height of the bounding boxallowStretch
- allow the image to be resized ignoring the aspect ratio
java.lang.IllegalArgumentException
- If width
or height
are negative or greater
than MAX_RESIZE_DIMENSIONS
, if both width
and height
are 0 or
if is True and either width
or height
are 0.public static Transform makeResize(int width, int height, float cropOffsetX, float cropOffsetY)
width
and height height
by resizing to the less
constraining dimension and cropping the other. The center of the crop
region is controlled by cropOffsetX
and cropOffsetY
.
width
- width of the bounding boxheight
- height of the bounding boxcropOffsetX
- the relative horizontal position of the centercropOffsetY
- the relative vertical position of the center
java.lang.IllegalArgumentException
- If width
or height
are
negative or greater than MAX_RESIZE_DIMENSIONS
, if either of
width
and height
are 0 or if cropOffsetX
or
cropOffsetY
are outside the range 0.0 to 1.0.public static Transform makeResize(int width, int height, double cropOffsetX, double cropOffsetY)
width
and height height
by resizing to the less
constraining dimension and cropping the other. The center of the crop
region is controlled by cropOffsetX
and cropOffsetY
.
width
- width of the bounding boxheight
- height of the bounding boxcropOffsetX
- the relative horizontal position of the centercropOffsetY
- the relative vertical position of the center
java.lang.IllegalArgumentException
- If width
or height
are
negative or greater than MAX_RESIZE_DIMENSIONS
, if either of
width
and height
are 0 or if cropOffsetX
or
cropOffsetY
are outside the range 0.0 to 1.0.public static Transform makeCrop(float leftX, float topY, float rightX, float bottomY)
leftX
- X coordinate of the top left corner of the bounding boxtopY
- Y coordinate of the top left corner of the bounding boxrightX
- X coordinate of the bottom right corner of the bounding boxbottomY
- Y coordinate of the bottom right corner of the bounding box
java.lang.IllegalArgumentException
- If any of the arguments are outside the
range 0.0 to 1.0 or if leftX >= rightX
or topY >= bottomY
.public static Transform makeCrop(double leftX, double topY, double rightX, double bottomY)
leftX
- X coordinate of the top left corner of the bounding boxtopY
- Y coordinate of the top left corner of the bounding boxrightX
- X coordinate of the bottom right corner of the bounding boxbottomY
- Y coordinate of the bottom right corner of the bounding box
java.lang.IllegalArgumentException
- If any of the arguments are outside the
range 0.0 to 1.0 or if leftX >= rightX
or topY >= bottomY
.public static Transform makeVerticalFlip()
public static Transform makeHorizontalFlip()
public static Transform makeRotate(int degrees)
degrees
degrees
clockwise.
degrees
- The number of degrees by which to rotate. Must be a
multiple of 90.
java.lang.IllegalArgumentException
- If degrees
is not divisible by 90public static Transform makeImFeelingLucky()
public static CompositeTransform makeCompositeTransform(java.util.Collection<Transform> transforms)
transforms
- Transforms for this composite transform to apply.
public static CompositeTransform makeCompositeTransform()
public static Composite makeComposite(Image image, int xOffset, int yOffset, float opacity, Composite.Anchor anchor)
image
- The image to be composited.xOffset
- Offset in the x axis from the anchor point.yOffset
- Offset in the y axis from the anchor point.opacity
- Opacity to be used for the image in range [0.0, 1.0].anchor
- Anchor position from the enum Composite.Anchor
.
The anchor position of the image is aligned with the anchor position of
the canvas and then the offsets are applied.
java.lang.IllegalArgumentException
- If image
is null or empty,
xOffset
or yOffset
is outside the range
[-4000,
4000],
opacity
is outside the range [0.0, 1.0] or anchor
is null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |