/** * Create a CZML resource from a stream containing image data. The image data will be embedded in the CZML document using a data URI. * @param stream The stream containing image data to write. * @param imageFormat The format of the image. * @return A new {@link CesiumResource} containing the image data as a data URI. */ public static CesiumResource fromStream(InputStream stream, @Nonnull CesiumImageFormat imageFormat) { String dataUri = CesiumFormattingHelper.imageToDataUri(stream, imageFormat); return new CesiumResource(dataUri, CesiumResourceBehavior.EMBED); }
/** * Create a CZML resource from an image loaded into memory. The image data will be embedded in the CZML document using a data URI. * @param image The image to write. * @param imageFormat The format of the image. * @return A new {@link CesiumResource} containing the image data as a data URI. */ public static CesiumResource fromImage(RenderedImage image, @Nonnull CesiumImageFormat imageFormat) { String dataUri = CesiumFormattingHelper.imageToDataUri(image, imageFormat); return new CesiumResource(dataUri, CesiumResourceBehavior.EMBED); }
/** * Create a CZML resource from a stream. The data will be embedded in the CZML document using a data URI. * @param stream The stream containing data to write. * @param mimeType The mime type of the data. * @return A new {@link CesiumResource} containing the data as a data URI. */ public static CesiumResource fromStream(InputStream stream, String mimeType) { String dataUri = CesiumFormattingHelper.streamToDataUri(stream, mimeType); return new CesiumResource(dataUri, CesiumResourceBehavior.EMBED); } }