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


Java Picture类代码示例

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


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

示例1: createBitmap

import android.graphics.Picture; //导入依赖的package包/类
public static Bitmap createBitmap(InputStream in, int w, int h, boolean closeStream) {
		if (in == null) {
			return null;
		}
		com.larvalabs.svgandroid.SVG svg;
		svg = new SVGBuilder().readFromInputStream(in).build();
		
		Bitmap bitmap = Bitmap.createBitmap(w, h, Config.ARGB_8888);
		Canvas canvas = new Canvas(bitmap);
		Picture pic = svg.getPicture();
//	      svg.renderToCanvas(canvas/*, new RectF(0f, 0f, (float)w, (float)h)*/);
//	      svg.renderToCanvas(canvas, new RectF(0f, 0f, (float)w, (float)h));
		canvas.drawPicture(pic, new Rect(0, 0, w, h));
		if (closeStream) {
			try {
				in.close();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return bitmap;
	}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:23,代码来源:ImageUtils.java

示例2: captureWebViewall

import android.graphics.Picture; //导入依赖的package包/类
private Bitmap captureWebViewall(WebView webView) {
    Picture snapShot = webView.capturePicture();
    Bitmap bmp = Bitmap.createBitmap(snapShot.getWidth(),
            snapShot.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bmp);
    snapShot.draw(canvas);
    return bmp;
}
 
开发者ID:shenhuanet,项目名称:ZhidaoDaily-android,代码行数:9,代码来源:DetailActivity.java

示例3: GraphicsCache

import android.graphics.Picture; //导入依赖的package包/类
public GraphicsCache(@SuppressWarnings("unused") final Component component, @NonNull final Graphics thatGraphics, final int width0, final int height0)
{
	this.canvas = thatGraphics.canvas;
	if (GraphicsCache.CACHE)
	{
		this.picture = new Picture();
		this.width = width0;
		this.height = height0;
	}
	else
	{
		this.picture = null;
		this.width = 0;
		this.height = 0;
	}
}
 
开发者ID:1313ou,项目名称:TreebolicLib,代码行数:17,代码来源:GraphicsCache.java

示例4: getPictureListener

import android.graphics.Picture; //导入依赖的package包/类
private WebView.PictureListener getPictureListener() {
  if (mPictureListener == null) {
    mPictureListener = new WebView.PictureListener() {
      @Override
      public void onNewPicture(WebView webView, Picture picture) {
        dispatchEvent(
          webView,
          new ContentSizeChangeEvent(
            webView.getId(),
            webView.getWidth(),
            webView.getContentHeight()));
      }
    };
  }
  return mPictureListener;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:ReactWebViewManager.java

示例5: parse

import android.graphics.Picture; //导入依赖的package包/类
private static SVG parse(InputStream in, Integer searchColor, Integer replaceColor, boolean whiteMode,
                             int targetWidth, int targetHeight) throws SVGParseException {
//        Util.debug("Parsing SVG...");
        try {
            long start = System.currentTimeMillis();
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();
            final Picture picture = new Picture();
            SVGHandler handler = new SVGHandler(picture, targetWidth, targetHeight);
            handler.setColorSwap(searchColor, replaceColor);
            handler.setWhiteMode(whiteMode);
            xr.setContentHandler(handler);
            xr.parse(new InputSource(in));
//        Util.debug("Parsing complete in " + (System.currentTimeMillis() - start) + " millis.");
            SVG result = new SVG(picture, handler.bounds);
            // Skip bounds if it was an empty pic
            if (!Float.isInfinite(handler.limits.top)) {
                result.setLimits(handler.limits);
            }
            return result;
        } catch (Exception e) {
            throw new SVGParseException(e);
        }
    }
 
开发者ID:zhouzhuo810,项目名称:ZzBeeLayout,代码行数:26,代码来源:SVGParser.java

示例6: getPictureListener

import android.graphics.Picture; //导入依赖的package包/类
private WebView.PictureListener getPictureListener() {
    if (mPictureListener == null) {
        mPictureListener = new WebView.PictureListener() {
            @Override
            public void onNewPicture(WebView webView, Picture picture) {
                dispatchEvent(
                        webView,
                        new ContentSizeChangeEvent(
                                webView.getId(),
                                webView.getWidth(),
                                webView.getContentHeight()));
            }
        };
    }
    return mPictureListener;
}
 
开发者ID:shimohq,项目名称:react-native-x5,代码行数:17,代码来源:RNX5WebViewManager.java

示例7: setData

import android.graphics.Picture; //导入依赖的package包/类
public void setData(Picture floorMap)
{
    this.floorMap = floorMap;
    if (this.mapMainView.getWidth() == 0)
    {
        ViewTreeObserver vto = this.mapMainView.getViewTreeObserver();
        vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener()
        {
            public boolean onPreDraw()
            {
                if (!hasMeasured)
                {
                    calcRatio();
                }
                return true;
            }
        });
    }
    else
    {
        calcRatio();
    }
}
 
开发者ID:maxwell-nc,项目名称:ExhibitionCenter,代码行数:24,代码来源:MapOverlay.java

示例8: setImage

import android.graphics.Picture; //导入依赖的package包/类
public void setImage(Picture image) {
    this.image = image;

    if (mapView.getWidth() == 0) {
        ViewTreeObserver vto = mapView.getViewTreeObserver();
        vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            public boolean onPreDraw() {
                if (!hasMeasured) {
                    initMapLayer();
                    hasMeasured = true;
                }
                return true;
            }
        });
    } else {
        initMapLayer();
    }
}
 
