Java Code Examples for com.google.appengine.api.images.ImagesServiceFactory#makeVerticalFlip()

The following examples show how to use com.google.appengine.api.images.ImagesServiceFactory#makeVerticalFlip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageUtil.java    From wmf2svg with Apache License 2.0 6 votes vote down vote up
public byte[] convert(byte[] image, String destType, boolean reverse) {
	if (destType == null) {
		throw new IllegalArgumentException("dest type is null.");
	} else {
		destType = destType.toLowerCase();
	}

	ImagesService.OutputEncoding encoding = null;
	if ("png".equals(destType)) {
		encoding = OutputEncoding.PNG;
	} else if ("jpeg".equals(destType)) {
		encoding = OutputEncoding.JPEG;
	} else {
		throw new UnsupportedOperationException("unsupported image encoding: " + destType);
	}

	ImagesService imagesService = ImagesServiceFactory.getImagesService();
	Image bmp = ImagesServiceFactory.makeImage(image);

	Transform t = (reverse) ? ImagesServiceFactory.makeVerticalFlip() : ImagesServiceFactory.makeCompositeTransform();
	return imagesService.applyTransform(t, bmp, encoding).getImageData();
}
 
Example 2
Source File: ImagesServiceTest.java    From appengine-tck with Apache License 2.0 5 votes vote down vote up
@Test
public void testVerticalFlip() throws IOException {
    ChkType chkType = ChkType.FLIP;
    Transform transform = ImagesServiceFactory.makeVerticalFlip();
    for (String sfile : FNAMES) {
        for (OutputEncoding encoding : ENCODES) {
            applyAndVerify(sfile, transform, chkType, encoding);
        }
    }
}
 
Example 3
Source File: TifImageTest.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
@Test
public void testVerticalFlip() throws IOException {
    assumeEnvironment(Environment.APPSPOT, Environment.CAPEDWARF);
    Transform transform = ImagesServiceFactory.makeVerticalFlip();
    assertTransformation(transform, "VerticalFlip");
}