I have this sample code from Jason King:
[code]Function Pixel(extends g as iOSGraphics, x as integer, y as integer) As Color
'Jason King
'It works on both iOSGraphics and iOSImage. Just call img.Pixel(x,y) or g.Pixel(x,y) to get the color at the specified position. Enjoy!
const UIKitLib = "UIKit.framework"
const CoreGraphicsLib = "CoreGraphics.framework"
const FoundationLib = "Foundation.framework"
declare function CGBitmapContextCreateImage lib CoreGraphicsLib (context as ptr) as ptr
dim cgimageref as ptr = CGBitmapContextCreateImage(g.Handle)
declare function imageWithCGImage lib UIKitLib selector "imageWithCGImage:" (clsRef as ptr, img as ptr) as ptr
declare function NSClassFromString lib FoundationLib (clsName as CFStringRef) as ptr
dim newUIImage as ptr = imageWithCGImage(NSClassFromString("UIImage"), cgimageref)
Return iOSImage.FromHandle(newUIImage).Pixel(x,y)
End Function[/code]
Silly question: I added this to a global method as a new function, but I cant seem to get it to appear as a function of an iOSGraphics object.
Where should I be putting this code to make it work?