public ImageDescription getImageDescription(Integer idImage, String suffix, String extension) throws IOException { File file = getPathManager().getPath(new FileDescriptor(idImage, suffix, extension), false); if (file.exists()) { Dimension dim = imageResizer.getImageDimesion(file); if (dim == null) { return null; } else { ImageDescription out = new ImageDescription(); out.setWidth((int) dim.getWidth()); out.setHeight((int) dim.getHeight()); out.setExtension(extension); return out; } } else { return null; } }
/** * Create a movie with the specified width, height, filename, frame rate, codec type and quality, * and key frame rate. */ public MovieMaker( PApplet p, int _w, int _h, String _filename, int _rate, int _codecType, int _codecQuality, int _keyFrameRate) { parent = p; width = _w; height = _h; rate = _rate; try { QTSession.open(); } catch (QTException e1) { e1.printStackTrace(); } try { ImageDescription imgD = null; if (quicktime.util.EndianOrder.isNativeLittleEndian()) { imgD = new ImageDescription(QDConstants.k32BGRAPixelFormat); } else { imgD = new ImageDescription(QDGraphics.kDefaultPixelFormat); } imgD.setWidth(width); imgD.setHeight(height); gw = new QDGraphics(imgD, 0); } catch (QTException e) { e.printStackTrace(); } codecType = _codecType; codecQuality = _codecQuality; keyFrameRate = _keyFrameRate; initMovie(_filename); parent.registerDispose(this); }
private void compressAndAdd() { try { if (temporalSupported) { CompressedFrameInfo cfInfo = seq.compressFrame(gw, bounds, StdQTConstants.codecFlagUpdatePrevious, compressedImage); boolean syncSample = cfInfo.getSimilarity() == 0; // see developer.apple.com/qa/qtmcc/qtmcc20.html videoMedia.addSample( imageHandle, 0, cfInfo.getDataSize(), TIME_SCALE / rate, imgDesc, 1, syncSample ? 0 : StdQTConstants.mediaSampleNotSync); } else { imgDesc = QTImage.fCompress( gw, gw.getBounds(), 32, codecQuality, codecType, CodecComponent.anyCodec, null, 0, RawEncodedImage.fromQTHandle(imageHandle)); boolean syncSample = true; // UM, what the hell should this be??? videoMedia.addSample( imageHandle, 0, imgDesc.getDataSize(), TIME_SCALE / rate, imgDesc, 1, syncSample ? 0 : StdQTConstants.mediaSampleNotSync); } } catch (QTException e) { e.printStackTrace(); } }
@Test public void testGetTransparency() throws Exception { assertEquals(exampleDescription.getTransparency(), exampleTransparency); }
@Test public void testGetImageHeight() throws Exception { assertEquals(exampleDescription.getImageHeight(), exampleImageHeight); }
@Test public void testGetGetDrawableImageGraphics() throws Exception { assertSame(exampleDescription.getDrawableImageGraphics(), exampleDrawable); }