• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PictureDrawable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onLoadFailed

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
    boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java


示例2: onResourceReady

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
public boolean onResourceReady(PictureDrawable resource, Object model,
    Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java


示例3: drawableToBitmap

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
/**
 * @returns A {@link Bitmap} for a {@link Drawable}.
 */
public static Bitmap drawableToBitmap(final Drawable drawable) {
    if (null == drawable) return null;
    if (drawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

    final Bitmap bitmap = Bitmap.createBitmap(Math.max(0, drawable.getIntrinsicWidth()),
            Math.max(0, drawable.getIntrinsicHeight()), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(bitmap);

    // PictureDrawable's get handled separately.
    if (drawable instanceof PictureDrawable) {
        canvas.drawPicture(((PictureDrawable) drawable).getPicture());
        return bitmap;
    }

    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);

    return bitmap;
}
 
开发者ID:Tombarr,项目名称:Noyze,代码行数:25,代码来源:Utils.java


示例4: attachView

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
public void attachView(ImageZoomMvpView mvpView) {

    super.attachView(mvpView);

    requestBuilder = Glide.with(getMvpView().getAppContext())
            .using(Glide.buildStreamModelLoader(Uri.class,
                    getMvpView().getAppContext()), InputStream.class)
            .from(Uri.class)
            .as(SVG.class)
            .transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
            .sourceEncoder(new StreamEncoder())
            .cacheDecoder(new FileToStreamDecoder<SVG>(new SvgDecoder()))
            .decoder(new SvgDecoder())
            .placeholder(R.drawable.placeholder)
            .error(R.drawable.placeholder)
            .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
            .animate(android.R.anim.fade_in);

}
 
开发者ID:apache,项目名称:incubator-taverna-mobile,代码行数:21,代码来源:ImageZoomPresenter.java


示例5: ContentBlock3ViewHolder

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
public ContentBlock3ViewHolder(View itemView, Context context,
                               OnContentBlock3ViewHolderInteractionListener listener) {
  super(itemView);
  mContext = context;
  mTitleTextView = (TextView) itemView.findViewById(R.id.titleTextView);
  mCopyrightTextView = (TextView) itemView.findViewById(R.id.copyrightTextView);
  mImageView = (ImageView) itemView.findViewById(R.id.imageImageView);
  mImageProgressBar = (ProgressBar) itemView.findViewById(R.id.imageProgressBar);
  mListener = listener;

  mFileManager = FileManager.getInstance(context);

  SvgDrawableTranscoder svgDrawableTranscoder =  new SvgDrawableTranscoder();
  svgDrawableTranscoder.setmDeviceWidth(mContext.getResources().getDisplayMetrics().widthPixels);

  requestBuilder = Glide.with(mContext)
      .using(Glide.buildStreamModelLoader(Uri.class, mContext), InputStream.class)
      .from(Uri.class)
      .as(SVG.class)
      .transcode(svgDrawableTranscoder, PictureDrawable.class)
      .sourceEncoder(new StreamEncoder())
      .cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder()))
      .decoder(new SvgDecoder())
      .listener(new SvgSoftwareLayerSetter<Uri>());
}
 
开发者ID:xamoom,项目名称:xamoom-android-sdk,代码行数:26,代码来源:ContentBlock3ViewHolder.java


示例6: loadSvgIcon

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
private void loadSvgIcon(String imageName, ImageView imageView)
{
    SVG cachedSvg = svgCache.get(imageName);
    if (cachedSvg != null)
    {
        imageView.setImageDrawable(new PictureDrawable(cachedSvg.renderToPicture()));
    }
    else
    {
        if (currentlyRetrieving.contains(imageView))
            return;
        currentlyRetrieving.add(imageView);

        imageView.setImageDrawable(null);
        Needle.onBackgroundThread().withThreadPoolSize(10).execute(new IconRetrievalTask(imageName, imageView));
    }
}
 
开发者ID:matejdro,项目名称:PebbleNotificationCenter-Android,代码行数:18,代码来源:IconPickerItem.java


示例7: thenDoUiRelatedWork

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
protected void thenDoUiRelatedWork(SVG svg)
{
    if (svg != null)
    {
        try
        {
            imageView.setImageDrawable(new PictureDrawable(svg.renderToPicture()));
            svgCache.put(imageName, svg);

        }
        catch (NullPointerException e)
        {
            //renderToPicture() sometimes throws NPE.

            Timber.e("SVG Error", e);
            e.printStackTrace();
        }
    }

    currentlyRetrieving.remove(imageView);
}
 
开发者ID:matejdro,项目名称:PebbleNotificationCenter-Android,代码行数:23,代码来源:IconPickerItem.java


示例8: onCreate

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  imageViewRes = (ImageView) findViewById(R.id.svg_image_view1);
  imageViewNet = (ImageView) findViewById(R.id.svg_image_view2);

  requestBuilder = GlideApp.with(this)
      .as(PictureDrawable.class)
      .placeholder(R.drawable.image_loading)
      .error(R.drawable.image_error)
      .transition(withCrossFade())
      .listener(new SvgSoftwareLayerSetter());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:MainActivity.java


示例9: transcode

