本文整理汇总了Java中com.caverock.androidsvg.SVG.getFromResource方法的典型用法代码示例。如果您正苦于以下问题:Java SVG.getFromResource方法的具体用法?Java SVG.getFromResource怎么用?Java SVG.getFromResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.caverock.androidsvg.SVG
的用法示例。
在下文中一共展示了SVG.getFromResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInBackground
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
private Bitmap doInBackground(Integer... paramVarArgs)
{
try
{
SVG localSVG = SVG.getFromResource(this.mContext, paramVarArgs[0].intValue());
Bitmap localBitmap = Bitmap.createBitmap(this.mWidth, this.mHeight, Bitmap.Config.ARGB_8888);
localSVG.renderToCanvas(new Canvas(localBitmap));
return localBitmap;
}
catch (SVGParseException localSVGParseException)
{
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = paramVarArgs[0];
arrayOfObject[1] = localSVGParseException.getMessage();
FinskyLog.e("Error loading SVG resource 0x%x: %s", arrayOfObject);
}
return null;
}
示例2: VectorDrawable
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
public VectorDrawable(Resources res, int resId) {
if (resId == 0)
return;
try {
SVG svg = cache.get(resId);
if (svg == null) {
svg = SVG.getFromResource(res, resId);
cache.put(resId, svg);
}
float density = res.getDisplayMetrics().density;
float width = svg.getDocumentViewBox().width();
float height = svg.getDocumentViewBox().height();
int intWidth = (int) (width * density);
int intHeight = (int) (height * density);
state = new VectorState(svg, intWidth, intHeight);
setBounds(0, 0, state.intWidth, state.intHeight);
} catch (SVGParseException e) {
}
}
示例3: load
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
/**
* Loading the svg from the resources.
*
* @param context Context object to get the resources.
* @param svgResource int resource id of the svg.
*/
public void load(Context context, int svgResource) {
if (mSvg != null) return;
try {
mSvg = SVG.getFromResource(context, svgResource);
mSvg.setDocumentPreserveAspectRatio(PreserveAspectRatio.UNSCALED);
} catch (SVGParseException e) {
Log.e(LOG_TAG, "Could not load specified SVG resource", e);
}
}
示例4: load
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
/**
* Loading the svg from the resources.
*
* @param context Context object to get the resources.
* @param svgResource int resource id of the svg.
*/
public void load(Context context, int svgResource) {
if (mSvg != null)
return;
try {
mSvg = SVG.getFromResource(context, svgResource);
mSvg.setDocumentPreserveAspectRatio(PreserveAspectRatio.UNSCALED);
} catch (SVGParseException e) {
Log.e(LOG_TAG, "Could not load specified SVG resource", e);
}
}
示例5: load
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
public void load(Context context, int svgResource) {
if (mSvg != null) return;
try {
mSvg = SVG.getFromResource(context, svgResource);
mSvg.setDocumentPreserveAspectRatio(PreserveAspectRatio.UNSCALED);
} catch (SVGParseException e) {
Log.e(LOG_TAG, "Could not load specified SVG resource", e);
}
}
示例6: load
import com.caverock.androidsvg.SVG; //导入方法依赖的package包/类
public void load(Context context, int svgResource) {
if (mSvg != null) return;
try {
mSvg = SVG.getFromResource(context, svgResource);
mSvg.setDocumentPreserveAspectRatio(PreserveAspectRatio.UNSCALED);
} catch (SVGParseException e) {
Log.e("CatChatSvg", "Could not load specified SVG resource", e);
}
}