Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

changing stroke dynamically

More
IP: 192.168.0.71 8 years 4 months ago #13147 by rohitgarg2990
I am trying to change stroke dynamically for which i have given some options which is working fine but when i hit "Confirm", it goes back to original stroke width. Can someone tell pls what's wrong? I am adding my stroke width dynamically via calling Draw method from Ink class.

public void OnDraw(Canvas canvas, float scrollx, float scrolly, float width)
{
m_paint.setStrokeWidth(width);
if(canvas == null) return;
if(m_method != 2)
{
m_path.reset();
m_path_append.reset();
path_idx = 0;
m_method = 2;
}
int index = path_idx;
int cnt = getNodeCount(hand);
int new_idx = 0;
while( index < cnt )
{
int op = getNode( hand, index, pt1 );
switch( op )
{
case 1:
m_path_cur.lineTo(pt1[0] + scrollx, pt1[1] + scrolly);
index++;
break;
case 2:
getNode( hand, index + 1, pt2 );
m_path_cur.quadTo(pt1[0] + scrollx, pt1[1] + scrolly, pt2[0] + scrollx, pt2[1] + scrolly);
index += 2;
break;
default:
m_path_append.reset();
m_path_append.addPath(m_path_cur);
new_idx = index;//last MoveTo
m_path_cur.moveTo(pt1[0] + scrollx, pt1[1] + scrolly);
index++;
break;
}
}
canvas.drawPath(m_path, m_paint);
//Redraw old lines with stored stroke width
/*if (strokeWidthMemory.size() > 0) {
for (Path p : strokeWidthMemory.keySet()) {
m_paint.setStrokeWidth(strokeWidthMemory.get(p));
canvas.drawPath(p, m_paint);
}
}*/
Log.v("printing size","ok"+strokeWidthMemory.size());
canvas.drawPath(m_path_cur, m_paint);
if(new_idx > path_idx)
{
path_idx = new_idx;
m_path.addPath(m_path_append);
strokeWidthMemory.put(m_path_append, m_paint.getStrokeWidth());
}
m_path_cur.reset();
}
More
IP: 192.168.0.71 8 years 4 months ago - 8 years 4 months ago #13148 by Davide
Replied by Davide on topic changing stroke dynamically
Hi,
you are changing only the draw phase, not the annotation stroke itself, you can change stroke width for an already created annotation using this method :
Code:
annot.SetStrokeWidth(float width)

For more info check this : www.radaeepdf.com/documentation/javadocs...etStrokeWidth-float-

You have to change the stroke width even in the add phase, please check the AddAnnotRect, AddAnnotEllipse etc.. methods in PDFLayoutView
This thread will help you : www.radaeepdf.com/forum/Android-developm...roke-and-fill-colors
Last edit: 8 years 4 months ago by Davide.
Time to create page: 0.380 seconds
Powered by Kunena Forum