import android.graphics.drawable.PictureDrawable; //导入依赖的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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgDrawableTranscoder.java


示例10: transcode

import android.graphics.drawable.PictureDrawable; //导入依赖的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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgDrawableTranscoder.java


示例11: setSVG

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
/**
 * Directly set the SVG.
 */
public void setSVG(SVG mysvg) {
	if (mysvg == null)
		throw new IllegalArgumentException("Null value passed to setSVG()");

	setSoftwareLayerType();
	setImageDrawable(new PictureDrawable(mysvg.renderToPicture()));
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:11,代码来源:SVGImageView.java


示例12: loadSvg

import android.graphics.drawable.PictureDrawable; //导入依赖的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


示例13: onException

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
 
开发者ID:amrendra18,项目名称:udacity-p3,代码行数:9,代码来源:SvgSoftwareLayerSetter.java


示例14: onResourceReady

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
public boolean onResourceReady(PictureDrawable resource, T model, Target<PictureDrawable> target,
                               boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
 
开发者ID:amrendra18,项目名称:udacity-p3,代码行数:10,代码来源:SvgSoftwareLayerSetter.java


示例15: getInstance

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
public static SvgImageLoader getInstance(Context context) {
    if (mInstance == null) {
        mInstance = new SvgImageLoader();
        genericRequestBuilder = Glide.with(context)
                .using(Glide.buildStreamModelLoader(Uri.class, context), InputStream.class)
                .from(Uri.class)
                .as(SVG.class)
                .transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
                .sourceEncoder(new StreamEncoder())
                .cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder()))
                .decoder(new SvgDecoder())
                .listener(new SvgSoftwareLayerSetter<>());
    }
    return mInstance;
}
 
开发者ID:amrendra18,项目名称:udacity-p3,代码行数:16,代码来源:SvgImageLoader.java


示例16: transcode

import android.graphics.drawable.PictureDrawable; //导入依赖的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);
}
 
开发者ID:amrendra18,项目名称:udacity-p3,代码行数:8,代码来源:SvgDrawableTranscoder.java


示例17: pictureDrawable2Bitmap

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
private static Bitmap pictureDrawable2Bitmap(PictureDrawable pictureDrawable) {
    Bitmap bitmap = Bitmap.createBitmap(pictureDrawable.getIntrinsicWidth()
            , pictureDrawable.getIntrinsicHeight()
            , Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawPicture(pictureDrawable.getPicture());
    return bitmap;
}
 
开发者ID:gorio,项目名称:webviewtopdf,代码行数:9,代码来源:MainActivity.java


示例18: createPictureDrawable

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
/**
     * Create a picture drawable from the SVG.
     * @return the PictureDrawable.
     */
    public PictureDrawable createPictureDrawable() {
        return new PictureDrawable(picture);
//        return new PictureDrawable(picture) {
//            @Override
//            public int getIntrinsicWidth() {
//                if (bounds != null) {
//                    return (int) bounds.width();
//                } else if (limits != null) {
//                    return (int) limits.width();
//                } else {
//                    return -1;
//                }
//            }
//
//            @Override
//            public int getIntrinsicHeight() {
//                if (bounds != null) {
//                    return (int) bounds.height();
//                } else if (limits != null) {
//                    return (int) limits.height();
//                } else {
//                    return -1;
//                }
//            }
//        };
    }
 
开发者ID:zhouzhuo810,项目名称:ZzBeeLayout,代码行数:31,代码来源:SVG.java


示例19: CountriesAdapter

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Inject
public CountriesAdapter (@ApplicationContext Context applicationContext)
{
    countryList = new ArrayList<>( );
    context = applicationContext;
    requestBuilder = Glide.with( context )
            .using( Glide.buildStreamModelLoader( Uri.class, context ), InputStream.class )
            .from( Uri.class )
            .as( SVG.class )
            .transcode( new SvgDrawableTranscoder( ), PictureDrawable.class )
            .sourceEncoder( new StreamEncoder( ) )
            .cacheDecoder( new FileToStreamDecoder<SVG>( new SvgDecoder( ) ) )
            .decoder( new SvgDecoder( ) )
            .placeholder( R.mipmap.ic_launcher )
            .error( android.R.drawable.stat_notify_error )
            .animate( android.R.anim.fade_in )
            .listener( new SvgSoftwareLayerSetter<Uri>( ) );
}
 
开发者ID:tecruz,项目名称:AndroidBaseApplication,代码行数:19,代码来源:CountriesAdapter.java


示例20: onResourceReady

import android.graphics.drawable.PictureDrawable; //导入依赖的package包/类
@Override
public boolean onResourceReady (PictureDrawable resource, T model, Target<PictureDrawable>
        target, boolean isFromMemoryCache, boolean isFirstResource)
{
    ImageView view = (( ImageViewTarget<?> ) target).getView( );
    if ( Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT )
    {
        view.setLayerType( ImageView.LAYER_TYPE_SOFTWARE, null );
    }
    return false;
}
 
开发者ID:tecruz,项目名称:AndroidBaseApplication,代码行数:12,代码来源:SvgSoftwareLayerSetter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SMTPServer类代码示例发布时间:2022-05-21
下一篇:
Java QueryResult类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap