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


Java Style类代码示例

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


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

示例1: parseStyle

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static void parseStyle(SvgElementBase obj, String style)
		throws SAXException {
	TextScanner scan = new TextScanner(style.replaceAll("/\\*.*?\\*/", "")); // regex
																				// strips
																				// block
																				// comments

	while (true) {
		String propertyName = scan.nextToken(':');
		scan.skipWhitespace();
		if (!scan.consume(':'))
			break; // Syntax error. Stop processing CSS rules.
		scan.skipWhitespace();
		String propertyValue = scan.nextToken(';');
		if (propertyValue == null)
			break; // Syntax error
		scan.skipWhitespace();
		if (scan.empty() || scan.consume(';')) {
			if (obj.style == null)
				obj.style = new Style();
			processStyleProperty(obj.style, propertyName, propertyValue);
			scan.skipWhitespace();
		}
	}
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:26,代码来源:SVGParser.java

示例2: checkGenericFont

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private Typeface checkGenericFont(String fontName, Integer fontWeight,
		FontStyle fontStyle) {
	Typeface font = null;
	int typefaceStyle;

	boolean italic = (fontStyle == Style.FontStyle.Italic);
	typefaceStyle = (fontWeight > 500) ? (italic ? Typeface.BOLD_ITALIC
			: Typeface.BOLD) : (italic ? Typeface.ITALIC : Typeface.NORMAL);

	if (fontName.equals("serif")) {
		font = Typeface.create(Typeface.SERIF, typefaceStyle);
	} else if (fontName.equals("sans-serif")) {
		font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle);
	} else if (fontName.equals("monospace")) {
		font = Typeface.create(Typeface.MONOSPACE, typefaceStyle);
	} else if (fontName.equals("cursive")) {
		font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle);
	} else if (fontName.equals("fantasy")) {
		font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle);
	}
	return font;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:23,代码来源:SVGAndroidRenderer.java

