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


Java SVGBuilder类代码示例

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


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

示例1: createBitmap

import com.larvalabs.svgandroid.SVGBuilder; //导入依赖的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: SVGTileProvider

import com.larvalabs.svgandroid.SVGBuilder; //导入依赖的package包/类
public SVGTileProvider(File file, float dpi) throws IOException {
    mScale = Math.round(dpi + .3f); // Make it look nice on N7 (1.3 dpi)
    mDimension = BASE_TILE_SIZE * mScale;

    mPool = new TileGeneratorPool(POOL_MAX_SIZE);

    SVG svg = new SVGBuilder().readFromInputStream(new FileInputStream(file)).build();
    mSvgPicture = svg.getPicture();
    RectF limits = svg.getLimits();

    mBaseMatrix = new Matrix();
    mBaseMatrix.setPolyToPoly(
            new float[]{
                    0, 0,
                    limits.width(), 0,
                    limits.width(), limits.height()
            }, 0,
            new float[]{
                    40.95635986328125f, 98.94217824936158f,
                    40.95730018615723f, 98.94123077396628f,
                    40.95791244506836f, 98.94186019897214f
            }, 0, 3
    );
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:25,代码来源:SVGTileProvider.java

示例3: SVGTileProvider

import com.larvalabs.svgandroid.SVGBuilder; //导入依赖的package包/类
public SVGTileProvider(File file, float dpi) throws IOException {
    mScale = Math.round(dpi + .3f); // Make it look nice on N7 (1.3 dpi)
    mDimension = BASE_TILE_SIZE * mScale;

    mPool = new TileGeneratorPool(POOL_MAX_SIZE);

    SVG svg = new SVGBuilder().readFromInputStream(new FileInputStream(file)).build();
    mSvgPicture = svg.getPicture();
    RectF limits = svg.getLimits();

    // These values map the SVG file to world coordinates.
    // See: http://stackoverflow.com/questions/21167584/google-io-2013-app-mystery-values
    mBaseMatrix = new Matrix();
    mBaseMatrix.setPolyToPoly(
            new float[]{
                    0, 0, // North-West
                    limits.width(), 0, // North-East
                    limits.width(), limits.height() // South-East
            }, 0, BuildConfig.MAP_FLOORPLAN_MAPPING, 0, 3
    );
}
 
开发者ID:google,项目名称:iosched,代码行数:22,代码来源:SVGTileProvider.java

示例4: getBackgroundObject

import com.larvalabs.svgandroid.SVGBuilder; //导入依赖的package包/类
public Object getBackgroundObject(String name) throws IOException {
    InputStream stream = getInputStream(name);
    try {
        if (name.endsWith(".svg")) {
            SVG svg = new SVGBuilder().readFromString(FileUtils.readAllText(stream)).build();
            return svg.getPicture();
        } else if (name.endsWith(".png")) {
            return BitmapFactory.decodeStream(stream);
        }else {
            throw new IOException("Unsupported type of image file " + name);
        }
    } finally {
        stream.close();
    }
}
 
开发者ID:RomanGolovanov,项目名称:ametro,代码行数:16,代码来源:ZipArchiveMapProvider.java

示例5: buildImages

import com.larvalabs.svgandroid.SVGBuilder; //导入依赖的package包/类
private void buildImages() {
  int background = isPressed ? darkenColor(getBackgroundColor()) : getBackgroundColor();
  int foreground = isPressed ? darkenColor(getForegroundColor()) : getForegroundColor();
  paint = new Paint();
  paint.setTextAlign(Paint.Align.LEFT);
  paint.setTextSize(getResources().getDisplayMetrics().scaledDensity *
      18 * getResources().getConfiguration().fontScale);
  paint.setColor(foreground);
  backgroundPaint = new Paint();
  backgroundPaint.setColor(background);
  if (!isInEditMode()) {
    logo = new SVGBuilder()
        .readFromResource(getResources(), R.raw.hoomi_icon_only)
        .setColorSwap(Color.WHITE, foreground)
        .build();
    hoomiName = new SVGBuilder()
        .readFromResource(getResources(), R.raw.hoomi_text_only)
        .setColorSwap(Color.WHITE, foreground)
        .build();
    hoomiNameLimits = hoomiName.getLimits();
  } else {
    Rect hoomiNameLimitsTemp = new Rect();
    paint.getTextBounds("Hoomi", 0, 0, hoomiNameLimitsTemp);
    hoomiNameLimits = new RectF(hoomiNameLimitsTemp);
  }
  imagesBuilt = true;
}
 
开发者ID:GetHoomi,项目名称:hoomi-sdk-android,代码行数:28,代码来源:HoomiLoginButton.java

示例6: SVGTileProvider

import com.larvalabs.svgandroid.SVGBuilder; //导入依赖的package包/类
public SVGTileProvider(File file, float dpi) throws IOException {
    mScale = Math.round(dpi + .3f); // Make it look nice on N7 (1.3 dpi)
    mDimension = BASE_TILE_SIZE * mScale;

    mPool = new TileGeneratorPool(POOL_MAX_SIZE);

    SVG svg = new SVGBuilder().readFromInputStream(new FileInputStream(file)).build();
    mSvgPicture = svg.getPicture();
    RectF limits = svg.getLimits();

    mBaseMatrix = new Matrix();
    mBaseMatrix.setPolyToPoly(
            new float[]{
                    0, 0,
                    limits.width(), 0,
                    limits.width(), limits.height(),
                    0, limits.height()
            }, 0,
            new float[]{
                    lon2x(-84.3965270742774),lat2y(33.76028996243774),
                    lon2x(-84.3958156183362),lat2y(33.760276861729395),
                    lon2x(-84.39581125974655),lat2y( 33.7582431615339),
                    lon2x(-84.39653344452381),lat2y( 33.7582526388671)

            }, 0, 4
    );
}
 
开发者ID:secondsun,项目名称:devnexus-android,代码行数:28,代码来源:SVGTileProvider.java


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