当前位置: 首页>>代码示例>>Java>>正文


Java SVGParseException类代码示例

本文整理汇总了Java中com.caverock.androidsvg.SVGParseException的典型用法代码示例。如果您正苦于以下问题:Java SVGParseException类的具体用法?Java SVGParseException怎么用?Java SVGParseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SVGParseException类属于com.caverock.androidsvg包,在下文中一共展示了SVGParseException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSvg

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
private void setSvg(String svgData)
{
    svg = null;
    try
    {
        svg = SVG.getFromString(svgData);
        originalWidth = (int) svg.getDocumentWidth();
        originalHeight = (int) svg.getDocumentHeight();
        svg.setDocumentWidth("100%");
        svg.setDocumentHeight("100%");
        svg.setDocumentViewBox(0, 0, originalWidth, originalHeight);
    }
    catch (SVGParseException e)
    {
        // nothing to do
    }
    if (svg != null)
    {
        this.svgData = svgData;
    }
    imageType = this.svg == null ? ImageType.NONE : ImageType.SVG;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:23,代码来源:CustomImageView.java

示例2: doInBackground

import com.caverock.androidsvg.SVGParseException; //导入依赖的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;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:19,代码来源:LoadSVGTask.java

示例3: VectorDrawable

import com.caverock.androidsvg.SVGParseException; //导入依赖的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) {

    }
}
 
开发者ID:ZieIony,项目名称:Carbon,代码行数:23,代码来源:VectorDrawable.java

示例4: getBitmapFromSvgInputstream

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
private Bitmap getBitmapFromSvgInputstream(InputStream is) {
    Bitmap bitmap = null;
    try {
        SVG svg = SVG.getFromInputStream(is);
        double width = 16;
        double height = 16;
        if (svg.getDocumentViewBox() != null) {
            width = svg.getDocumentViewBox().width();
            height = svg.getDocumentViewBox().height();
        } else {
            Log.d(TAG, "DocumentViewBox is null. assuming width and heigh of 16px.");
        }

        bitmap = Bitmap.createBitmap((int) Math.ceil(width), (int) Math.ceil(height), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);//drawARGB(0,0,0,0);//drawRGB(255, 255, 255);
        svg.renderToCanvas(canvas);
    } catch (SVGParseException e) {
        e.printStackTrace();
    }
    return bitmap;
}
 
开发者ID:openhab,项目名称:openhab-android,代码行数:23,代码来源:MyWebImage.java

示例5: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
public Resource<SVG> decode(InputStream source, int width, int height, Options options)
    throws IOException {
  try {
    SVG svg = SVG.getFromInputStream(source);
    return new SimpleResource<SVG>(svg);
  } catch (SVGParseException ex) {
    throw new IOException("Cannot load SVG from stream", ex);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:SvgDecoder.java

示例6: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
public Resource<SVG> decode(InputStream source, int width, int height, Options options)
    throws IOException {
  try {
    SVG svg = SVG.getFromInputStream(source);
    return new SimpleResource<>(svg);
  } catch (SVGParseException ex) {
    throw new IOException("Cannot load SVG from stream", ex);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:SvgDecoder.java

示例7: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
@Override
public CloseableImage decode(
    EncodedImage encodedImage,
    int length,
    QualityInfo qualityInfo,
    ImageDecodeOptions options) {
  try {
    SVG svg = SVG.getFromInputStream(encodedImage.getInputStream());
    return new CloseableSvgImage(svg);
  } catch (SVGParseException e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:SvgDecoderExample.java

示例8: load

import com.caverock.androidsvg.SVGParseException; //导入依赖的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);
    }
}
 
开发者ID:bunnyblue,项目名称:ACDD,代码行数:16,代码来源:SvgUtils.java

示例9: loadSvg

import com.caverock.androidsvg.SVGParseException; //导入依赖的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);
}
 
开发者ID:jruesga,项目名称:rview,代码行数:10,代码来源:AsyncImageDiffProcessor.java

示例10: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
public Resource<SVG> decode(InputStream source, int width, int height) throws IOException {
    try {
        SVG svg = SVG.getFromInputStream(source);
        return new SimpleResource<SVG>(svg);
    } catch (SVGParseException ex) {
        throw new IOException("Cannot load SVG from stream", ex);
    }
}
 
开发者ID:amrendra18,项目名称:udacity-p3,代码行数:9,代码来源:SvgDecoder.java

示例11: loadFlag

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
@Override
public boolean loadFlag(View view, int imageViewId, String langId) {
    ImageView imageView = (ImageView) view.findViewById(imageViewId);

    // read a flag from the assets folder
    SVG svg = null;
    try {
        svg = SVG.getFromAsset(MyApp.getAppContext().getAssets(), "flags/" + langId + ".svg");
    } catch (SVGParseException | IOException e) {
        return false;
    }

    // create a canvas to draw onto
    if (svg.getDocumentWidth() != -1) {
        Bitmap bitmap = Bitmap.createBitmap((int) Math.ceil(svg.getDocumentWidth()),
                (int) Math.ceil(svg.getDocumentHeight()),
                Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);

        // clear background to white
        canvas.drawRGB(255, 255, 255);

        // render the flag onto our canvas
        svg.renderToCanvas(canvas);

        // draw flag on imageView
        imageView.setImageBitmap(bitmap);
    }

    return true;
}
 
开发者ID:feberhard,项目名称:LLAMA,代码行数:32,代码来源:LanguageService.java

示例12: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
@Override
public Resource<SVG> decode (InputStream source, int width, int height) throws IOException
{
    try
    {
        SVG svg = SVG.getFromInputStream( source );
        return new SimpleResource<SVG>( svg );
    } catch ( SVGParseException ex )
    {
        throw new IOException( "Cannot load SVG from stream", ex );
    }
}
 
开发者ID:tecruz,项目名称:AndroidBaseApplication,代码行数:13,代码来源:SvgDecoder.java

示例13: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
public Resource<Bitmap> decode (InputStream source, int width, int height) throws IOException
{
    try
    {
        SVG svg = SVG.getFromInputStream( source );
        Bitmap bitmap = findBitmap( width, height );
        Canvas canvas = new Canvas( bitmap );
        svg.renderToCanvas( canvas );
        return BitmapResource.obtain( bitmap, bitmapPool );
    } catch ( SVGParseException ex )
    {
        throw new IOException( "Cannot load SVG from stream", ex );
    }
}
 
开发者ID:tecruz,项目名称:AndroidBaseApplication,代码行数:15,代码来源:SvgBitmapDecoder.java

示例14: decode

import com.caverock.androidsvg.SVGParseException; //导入依赖的package包/类
@Override
public Resource<SVG> decode(InputStream source, int width, int height) throws IOException {
    try {
        SVG svg = SVG.getFromInputStream(source);
        svg.setDocumentHeight(height);
        svg.setDocumentWidth(width);
        svg.setDocumentPreserveAspectRatio(PreserveAspectRatio.LETTERBOX);
        return new SimpleResource<>(svg);
    } catch (SVGParseException ex) {
        throw new IOException("Cannot load SVG from stream", ex);
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:13,代码来源:SvgDecoder.java

示例15: load

import com.caverock.androidsvg.SVGParseException; //导入依赖的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);
    }
}
 
开发者ID:geftimov,项目名称:android-pathview,代码行数:17,代码来源:SvgUtils.java


注:本文中的com.caverock.androidsvg.SVGParseException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。