开发者ID:onlylemi,项目名称:MapView,代码行数:19,代码来源:MapLayer.java

示例9: renderViewToPicture

import android.graphics.Picture; //导入依赖的package包/类
/**
 * Renders this SVG document to a Picture object using the specified view defined in the document.
 * <p>
 * A View is an special element in a SVG document that describes a rectangular area in the document.
 * Calling this method with a {@code viewId} will result in the specified view being positioned and scaled
 * to the viewport.  In other words, use {@link #renderToPicture()} to render the whole document, or use this
 * method instead to render just a part of it.
 *
 * @param viewId         the id of a view element in the document that defines which section of the document is to be visible.
 * @param widthInPixels  the width of the initial viewport
 * @param heightInPixels the height of the initial viewport
 * @return a Picture object suitable for later rendering using {@code Canvas.drawPicture()}, or null if the viewId was not found.
 */
public Picture renderViewToPicture(String viewId, int widthInPixels, int heightInPixels) {
    SvgObject obj = this.getElementById(viewId);
    if (obj == null)
        return null;
    if (!(obj instanceof SVG.View))
        return null;

    SVG.View view = (SVG.View) obj;

    if (view.viewBox == null) {
        Log.w(TAG, "View element is missing a viewBox attribute.");
        return null;
    }

    Picture picture = new Picture();
    Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
    Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);

    SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort, this.renderDPI);

    renderer.renderDocument(this, view.viewBox, view.preserveAspectRatio, false);

    picture.endRecording();
    return picture;
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:39,代码来源:SVG.java

示例10: parse

import android.graphics.Picture; //导入依赖的package包/类
private static SVG parse(InputStream in, Integer searchColor, Integer replaceColor, boolean whiteMode) throws SVGParseException {
//        Util.debug("Parsing SVG...");
        try {
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();
            final Picture picture = new Picture();
            SVGHandler handler = new SVGHandler(picture);
            handler.setColorSwap(searchColor, replaceColor);
            handler.setWhiteMode(whiteMode);
            xr.setContentHandler(handler);
            xr.parse(new InputSource(in));
//        Util.debug("Parsing complete in " + (System.currentTimeMillis() - start) + " millis.");
            SVG result = new SVG(picture, handler.bounds);
            // Skip bounds if it was an empty pic
            if (!Float.isInfinite(handler.limits.top)) {
                result.setLimits(handler.limits);
            }
            return result;
        } catch (Exception e) {
            throw new SVGParseException(e);
        }
    }
 
开发者ID:b2renger,项目名称:PdDroidPublisher,代码行数:24,代码来源:SVGParser.java

示例11: createElementsTree

import android.graphics.Picture; //导入依赖的package包/类
private List<DrawingElement> createElementsTree(MapContainer container, String schemeName) {
    final List<DrawingElement> elements = new ArrayList<>();
    MapScheme scheme = container.getScheme(schemeName);
    for (MapSchemeLine line : scheme.getLines()) {
        createLine(elements, scheme, line);
    }
    for (MapSchemeTransfer transfer : scheme.getTransfers()) {
        createTransfer(elements, scheme, transfer);
    }
    for (String imageName : scheme.getImageNames()) {
        Object background = scheme.getBackgroundObject(imageName);
        if (background instanceof Picture) {
            elements.add(new PictureBackgroundElement(scheme, (Picture) background));
        } else if (background instanceof Bitmap) {
            elements.add(new BitmapBackgroundElement(scheme, (Bitmap) background));
        }
    }
    return elements;
}
 
