本文整理汇总了Java中com.caverock.androidsvg.SVG.Style.TextAnchor方法的典型用法代码示例。如果您正苦于以下问题:Java Style.TextAnchor方法的具体用法?Java Style.TextAnchor怎么用?Java Style.TextAnchor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.caverock.androidsvg.SVG.Style
的用法示例。
在下文中一共展示了Style.TextAnchor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseTextAnchor
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private static Style.TextAnchor parseTextAnchor(String val)
throws SAXException {
if ("start".equals(val))
return Style.TextAnchor.Start;
if ("middle".equals(val))
return Style.TextAnchor.Middle;
if ("end".equals(val))
return Style.TextAnchor.End;
throw new SAXException("Invalid text-anchor property: " + val);
}
示例2: getAnchorPosition
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private Style.TextAnchor getAnchorPosition() {
if (state.style.direction == Style.TextDirection.LTR
|| state.style.textAnchor == TextAnchor.Middle)
return state.style.textAnchor;
// Handle RTL case where Start and End are reversed
return (state.style.textAnchor == TextAnchor.Start) ? TextAnchor.End
: TextAnchor.Start;
}
示例3: parseTextAnchor
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private static Style.TextAnchor parseTextAnchor(String val) throws SAXException {
if ("start".equals(val))
return Style.TextAnchor.Start;
if ("middle".equals(val))
return Style.TextAnchor.Middle;
if ("end".equals(val))
return Style.TextAnchor.End;
throw new SAXException("Invalid text-anchor property: " + val);
}
示例4: getAnchorPosition
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private Style.TextAnchor getAnchorPosition() {
if (state.style.direction == Style.TextDirection.LTR || state.style.textAnchor == TextAnchor.Middle)
return state.style.textAnchor;
// Handle RTL case where Start and End are reversed
return (state.style.textAnchor == TextAnchor.Start) ? TextAnchor.End : TextAnchor.Start;
}
示例5: parseTextAnchor
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private static Style.TextAnchor parseTextAnchor(String val) throws SAXException
{
if ("start".equals(val))
return Style.TextAnchor.Start;
if ("middle".equals(val))
return Style.TextAnchor.Middle;
if ("end".equals(val))
return Style.TextAnchor.End;
throw new SAXException("Invalid text-anchor property: "+val);
}
示例6: getAnchorPosition
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private Style.TextAnchor getAnchorPosition()
{
if (state.style.direction == Style.TextDirection.LTR || state.style.textAnchor == TextAnchor.Middle)
return state.style.textAnchor;
// Handle RTL case where Start and End are reversed
return (state.style.textAnchor == TextAnchor.Start) ? TextAnchor.End : TextAnchor.Start;
}
示例7: render
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private void render(SVG.Text obj) {
debug("Text render");
updateStyleForElement(state, obj);
if (!display())
return;
if (obj.transform != null)
canvas.concat(obj.transform);
// Get the first coordinate pair from the lists in the x and y
// properties.
float x = (obj.x == null || obj.x.size() == 0) ? 0f : obj.x.get(0)
.floatValueX(this);
float y = (obj.y == null || obj.y.size() == 0) ? 0f : obj.y.get(0)
.floatValueY(this);
float dx = (obj.dx == null || obj.dx.size() == 0) ? 0f : obj.dx.get(0)
.floatValueX(this);
float dy = (obj.dy == null || obj.dy.size() == 0) ? 0f : obj.dy.get(0)
.floatValueY(this);
// Handle text alignment
Style.TextAnchor anchor = getAnchorPosition();
if (anchor != Style.TextAnchor.Start) {
float textWidth = calculateTextWidth(obj);
if (anchor == Style.TextAnchor.Middle) {
x -= (textWidth / 2);
} else {
x -= textWidth; // 'End' (right justify)
}
}
if (obj.boundingBox == null) {
TextBoundsCalculator proc = new TextBoundsCalculator(x, y);
enumerateTextSpans(obj, proc);
obj.boundingBox = new Box(proc.bbox.left, proc.bbox.top,
proc.bbox.width(), proc.bbox.height());
}
updateParentBoundingBox(obj);
checkForGradientsAndPatterns(obj);
checkForClipPath(obj);
boolean compositing = pushLayer();
enumerateTextSpans(obj, new PlainTextDrawer(x + dx, y + dy));
if (compositing)
popLayer(obj);
}
示例8: renderTextPath
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private void renderTextPath(SVG.TextPath obj) {
debug("TextPath render");
updateStyleForElement(state, obj);
if (!display())
return;
if (!visible())
return;
SVG.SvgObject ref = obj.document.resolveIRI(obj.href);
if (ref == null) {
error("TextPath reference '%s' not found", obj.href);
return;
}
SVG.Path pathObj = (SVG.Path) ref;
Path path = (new PathConverter(pathObj.d)).getPath();
if (pathObj.transform != null)
path.transform(pathObj.transform);
PathMeasure measure = new PathMeasure(path, false);
float startOffset = (obj.startOffset != null) ? obj.startOffset
.floatValue(this, measure.getLength()) : 0f;
// Handle text alignment
Style.TextAnchor anchor = getAnchorPosition();
if (anchor != Style.TextAnchor.Start) {
float textWidth = calculateTextWidth(obj);
if (anchor == Style.TextAnchor.Middle) {
startOffset -= (textWidth / 2);
} else {
startOffset -= textWidth; // 'End' (right justify)
}
}
checkForGradientsAndPatterns((SvgElement) obj.getTextRoot());
boolean compositing = pushLayer();
enumerateTextSpans(obj, new PathTextDrawer(path, startOffset, 0f));
if (compositing)
popLayer(obj);
}
示例9: render
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private void render(SVG.Text obj) {
debug("Text render");
updateStyleForElement(state, obj);
if (!display())
return;
if (obj.transform != null)
canvas.concat(obj.transform);
// Get the first coordinate pair from the lists in the x and y properties.
float x = (obj.x == null || obj.x.size() == 0) ? 0f : obj.x.get(0).floatValueX(this);
float y = (obj.y == null || obj.y.size() == 0) ? 0f : obj.y.get(0).floatValueY(this);
float dx = (obj.dx == null || obj.dx.size() == 0) ? 0f : obj.dx.get(0).floatValueX(this);
float dy = (obj.dy == null || obj.dy.size() == 0) ? 0f : obj.dy.get(0).floatValueY(this);
// Handle text alignment
Style.TextAnchor anchor = getAnchorPosition();
if (anchor != Style.TextAnchor.Start) {
float textWidth = calculateTextWidth(obj);
if (anchor == Style.TextAnchor.Middle) {
x -= (textWidth / 2);
} else {
x -= textWidth; // 'End' (right justify)
}
}
if (obj.boundingBox == null) {
TextBoundsCalculator proc = new TextBoundsCalculator(x, y);
enumerateTextSpans(obj, proc);
obj.boundingBox = new Box(proc.bbox.left, proc.bbox.top, proc.bbox.width(), proc.bbox.height());
}
updateParentBoundingBox(obj);
checkForGradientsAndPatterns(obj);
checkForClipPath(obj);
boolean compositing = pushLayer();
enumerateTextSpans(obj, new PlainTextDrawer(x + dx, y + dy));
if (compositing)
popLayer(obj);
}
示例10: renderTextPath
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private void renderTextPath(SVG.TextPath obj) {
debug("TextPath render");
updateStyleForElement(state, obj);
if (!display())
return;
if (!visible())
return;
SVG.SvgObject ref = obj.document.resolveIRI(obj.href);
if (ref == null) {
error("TextPath reference '%s' not found", obj.href);
return;
}
SVG.Path pathObj = (SVG.Path) ref;
Path path = (new PathConverter(pathObj.d)).getPath();
if (pathObj.transform != null)
path.transform(pathObj.transform);
PathMeasure measure = new PathMeasure(path, false);
float startOffset = (obj.startOffset != null) ? obj.startOffset.floatValue(this, measure.getLength()) : 0f;
// Handle text alignment
Style.TextAnchor anchor = getAnchorPosition();
if (anchor != Style.TextAnchor.Start) {
float textWidth = calculateTextWidth(obj);
if (anchor == Style.TextAnchor.Middle) {
startOffset -= (textWidth / 2);
} else {
startOffset -= textWidth; // 'End' (right justify)
}
}
checkForGradientsAndPatterns((SvgElement) obj.getTextRoot());
boolean compositing = pushLayer();
enumerateTextSpans(obj, new PathTextDrawer(path, startOffset, 0f));
if (compositing)
popLayer(obj);
}
示例11: render
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private void render(SVG.Text obj)
{
debug("Text render");
updateStyleForElement(state, obj);
if (!display())
return;
if (obj.transform != null)
canvas.concat(obj.transform);
// Get the first coordinate pair from the lists in the x and y properties.
float x = (obj.x == null || obj.x.size() == 0) ? 0f : obj.x.get(0).floatValueX(this);
float y = (obj.y == null || obj.y.size() == 0) ? 0f : obj.y.get(0).floatValueY(this);
float dx = (obj.dx == null || obj.dx.size() == 0) ? 0f : obj.dx.get(0).floatValueX(this);
float dy = (obj.dy == null || obj.dy.size() == 0) ? 0f : obj.dy.get(0).floatValueY(this);
// Handle text alignment
Style.TextAnchor anchor = getAnchorPosition();
if (anchor != Style.TextAnchor.Start) {
float textWidth = calculateTextWidth(obj);
if (anchor == Style.TextAnchor.Middle) {
x -= (textWidth / 2);
} else {
x -= textWidth; // 'End' (right justify)
}
}
if (obj.boundingBox == null) {
TextBoundsCalculator proc = new TextBoundsCalculator(x, y);
enumerateTextSpans(obj, proc);
obj.boundingBox = new Box(proc.bbox.left, proc.bbox.top, proc.bbox.width(), proc.bbox.height());
}
updateParentBoundingBox(obj);
checkForGradientsAndPatterns(obj);
checkForClipPath(obj);
boolean compositing = pushLayer();
enumerateTextSpans(obj, new PlainTextDrawer(x + dx, y + dy));
if (compositing)
popLayer(obj);
}
示例12: renderTextPath
import com.caverock.androidsvg.SVG.Style; //导入方法依赖的package包/类
private void renderTextPath(SVG.TextPath obj)
{
debug("TextPath render");
updateStyleForElement(state, obj);
if (!display())
return;
if (!visible())
return;
SVG.SvgObject ref = obj.document.resolveIRI(obj.href);
if (ref == null)
{
error("TextPath reference '%s' not found", obj.href);
return;
}
SVG.Path pathObj = (SVG.Path) ref;
Path path = (new PathConverter(pathObj.d)).getPath();
if (pathObj.transform != null)
path.transform(pathObj.transform);
PathMeasure measure = new PathMeasure(path, false);
float startOffset = (obj.startOffset != null) ? obj.startOffset.floatValue(this, measure.getLength()) : 0f;
// Handle text alignment
Style.TextAnchor anchor = getAnchorPosition();
if (anchor != Style.TextAnchor.Start) {
float textWidth = calculateTextWidth(obj);
if (anchor == Style.TextAnchor.Middle) {
startOffset -= (textWidth / 2);
} else {
startOffset -= textWidth; // 'End' (right justify)
}
}
checkForGradientsAndPatterns((SvgElement) obj.getTextRoot());
boolean compositing = pushLayer();
enumerateTextSpans(obj, new PathTextDrawer(path, startOffset, 0f));
if (compositing)
popLayer(obj);
}