Search in sources :

Example 16 with GeneralPath

use of com.codename1.ui.geom.GeneralPath in project CodenameOne by codenameone.

the class ChartComponent method screenToChartShape.

/**
 * Converts a chart coordinate spaced shape to the same shape in the screen coordinate space
 * @param s shape in screen coordinates
 * @return same shape using chart space coordinates
 */
public Shape screenToChartShape(Shape s) {
    GeneralPath p = new GeneralPath();
    Transform t = Transform.makeIdentity();
    if (currentTransform != null) {
        t.concatenate(currentTransform.getInverse());
    }
    t.translate(-getAbsoluteX(), -getAbsoluteY());
    p.append(s.getPathIterator(t), false);
    return p;
}
Also used : GeneralPath(com.codename1.ui.geom.GeneralPath) Transform(com.codename1.ui.Transform)

Aggregations

GeneralPath (com.codename1.ui.geom.GeneralPath)16 Paint (com.codename1.charts.compat.Paint)3 Point (com.codename1.charts.models.Point)3 Image (com.codename1.ui.Image)3 Graphics (com.codename1.ui.Graphics)2 Transform (com.codename1.ui.Transform)2 Rectangle (com.codename1.ui.geom.Rectangle)2 PathMeasure (com.codename1.charts.compat.PathMeasure)1 Component (com.codename1.ui.Component)1 Dialog (com.codename1.ui.Dialog)1 Form (com.codename1.ui.Form)1