开发者ID:RomanGolovanov,项目名称:ametro,代码行数:20,代码来源:RenderProgram.java

示例12: onLoadBitmap

import android.graphics.Picture; //导入依赖的package包/类
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig) {
	final Picture picture = this.mPicture;
	if (picture == null) {
		Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ".");
		return null;
	}

	final Bitmap bitmap = Bitmap.createBitmap(this.mTextureWidth, this.mTextureHeight, pBitmapConfig);
	final Canvas canvas = new Canvas(bitmap);

	final float scaleX = (float)this.mTextureWidth / this.mPicture.getWidth();
	final float scaleY = (float)this.mTextureHeight / this.mPicture.getHeight();
	canvas.scale(scaleX, scaleY, 0, 0);

	picture.draw(canvas);

	return bitmap;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:20,代码来源:PictureBitmapTextureAtlasSource.java

示例13: onLoadBitmap

import android.graphics.Picture; //导入依赖的package包/类
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig) {
	final Picture picture = this.mPicture;
	if(picture == null) {
		Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ".");
		return null;
	}

	final Bitmap bitmap = Bitmap.createBitmap(this.mTextureWidth, this.mTextureHeight, pBitmapConfig);
	final Canvas canvas = new Canvas(bitmap);

	final float scaleX = (float)this.mTextureWidth / this.mPicture.getWidth();
	final float scaleY = (float)this.mTextureHeight / this.mPicture.getHeight();
	canvas.scale(scaleX, scaleY, 0, 0);

	picture.draw(canvas);

	return bitmap;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:20,代码来源:PictureBitmapTextureAtlasSource.java

示例14: draw

import android.graphics.Picture; //导入依赖的package包/类
@Override
public void draw(Canvas canvas) {

    canvas.drawCircle(mBounds.centerX(), mBounds.centerY(), mBounds.centerX(), mBackgroundPaint);
    Picture picture = new Picture() ;
    picture.draw(canvas);
    canvas.save();
    canvas.rotate(180 * mRotation, (x(0) + x(1))/2, (y(0) + y(1))/2);
    canvas.drawLine(x(0), y(0), x(1), y(1), mLinePaint);
    canvas.restore();

    canvas.save();
    canvas.rotate(180 * mRotation, (x(2) + x(3)) / 2, (y(2) + y(3)) / 2);
    canvas.drawLine(x(2), y(2), x(3), y(3), mLinePaint);
    canvas.restore();

    canvas.save();
    canvas.rotate(180 * mRotation, (x(4) + x(5)) / 2, (y(4) + y(5)) / 2);
    canvas.drawLine(x(4), y(4), x(5), y(5), mLinePaint);
    canvas.restore();

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

示例15: renderViewToPicture

import android.graphics.Picture; //导入依赖的package包/类
/**
 * Renders this SVG document to a Picture object using the specified view defined in the document.
 * <p/>
 * A View is an special element in a SVG document that describes a rectangular area in the document.
 * Calling this method with a {@code viewId} will result in the specified view being positioned and scaled
 * to the viewport.  In other words, use {@link #renderToPicture()} to render the whole document, or use this
 * method instead to render just a part of it.
 *
 * @param viewId         the id of a view element in the document that defines which section of the document is to
 *                       be visible.
 * @param widthInPixels  the width of the initial viewport
 * @param heightInPixels the height of the initial viewport
 * @return a Picture object suitable for later rendering using {@code Canvas.drawPicture()},
 * or null if the viewId was not found.
 */
public Picture renderViewToPicture(String viewId, int widthInPixels, int heightInPixels) {
    SvgObject obj = this.getElementById(viewId);
    if (obj == null)
        return null;
    if (!(obj instanceof SVG.View))
        return null;

    SVG.View view = (SVG.View) obj;

    if (view.viewBox == null) {
        Log.w(TAG, "View element is missing a viewBox attribute.");
        return null;
    }

    Picture picture = new Picture();
    Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
    Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);

    SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort, this.renderDPI);

    renderer.renderDocument(this, view.viewBox, view.preserveAspectRatio, false);

    picture.endRecording();
    return picture;
}
 
开发者ID:robinxdroid,项目名称:XDroidAnimation,代码行数:41,代码来源:SVG.java


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