本文整理汇总了Java中com.caverock.androidsvg.SVG.renderToPicture方法的典型用法代码示例。如果您正苦于以下问题:Java SVG.renderToPicture方法的具体用法?Java SVG.renderToPicture怎么用?Java SVG.renderToPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.caverock.androidsvg.SVG
的用法示例。
在下文中一共展示了SVG.renderToPicture方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transcode
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode) {
SVG svg = toTranscode.get();
Picture picture = svg.renderToPicture();
PictureDrawable drawable = new PictureDrawable(picture);
return new SimpleResource<PictureDrawable>(drawable);
}
示例2: transcode
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode, Options options) {
SVG svg = toTranscode.get();
Picture picture = svg.renderToPicture();
PictureDrawable drawable = new PictureDrawable(picture);
return new SimpleResource<>(drawable);
}
示例3: loadSvg
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
private Pair<Drawable, int[]> loadSvg(InputStream is) throws SVGParseException {
SVG svg = SVG.getFromInputStream(is);
int[] size = new int[2];
size[0] = (int) svg.getDocumentViewBox().width();
size[1] = (int) svg.getDocumentViewBox().height();
svg.setDocumentWidth(mSize);
svg.setDocumentHeight(mSize);
return new Pair<>(new PictureDrawable(svg.renderToPicture()), size);
}
示例4: transcode
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode) {
SVG svg = toTranscode.get();
Picture picture = svg.renderToPicture();
PictureDrawable drawable = new PictureDrawable(picture);
return new SimpleResource<PictureDrawable>(drawable);
}
示例5: transcode
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
@Override
public Resource<PictureDrawable> transcode (Resource<SVG> toTranscode)
{
SVG svg = toTranscode.get( );
Picture picture = svg.renderToPicture( );
PictureDrawable drawable = new PictureDrawable( picture );
return new SimpleResource<PictureDrawable>( drawable );
}
示例6: getAndroidBitmap
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
private static android.graphics.Bitmap getAndroidBitmap(InputStream inputStream, PlatformConnector.SvgScaleType scaleType, float scaleValue) throws IOException {
synchronized (SVG.getVersion()) {
try {
SVG svg = SVG.getFromInputStream(inputStream);
Picture picture = svg.renderToPicture();
float scale = 1;
switch (scaleType) {
case SCALED_TO_WIDTH:
scale = scaleValue / picture.getWidth();
break;
case SCALED_TO_HEIGHT:
scale = scaleValue / picture.getHeight();
break;
case DPI_SCALED:
scale = CB.getScaledFloat(scaleValue);
break;
case SCALED_TO_WIDTH_OR_HEIGHT:
scale = Math.min(scaleValue / picture.getHeight(), scaleValue / picture.getWidth());
break;
}
float bitmapWidth = picture.getWidth() * scale;
float bitmapHeight = picture.getHeight() * scale;
android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap((int) Math.ceil(bitmapWidth),
(int) Math.ceil(bitmapHeight), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawPicture(picture, new RectF(0, 0, bitmapWidth, bitmapHeight));
return bitmap;
} catch (Exception e) {
throw new IOException(e);
}
}
}
示例7: transcode
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode) {
SVG svg = toTranscode.get();
Picture picture = svg.renderToPicture();
PictureDrawable drawable = new PictureDrawable(picture);
return new SimpleResource<>(drawable);
}
示例8: transcode
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode) {
SVG svg = toTranscode.get();
Picture picture;
if (svg.getDocumentWidth() != -1) {
svg.setDocumentPreserveAspectRatio(PreserveAspectRatio.FULLSCREEN);
picture = svg.renderToPicture();
} else {
picture = svg.renderToPicture(mDeviceWidth, Math.round(mDeviceWidth/svg.getDocumentAspectRatio()));
}
PictureDrawable drawable = new PictureDrawable(picture);
return new SimpleResource<>(drawable);
}