當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。