2016-04-20 2 views
0

Zum Beispiel gibt es ein Bild, dass eine Zeile mit einigen kurzen Zeilen-Array auf ihm.
enter image description here
Ich weiß, dass ich es als dieser Code:Wie man Android pathEffect zu einem SVG-Muster macht

mPaint.setColor(context.getResources().getColor(R.color.MAIN_CONTOUR_LINE_YELLOW)); 
mPaint.setStyle(Paint.Style.STROKE); 
Path effectPath = new Path(); 
      effectPath.addRect(0,0.75f,0.21f,0.75f, 
        Path.Direction.CCW); 
      mPaint.setPathEffect(
        new PathDashPathEffect(
          effectPath, 0.96f, 0, 
          PathDashPathEffect.Style.MORPH)); 

stemPaint.setColor(context.getResources().getColor(R.color.MAIN_CONTOUR_LINE_YELLOW)); 
    stemPaint.setStyle(Paint.Style.STROKE);//the stem line 

so können wir sehen, wir haben nicht wirklich berechnen, wo alle kurzen Linien an sich. Aber in einer bestimmten professionellen Grafik-Software, Bildausgabe als svg und hier ist öffne ich es als Text

<polyline fill="none" stroke="#D47A00" stroke-width="1.05" stroke-linejoin="bevel" stroke-miterlimit="10" points="253,412.9 
340.8,396.8 343,445.5 "/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="254" y1="412.7" x2="254.4" y2="415"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="255.9" y1="412.3" x2="256.3" y2="414.6"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="257.9" y1="412" x2="258.3" y2="414.2"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="259.8" y1="411.6" x2="260.2" y2="413.9"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="261.8" y1="411.3" x2="262.1" y2="413.5"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="263.7" y1="410.9" x2="264.1" y2="413.2"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="265.7" y1="410.5" x2="266.1" y2="412.8"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="267.6" y1="410.2" x2="268" y2="412.5"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="269.6" y1="409.8" x2="270" y2="412.1"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="271.5" y1="409.5" x2="271.9" y2="411.7"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="273.5" y1="409.1" x2="273.9" y2="411.4"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="275.4" y1="408.7" x2="275.8" y2="411"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="277.4" y1="408.4" x2="277.8" y2="410.7"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="279.3" y1="408" x2="279.7" y2="410.3"/> 
<line fill="none" stroke="#D47A00" stroke-width="0.6" stroke-linejoin="bevel" stroke-miterlimit="10" x1="281.3" y1="407.7" x2="281.7" y2="409.9"/> 

die <line> mehr als 2 oder 3 mal als oben tatsächlich, ich habe es hier löschen. Ich weiß bereits, <polyline> ist die Stammlinie und ich kenne <path> mit seinen l, m, c char bedeutet.
Also, wie mache ich den Effekt Pfad trans zu Svg-Datei und umgekehrt?

Antwort

0

Was Sie bereits haben, ist über das Beste, was Sie tun können.

Sie können dies jedoch etwas vortäuschen, indem Sie Versatzlinien hinzufügen und ein entsprechendes Strichmuster anwenden. Dies ist jedoch keine wirklich gute allgemeine Lösung.

<svg viewBox="0 0 100 60"> 
 
    <polyline fill="none" stroke="#D47A00" stroke-width="1.05" stroke-linejoin="bevel" stroke-miterlimit="10" points="3,22.9 
 
90.8,6.8 93,55.5 "/> 
 
    <polyline fill="none" stroke="#D47A00" stroke-width="4" points="3,20.9 
 
90.8,4.8" stroke-dasharray="0 1 0.5 1"/> 
 
    <polyline fill="none" stroke="#D47A00" stroke-width="4" points="92.8,5.8 95,55.5 " stroke-dasharray="0 1 0.5 1"/> 
 
</svg>

+0

es so scheint i PathEffect verwendet hat keinen Sinn machen, ging ich schließlich eine all kurzen Linien oder Punkte, die durch eine berechnen. –

+0

wie auch immer, vielen Dank für die Antwort. (Obwohl ich nicht wirklich will es akzeptieren. Übrigens wissen Sie, wie kann ich ein Standard-SVG-Dateiformat, or.ai, .eps, .tiff. –

+0

I Ich bin mir nicht sicher, was Sie mit "Einrichtung eines Dateiformats" meinen. –

Verwandte Themen