Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

Can't draw a point for annotation

More
9 years 11 months ago #11225 by Shades
Hello,

I have a strange issue.I can't draw a point it's always a line.The code below is for drawing .
Code:
-(void)drawInk:(CGContextRef)context { if( m_status == sta_ink && m_ink ) { NSLog(@"g_ink_color = %d",g_ink_color); int cnt = [m_ink nodesCount]; int cur = 0; CGContextSetLineWidth(context, g_Ink_Width); float red = ((g_ink_color>>16)&0xFF)/255.0f; float green = ((g_ink_color>>8)&0xFF)/255.0f; float blue = (g_ink_color&0xFF)/255.0f; float alpha = ((g_ink_color>>24)&0xFF)/255.0f; CGContextSetRGBStrokeColor(context, red, green, blue, alpha); CGContextBeginPath( context ); while( cur < cnt ) { PDF_POINT pt; PDF_POINT pt2; int type = [m_ink node: cur: &pt]; switch( type ) { case 1: CGContextAddLineToPoint(context, self.contentOffset.x + pt.x/m_scale, self.contentOffset.y + pt.y/m_scale); cur++; break; case 2: [m_ink node: cur + 1: &pt2]; CGContextAddCurveToPoint(context, self.contentOffset.x + pt.x/m_scale, self.contentOffset.y + pt.y/m_scale, self.contentOffset.x + pt.x/m_scale, self.contentOffset.y + pt.y/m_scale, self.contentOffset.x + pt2.x/m_scale, self.contentOffset.y + pt2.y/m_scale ); cur += 2; break; default: CGContextMoveToPoint(context, self.contentOffset.x + pt.x/m_scale, self.contentOffset.y + pt.y/m_scale); cur++; break; } } CGContextStrokePath( context ); } }

Thank you a lot for your help
More
9 years 11 months ago #11244 by stronglee
Hi,
In PDF document ,there is no pixel concept. If you want draw a point,here is same way
1.Draw line ,end point value subtract start point value equal the point's diameter where you want to draw
2.Add a image ,the image is 1 pixel like a point
Time to create page: 0.400 seconds
Powered by Kunena Forum