2011-09-20 11 views
5

मोनो टच में CGImageCreateWithImageInRect आईओएस विधि के बराबर क्या है? पहले सेमोनो टच में CGImageCreateWithImageInRect के बराबर क्या है?

CGImageRef sampleImageRef = CGImageCreateWithImageInRect(self.CGImage, fillRect); 

धन्यवाद:

मैं सी # में इस ऑब्जेक्टिव-सी लाइन कन्वर्ट करने के लिए कोशिश कर रहा हूँ!

उत्तर

11

CoreGrapphics ढंग से काम की WithImageInRect विधि CGImage को CGImageCreateWithImageInRect अनुरूप हैं। एपीआई हस्ताक्षर है:

public CGImage WithImageInRect (RectangleF rect) 

एक बार ObjectiveC से अनुवादित अपने स्रोत कोड की तरह दिखना चाहिए:

CGImage sampleImageRef = this.CGImage.WithImageInRect (fillRect); 
+0

वे एक दूसरे के साथ लाइन में वास्तव में नहीं कर रहे हैं। CreateWithImageInRect खाते में स्थान को ध्यान में रखता है, जबकि WithImageInRect (मोनो संस्करण) केवल रेक्ट के आकार को ध्यान में रखता है। https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGImage/#//apple_ref/c/func/CGImageCreateWithImageInRect – Gandalf458