Interface IImagesServiceFactory (2.0.0)

public interface IImagesServiceFactory

Factory for creating an ImagesService, Images and Transforms.

Methods

getImagesService()

public abstract ImagesService getImagesService()

Creates an implementation of the ImagesService.

Returns
TypeDescription
ImagesService

an images service

makeComposite(Image image, int xOffset, int yOffset, float opacity, Composite.Anchor anchor)

public abstract Composite makeComposite(Image image, int xOffset, int yOffset, float opacity, Composite.Anchor anchor)

Creates an image composition operation.

Parameters
NameDescription
imageImage

The image to be composited.

xOffsetint

Offset in the x axis from the anchor point.

yOffsetint

Offset in the y axis from the anchor point.

opacityfloat

Opacity to be used for the image in range [0.0, 1.0].

anchorComposite.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.

Returns
TypeDescription
Composite

A composition operation.

makeCompositeTransform()

public abstract CompositeTransform makeCompositeTransform()

Creates a composite transform that can represent multiple transforms applied in series.

Returns
TypeDescription
CompositeTransform

an empty composite transform

makeCompositeTransform(Collection<Transform> transforms)

public abstract CompositeTransform makeCompositeTransform(Collection<Transform> transforms)

Creates a composite transform that can represent multiple transforms applied in series.

Parameter
NameDescription
transformsCollection<Transform>

Transforms for this composite transform to apply.

Returns
TypeDescription
CompositeTransform

a composite transform containing the provided transforms

makeCrop(double leftX, double topY, double rightX, double bottomY)

public abstract 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.

The arguments define the top left and bottom right corners of the bounding box used to crop the image as a percentage of the total image size. Each argument should be in the range 0.0 to 1.0 inclusive.

Parameters
NameDescription
leftXdouble

X coordinate of the top left corner of the bounding box

topYdouble

Y coordinate of the top left corner of the bounding box

rightXdouble

X coordinate of the bottom right corner of the bounding box

bottomYdouble

Y coordinate of the bottom right corner of the bounding box

Returns
TypeDescription
Transform

a crop transform

makeCrop(float leftX, float topY, float rightX, float bottomY)

public abstract 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.

The arguments define the top left and bottom right corners of the bounding box used to crop the image as a percentage of the total image size. Each argument should be in the range 0.0 to 1.0 inclusive.

Parameters
NameDescription
leftXfloat

X coordinate of the top left corner of the bounding box

topYfloat

Y coordinate of the top left corner of the bounding box

rightXfloat

X coordinate of the bottom right corner of the bounding box

bottomYfloat

Y coordinate of the bottom right corner of the bounding box

Returns
TypeDescription
Transform

a crop transform

makeHorizontalFlip()

public abstract Transform makeHorizontalFlip()

Creates a transform that will horizontally flip an image.

Returns
TypeDescription
Transform

a horizontal flip transform

makeImFeelingLucky()

public abstract Transform makeImFeelingLucky()

Creates a transform that automatically adjust contrast and color levels.

This is similar to the "I'm Feeling Lucky" button in Picasa.

Returns
TypeDescription
Transform

an ImFeelingLucky autolevel transform

makeImage(byte[] imageData)

public abstract Image makeImage(byte[] imageData)

Creates an image from the provided imageData.

Parameter
NameDescription
imageDatabyte[]

image data to store in the image

Returns
TypeDescription
Image

an Image containing the supplied image data

makeImageFromBlob(BlobKey blobKey)

public abstract Image makeImageFromBlob(BlobKey blobKey)

Create an image backed by the specified 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.

Parameter
NameDescription
blobKeyBlobKey

referencing the image

Returns
TypeDescription
Image

an Image that references the specified blob data

makeImageFromFilename(String filename)

public abstract Image makeImageFromFilename(String filename)

Create an image backed by the specified filename. 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.

Parameter
NameDescription
filenameString

referencing the image. Currently only Google Storage files in the format "/gs/bucket_name/object_name" are supported.

Returns
TypeDescription
Image

an Image that references the specified blob data

makeResize(int width, int height)

public abstract 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.

Parameters
NameDescription
widthint

width of the bounding box

heightint

height of the bounding box

Returns
TypeDescription
Transform

a resize transform

makeResize(int width, int height, boolean allowStretch)

public abstract 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. If allowStretch is true, the aspect ratio of the original image will be ignored.

Parameters
NameDescription
widthint

width of the bounding box

heightint

height of the bounding box

allowStretchboolean

allow the image to be resized ignoring the aspect ratio

Returns
TypeDescription
Transform

a resize transform

makeResize(int width, int height, double cropOffsetX, double cropOffsetY)

public abstract 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. The center of the crop region is controlled by cropOffsetX and cropOffsetY.

Parameters
NameDescription
widthint

width of the bounding box

heightint

height of the bounding box

cropOffsetXdouble

the relative horizontal position of the center

cropOffsetYdouble

the relative vertical position of the center

Returns
TypeDescription
Transform

a resize transform

makeResize(int width, int height, float cropOffsetX, float cropOffsetY)

public abstract 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. The center of the crop region is controlled by cropOffsetX and cropOffsetY.

Parameters
NameDescription
widthint

width of the bounding box

heightint

height of the bounding box

cropOffsetXfloat

the relative horizontal position of the center

cropOffsetYfloat

the relative vertical position of the center

Returns
TypeDescription
Transform

a resize transform

makeRotate(int degrees)

public abstract Transform makeRotate(int degrees)

Creates a transform that rotates an image by degrees degrees clockwise.

Parameter
NameDescription
degreesint

The number of degrees by which to rotate. Must be a multiple of 90.

Returns
TypeDescription
Transform

a rotation transform

makeVerticalFlip()

public abstract Transform makeVerticalFlip()

Creates a transform that will vertically flip an image.

Returns
TypeDescription
Transform

a vertical flip transform