के साथ एक पंक्ति पर त्रिकोण/तीर ड्रॉइंग मैं स्थानों के साथ काम करने के लिए मार्ग-मेरे ढांचे का उपयोग कर रहा हूं। इस कोड में दो मार्करों (बिंदुओं) के बीच का पथ एक रेखा के रूप में खींचा जाएगा।CGContext
मेरे प्रश्न: "क्या कोड मैं जोड़ने चाहिए अगर मैं रेखा के मध्य (या ऊपर) में एक तीर जोड़ना चाहते हैं, इतना है कि यह दिशा बताते हैं"
धन्यवाद
- (void)drawInContext:(CGContextRef)theContext
{
renderedScale = [contents metersPerPixel];
float scale = 1.0f/[contents metersPerPixel];
float scaledLineWidth = lineWidth;
if(!scaleLineWidth) {
scaledLineWidth *= renderedScale;
}
//NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale);
CGContextScaleCTM(theContext, scale, scale);
CGContextBeginPath(theContext);
CGContextAddPath(theContext, path);
CGContextSetLineWidth(theContext, scaledLineWidth);
CGContextSetStrokeColorWithColor(theContext, [lineColor CGColor]);
CGContextSetFillColorWithColor(theContext, [fillColor CGColor]);
// according to Apple's documentation, DrawPath closes the path if it's a filled style, so a call to ClosePath isn't necessary
CGContextDrawPath(theContext, drawingMode);
}
मैं इसे http://www.codeguru.com/cpp/gm/gdi/article.php/c3683 द्वारा कुछ समय पहले मिला वैसे भी जवाब Greetz – Pete
पीट के लिए Thansk, यह करने के लिए आप के लिए अच्छा हो सकता है फिर भी स्वीकार किए गए उत्तर को चिह्नित करें, या अपना जवाब उत्तर के रूप में पोस्ट करें और फिर उसे स्वीकार करें। –
@Pete आपने सही उत्तर क्यों चिह्नित नहीं किया (मेरा मतलब है फ्रेडहेल्म)? – yas375