本文整理汇总了Java中com.androidplot.util.PixelUtils类的典型用法代码示例。如果您正苦于以下问题:Java PixelUtils类的具体用法?Java PixelUtils怎么用?Java PixelUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PixelUtils类属于com.androidplot.util包,在下文中一共展示了PixelUtils类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onPreInit
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
@Override
protected void onPreInit() {
pieWidget = new PieWidget(
getLayoutManager(),
this,
new SizeMetrics(
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_H_DP),
SizeLayoutType.FILL,
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_W_DP),
SizeLayoutType.FILL));
pieWidget.position(
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_X_OFFSET_DP),
XLayoutStyle.ABSOLUTE_FROM_CENTER,
PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_Y_OFFSET_DP),
YLayoutStyle.ABSOLUTE_FROM_CENTER,
AnchorPosition.CENTER);
pieWidget.setPadding(10, 10, 10, 10);
// TODO: can't remember why this getClass() check is neccessary. test if it actually is...
/*if (getClass().equals(PieChart.class) && attrs != null) {
loadAttrs(context, attrs);
}*/
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:26,代码来源:PieChart.java
示例2: getLinePaint
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
private Paint getLinePaint ( float width, int color ) {
Paint linePaint = new Paint();
linePaint.setAntiAlias( true );
linePaint.setStrokeWidth( PixelUtils.dpToPix( width ) );
linePaint.setColor( color );
linePaint.setStyle( Paint.Style.STROKE );
return linePaint;
}
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:10,代码来源:MainActivity.java
示例3: processBaseAttrs
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
/**
* Apply base class attrs.
* @param attrs
*/
private void processBaseAttrs(TypedArray attrs) {
setTitle(attrs.getString(R.styleable.Plot_plotLabel));
getTitleWidget().getLabelPaint().setTextSize(
attrs.getDimension(R.styleable.Plot_plotLabelTextSize,
PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP)));
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:11,代码来源:Plot.java
示例4: onSizeChanged
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
@Override
protected synchronized void onSizeChanged (int w, int h, int oldw, int oldh) {
// update pixel conversion values
PixelUtils.init(getContext());
// disable hardware acceleration if it's not explicitly supported
// by the current Plot implementation. this check only applies to
// honeycomb and later environments.
if (Build.VERSION.SDK_INT >= 11) {
if (!isHwAccelerationSupported() && isHardwareAccelerated()) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
}
// pingPong is only used in background rendering mode.
if(renderMode == RenderMode.USE_BACKGROUND_THREAD) {
pingPong.resize(h, w);
}
RectF cRect = new RectF(0, 0, w, h);
RectF mRect = boxModel.getMarginatedRect(cRect);
RectF pRect = boxModel.getPaddedRect(mRect);
layout(new DisplayDimensions(cRect, mRect, pRect));
super.onSizeChanged(w, h, oldw, oldh);
if(renderThread != null && !renderThread.isAlive()) {
renderThread.start();
}
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:31,代码来源:Plot.java
示例5: initLinePaint
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
protected void initLinePaint(Integer lineColor) {
if (lineColor == null) {
linePaint = null;
} else {
linePaint = new Paint();
linePaint.setAntiAlias(true);
linePaint.setStrokeWidth(PixelUtils.dpToPix(DEFAULT_LINE_STROKE_WIDTH_DP));
linePaint.setColor(lineColor);
linePaint.setStyle(Paint.Style.STROKE);
}
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:12,代码来源:LineAndPointFormatter.java
示例6: initVertexPaint
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
protected void initVertexPaint(Integer vertexColor) {
if (vertexColor == null) {
vertexPaint = null;
} else {
vertexPaint = new Paint();
vertexPaint.setAntiAlias(true);
vertexPaint.setStrokeWidth(PixelUtils.dpToPix(DEFAULT_VERTEX_STROKE_WIDTH_DP));
vertexPaint.setColor(vertexColor);
vertexPaint.setStrokeCap(Paint.Cap.ROUND);
}
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:12,代码来源:LineAndPointFormatter.java
示例7: initTextPaint
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
protected void initTextPaint(Integer textColor) {
if (textColor == null) {
setTextPaint(null);
} else {
setTextPaint(new Paint());
getTextPaint().setAntiAlias(true);
getTextPaint().setColor(textColor);
getTextPaint().setTextAlign(Paint.Align.CENTER);
getTextPaint().setTextSize(PixelUtils.spToPix(DEFAULT_TEXT_SIZE_SP));
//textPaint.setStyle(Paint.Style.STROKE);
}
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:13,代码来源:PointLabelFormatter.java
示例8: initGraph
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
protected void initGraph(final boolean isEmpty) {
int greyColor = getAppResouces().getColor(android.R.color.secondary_text_light_nodisable);
xyPlot.getGraphWidget().getDomainGridLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeSubGridLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeGridLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainSubGridLinePaint().setColor(greyColor);
xyPlot.getBackgroundPaint().setColor(Color.WHITE);
xyPlot.setPlotMargins(0, 0, 0, 0);
xyPlot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE);
xyPlot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE);
xyPlot.getGraphWidget().getCursorLabelBackgroundPaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainOriginLabelPaint().setColor(Color.WHITE);
xyPlot.getGraphWidget().getRangeOriginLabelPaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainOriginLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeOriginLinePaint().setColor(greyColor);
xyPlot.getGraphWidget().getDomainLabelPaint().setColor(greyColor);
xyPlot.getGraphWidget().getRangeLabelPaint().setColor(greyColor);
xyPlot.getDomainLabelWidget().getLabelPaint().setColor(greyColor);
xyPlot.getRangeLabelWidget().getLabelPaint().setColor(greyColor);
xyPlot.getDomainLabelWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_CENTER,
0, YLayoutStyle.RELATIVE_TO_BOTTOM, AnchorPosition.BOTTOM_MIDDLE);
xyPlot.getTitleWidget().getLabelPaint().setColor(Color.TRANSPARENT);
xyPlot.getTitleWidget().setVisible(false);
xyPlot.getLegendWidget().setVisible(false);
float domainLabelWidth = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelWidth);
float rangeLabelWidth = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelWidth);
float rangeLabelVerticalOffset = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelVerticalOffset);
float domainLabelMarginLeft = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelMarginLeft);
float domainLabelMarginRight = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelMarginRight);
float rangeLabelMargin = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelMargin);
float gridPaddingMargin = getAppResouces().getDimensionPixelSize(R.dimen.gridPaddingMargin);
float gridPaddingMarginRight = getAppResouces().getDimensionPixelSize(R.dimen.gridPaddingMarginRight);
xyPlot.getDomainLabelWidget().setMargins(domainLabelMarginLeft, 0, domainLabelMarginRight, 0);
xyPlot.getRangeLabelWidget().setMargins(rangeLabelMargin, 0, rangeLabelMargin, 0);
xyPlot.getGraphWidget().setGridPadding(gridPaddingMargin, gridPaddingMargin, gridPaddingMarginRight, gridPaddingMargin);
xyPlot.getGraphWidget().setDomainLabelWidth(domainLabelWidth);
xyPlot.getGraphWidget().setRangeLabelWidth(rangeLabelWidth);
xyPlot.getGraphWidget().setDomainLabelHorizontalOffset(0);
xyPlot.getGraphWidget().setRangeLabelVerticalOffset(rangeLabelVerticalOffset);
xyPlot.getDomainLabelWidget().pack();
xyPlot.getRangeLabelWidget().pack();
final String secStr = getContext().getString(R.string.seconds);
final DecimalFormat domainFmt = new DecimalFormat("#.#");
xyPlot.setDomainValueFormat(new NumberFormat() {
@Override
public StringBuffer format(double d, StringBuffer sb, FieldPosition fp) {
return sb.append(domainFmt.format(d / 50f)).append(secStr);
}
@Override
public StringBuffer format(long l, StringBuffer stringBuffer, FieldPosition fieldPosition) {
return null;
}
@Override
public Number parse(String s, ParsePosition parsePosition) {
return null;
}
});
xyPlot.setRangeValueFormat(new DecimalFormat("#.#G"));
xyPlot.setDomainBoundaries(0, 100, BoundaryMode.FIXED);
xyPlot.setDomainStepValue(2);
xyPlot.setRangeStepValue(11);
xyPlot.setRangeBoundaries(-0.5f, 0.5f, BoundaryMode.FIXED);
DashPathEffect dashFx = new DashPathEffect(new float[] {PixelUtils.dpToPix(3), PixelUtils.dpToPix(3)}, 0);
xyPlot.getGraphWidget().getDomainGridLinePaint().setPathEffect(dashFx);
xyPlot.getGraphWidget().getRangeGridLinePaint().setPathEffect(dashFx);
setGraphData(null);
}
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:72,代码来源:StartMeasurementFragment.java
示例9: init
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
PixelUtils.init(getContext());
layoutManager = new LayoutManager();
titleWidget = new TextLabelWidget(layoutManager, new SizeMetrics(25,
SizeLayoutType.ABSOLUTE, 100,
SizeLayoutType.ABSOLUTE),
TextOrientationType.HORIZONTAL);
titleWidget.position(0, XLayoutStyle.RELATIVE_TO_CENTER, 0,
YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.TOP_MIDDLE);
// initialize attr defaults:
titleWidget.getLabelPaint().setTextSize(
PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP));
onPreInit();
// make sure the title widget is always the topmost widget:
layoutManager.moveToTop(titleWidget);
if(context != null && attrs != null) {
loadAttrs(attrs, defStyle);
}
layoutManager.onPostInit();
//Log.d(TAG, "AndroidPlot RenderMode: " + renderMode);
if (renderMode == RenderMode.USE_BACKGROUND_THREAD) {
renderThread = new Thread(new Runnable() {
@Override
public void run() {
keepRunning = true;
while (keepRunning) {
isIdle = false;
synchronized (pingPong) {
Canvas c = pingPong.getCanvas();
renderOnCanvas(c);
pingPong.swap();
}
synchronized (renderSynch) {
postInvalidate();
// prevent this thread from becoming an orphan
// after the view is destroyed
if (keepRunning) {
try {
renderSynch.wait();
} catch (InterruptedException e) {
keepRunning = false;
}
}
}
}
System.out.println("AndroidPlot render thread finished.");
}
});
}
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:55,代码来源:Plot.java
示例10: getElementCoordinates
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
public PointF getElementCoordinates(float height, float width, RectF viewRect, PositionMetrics metrics) {
float x = metrics.getXPositionMetric().getPixelValue(viewRect.width()) + viewRect.left;
float y = metrics.getYPositionMetric().getPixelValue(viewRect.height()) + viewRect.top;
PointF point = new PointF(x, y);
return PixelUtils.sub(point, getAnchorOffset(width, height, metrics.getAnchor()));
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:7,代码来源:Widget.java
示例11: getAnchorCoordinates
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
public static PointF getAnchorCoordinates(RectF widgetRect, AnchorPosition anchorPosition) {
return PixelUtils.add(new PointF(widgetRect.left, widgetRect.top),
getAnchorOffset(widgetRect.width(), widgetRect.height(), anchorPosition));
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:5,代码来源:Widget.java
示例12: PointLabelFormatter
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
public PointLabelFormatter(int textColor) {
this(textColor, PixelUtils.dpToPix(DEFAULT_H_OFFSET_DP),
PixelUtils.dpToPix(DEFAULT_V_OFFSET_DP));
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:5,代码来源:PointLabelFormatter.java
示例13: onResume
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
public void onResume(Context context) {
PixelUtils.init(context);
int line = context.getResources().getColor(R.color.chart_line);
LineAndPointFormatter formatter = new LineAndPointFormatter(line, line, null, null);
this.dynamicPlot.addSeries(series, formatter);
int red = context.getResources().getColor(R.color.lower_highlight);
fixedRedLineFormatter = new LineAndPointFormatter(red, null, null, null);
int green = context.getResources().getColor(R.color.higher_highlight);
fixedGreenLineFormatter = new LineAndPointFormatter(green, null, null, null);
this.clean();
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-MPNStockList-client-android,代码行数:19,代码来源:Chart.java
示例14: getRoundedRect
import com.androidplot.util.PixelUtils; //导入依赖的package包/类
/**
* Same as getRectF but with edges rounded to the nearest full pixel.
* @param canvasRect
* @return
*/
public RectF getRoundedRect(RectF canvasRect) {
return PixelUtils.nearestPixRect(0, 0, widthMetric.getPixelValue(canvasRect.width()),
heightMetric.getPixelValue(canvasRect.height()));
}
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:10,代码来源:SizeMetrics.java
注:本文中的com.androidplot.util.PixelUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论