示例3: parseAttributesStyle

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private void parseAttributesStyle(SvgElementBase obj, Attributes attributes) throws SAXException {
    for (int i = 0; i < attributes.getLength(); i++) {
        String val = attributes.getValue(i).trim();
        if (val.length() == 0) { // The spec doesn't say how to handle empty style attributes.
            continue;             // Our strategy is just to ignore them.
        }
        //boolean  inherit = val.equals("inherit");

        switch (SVGAttr.fromString(attributes.getLocalName(i))) {
            case style:
                parseStyle(obj, val);
                break;

            case CLASS:
                obj.classNames = CSSParser.parseClassAttribute(val);
                break;

            default:
                if (obj.baseStyle == null)
                    obj.baseStyle = new Style();
                processStyleProperty(obj.baseStyle, attributes.getLocalName(i), attributes.getValue(i).trim());
                break;
        }
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:26,代码来源:SVGParser.java

示例4: parseStyle

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static void parseStyle(SvgElementBase obj, String style) throws SAXException {
    TextScanner scan = new TextScanner(style.replaceAll("/\\*.*?\\*/", ""));  // regex strips block comments

    while (true) {
        String propertyName = scan.nextToken(':');
        scan.skipWhitespace();
        if (!scan.consume(':'))
            break;  // Syntax error. Stop processing CSS rules.
        scan.skipWhitespace();
        String propertyValue = scan.nextToken(';', true);
        if (propertyValue == null)
            break;  // Syntax error
        scan.skipWhitespace();
        if (scan.empty() || scan.consume(';')) {
            if (obj.style == null)
                obj.style = new Style();
            processStyleProperty(obj.style, propertyName, propertyValue);
            scan.skipWhitespace();
        }
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:22,代码来源:SVGParser.java

示例5: resetState

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private void resetState() {
    state = new RendererState();
    stateStack = new Stack<RendererState>();

    // Initialise the style state properties like Paints etc using a fresh instance of Style
    updateStyle(state, Style.getDefaultStyle());

    state.viewPort = this.canvasViewPort;

    state.spacePreserve = false;
    state.directRendering = this.directRenderingMode;

    // Push a copy of the state with 'default' style, so that inherit works for top level objects
    stateStack.push((RendererState) state.clone());   // Manual push here - don't use statePush();

    // Initialise the stacks used for mask handling
    canvasStack = new Stack<Canvas>();
    bitmapStack = new Stack<Bitmap>();

    // Keep track of element stack while rendering.
    // The 'render parent' for some elements (eg <use> references) is different from its DOM parent.
    matrixStack = new Stack<Matrix>();
    parentStack = new Stack<SvgContainer>();
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:25,代码来源:SVGAndroidRenderer.java

示例6: checkGenericFont

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private Typeface checkGenericFont(String fontName, Integer fontWeight, FontStyle fontStyle) {
    Typeface font = null;
    int typefaceStyle;

    boolean italic = (fontStyle == Style.FontStyle.Italic);
    typefaceStyle = (fontWeight > 500) ? (italic ? Typeface.BOLD_ITALIC : Typeface.BOLD)
            : (italic ? Typeface.ITALIC : Typeface.NORMAL);

    if (fontName.equals("serif")) {
        font = Typeface.create(Typeface.SERIF, typefaceStyle);
    } else if (fontName.equals("sans-serif")) {
        font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle);
    } else if (fontName.equals("monospace")) {
        font = Typeface.create(Typeface.MONOSPACE, typefaceStyle);
    } else if (fontName.equals("cursive")) {
        font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle);
    } else if (fontName.equals("fantasy")) {
        font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle);
    }
    return font;
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:22,代码来源:SVGAndroidRenderer.java

示例7: parseStyle

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static void  parseStyle(SvgElementBase obj, String style) throws SAXException
{
   TextScanner  scan = new TextScanner(style.replaceAll("/\\*.*?\\*/", ""));  // regex strips block comments

   while (true)
   {
      String  propertyName = scan.nextToken(':');
      scan.skipWhitespace();
      if (!scan.consume(':'))
         break;  // Syntax error. Stop processing CSS rules.
      scan.skipWhitespace();
      String  propertyValue = scan.nextTokenWithWhitespace(';');
      if (propertyValue == null)
         break;  // Syntax error
      scan.skipWhitespace();
      if (scan.empty() || scan.consume(';'))
      {
         if (obj.style == null)
            obj.style = new Style();
         processStyleProperty(obj.style, propertyName, propertyValue);
         scan.skipWhitespace();
      }
   }
}
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:25,代码来源:SVGParser.java

示例8: resetState

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private void  resetState()
{
   state = new RendererState();
   stateStack = new Stack<>();

   // Initialise the style state properties like Paints etc using a fresh instance of Style
   updateStyle(state, Style.getDefaultStyle());

   state.viewPort = null;  // Get filled in later

   state.spacePreserve = false;
   state.directRendering = this.directRenderingMode;

   // Push a copy of the state with 'default' style, so that inherit works for top level objects
   stateStack.push(new RendererState(state));   // Manual push here - don't use statePush();

   // Initialise the stacks used for mask handling
   canvasStack = new Stack<>();
   bitmapStack = new Stack<>();

   // Keep track of element stack while rendering.
   // The 'render parent' for some elements (eg <use> references) is different from its DOM parent.
   matrixStack = new Stack<>();
   parentStack = new Stack<>();
}
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:26,代码来源:SVGAndroidRenderer.java

示例9: checkGenericFont

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private Typeface  checkGenericFont(String fontName, Integer fontWeight, FontStyle fontStyle)
{
   Typeface font = null;
   int      typefaceStyle;

   boolean  italic = (fontStyle == Style.FontStyle.Italic);
   typefaceStyle = (fontWeight > 500) ? (italic ? Typeface.BOLD_ITALIC : Typeface.BOLD)
                                      : (italic ? Typeface.ITALIC : Typeface.NORMAL);

   switch (fontName) {
      case "serif":
         font = Typeface.create(Typeface.SERIF, typefaceStyle); break;
      case "sans-serif":
         font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle); break;
      case "monospace":
         font = Typeface.create(Typeface.MONOSPACE, typefaceStyle); break;
      case "cursive":
         font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle); break;
      case "fantasy":
         font = Typeface.create(Typeface.SANS_SERIF, typefaceStyle); break;
   }
   return font;
}
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:24,代码来源:SVGAndroidRenderer.java

示例10: parseAttributesStyle

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private void parseAttributesStyle(SvgElementBase obj, Attributes attributes)
		throws SAXException {
	for (int i = 0; i < attributes.getLength(); i++) {
		String val = attributes.getValue(i).trim();
		if (val.length() == 0) { // The spec doesn't say how to handle empty
									// style attributes.
			continue; // Our strategy is just to ignore them.
		}
		// boolean inherit = val.equals("inherit");

		switch (SVGAttr.fromString(attributes.getLocalName(i))) {
		case style:
			parseStyle(obj, val);
			break;

		case CLASS:
			obj.classNames = CSSParser.parseClassAttribute(val);
			break;

		default:
			if (obj.baseStyle == null)
				obj.baseStyle = new Style();
			processStyleProperty(obj.baseStyle, attributes.getLocalName(i),
					attributes.getValue(i).trim());
			break;
		}
	}
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:29,代码来源:SVGParser.java

示例11: parseFontStyle

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static Style.FontStyle parseFontStyle(String val)
		throws SAXException {
	Style.FontStyle fs = fontStyleKeyword(val);
	if (fs != null)
		return fs;
	else
		throw new SAXException("Invalid font-style property: " + val);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:9,代码来源:SVGParser.java

示例12: fontStyleKeyword

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static Style.FontStyle fontStyleKeyword(String val) {
	// Italic is probably the most common, so test that first :)
	if ("italic".equals(val))
		return Style.FontStyle.Italic;
	else if ("normal".equals(val))
		return Style.FontStyle.Normal;
	else if ("oblique".equals(val))
		return Style.FontStyle.Oblique;
	else
		return null;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:12,代码来源:SVGParser.java

示例13: parseTextDecoration

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static TextDecoration parseTextDecoration(String val)
		throws SAXException {
	if ("none".equals(val))
		return Style.TextDecoration.None;
	if ("underline".equals(val))
		return Style.TextDecoration.Underline;
	if ("overline".equals(val))
		return Style.TextDecoration.Overline;
	if ("line-through".equals(val))
		return Style.TextDecoration.LineThrough;
	if ("blink".equals(val))
		return Style.TextDecoration.Blink;
	throw new SAXException("Invalid text-decoration property: " + val);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:15,代码来源:SVGParser.java

示例14: parseTextDirection

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static TextDirection parseTextDirection(String val)
		throws SAXException {
	if ("ltr".equals(val))
		return Style.TextDirection.LTR;
	if ("rtl".equals(val))
		return Style.TextDirection.RTL;
	throw new SAXException("Invalid direction property: " + val);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:9,代码来源:SVGParser.java

示例15: parseFillRule

import com.caverock.androidsvg.SVG.Style; //导入依赖的package包/类
private static Style.FillRule parseFillRule(String val) throws SAXException {
	if ("nonzero".equals(val))
		return Style.FillRule.NonZero;
	if ("evenodd".equals(val))
		return Style.FillRule.EvenOdd;
	throw new SAXException("Invalid fill-rule property: " + val);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:8,代码来源:SVGParser.java


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