Hi Mark,
I'm not really sure how to convert an image into a texture, but you
can extract the raw bytes from a UIImage using some code like this:

NSData data = image.AsJPEG (1.0f);
MemoryStream memory = new MemoryStream ();

using (var stream = data.AsStream ()) {
    byte[] buf = new byte[4096];
    int nread;

    do {
        nread = stream.Read (buf, 0, buf.Length);
        if (nread > 0)
            memory.Write (buf, 0, nread);
    }  while (nread > 0);
}

byte[] rawdata = memory.ToArray ();

(Note: this code is untested, but should provide a rough idea of how to do it)

Hope that helps,

Jeff


On Wed, Sep 14, 2011 at 10:18 AM, Mark Ripley <m...@markripley.com> wrote:
>
> Hi,
>
> Does anyone have an example of loading an image and turning it into a 
> texture? I can't find a sample anywhere, and I've given up searching through 
> the API docs :(
>
> Thanks!
>
> M
>
>
> Mark Ripley
> Founder
> Effervescing Elephant Interactive
> eeinteractive.com (http://eeinteractive.com/)
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to