I’ve been modifying some basic web server code on my Spider to share out an image. I find the image load (BMP format) is painfully slow and decided to pump it out as a JPEG. So far I’m modifying the basic picture by creating a Microsoft.SPOT.Bitmap and drawing on it, then puttting it back into a Gadgeteer.Picture so that I can use the WebServer responder, I’ve attached the bulk of the code, but currently I get nothing back.
void camera_PictureCaptured(Camera sender, GT.Picture picture) //camera handler for post picture captured
{
bmap = picture.MakeBitmap();
bmap.DrawText(strDateTime, MyFont, Color.Black, 1, 1); //draw DTG over the image
bmap.DrawText(strDateTime, MyFont, Color.White, 0, 0);
display.SimpleGraphics.DisplayImage(bmap, 0, 0);
}
… some more code… This bit handles serving out the image
but all I get is the broken image icon in my web browser. If I revert to just showing the original captured GT.Picture everything works fine. I’ve debugged and looked at locals and they all look right but it would seem as though something is breaking within responder. No exceptions on running either.
How about taking a Microsoft.SPOT.Bitmap and getting it out as a GT.Picture (GT=Gadgeteer). I tried to do that as well and got nothing. It’s like the responder doesn’t like the byte stream or something.
The code would have looked like this,
bmap = picture.MakeBitmap();
bmap.DrawText(strDateTime, MyFont, Color.Black, 1, 1); //draw DTG over the image
bmap.DrawText(strDateTime, MyFont, Color.White, 0, 0);
At this point I’ve got a valid bitmap, now to the Picture part,
pic = new GT.Picture(bmap.GetBitmap(), GT.Picture.PictureEncoding.BMP);
responder.Respond(pic);
silly question, but how to I roll the premium libraries for my spider into the project? I’m assuming it’s just a reference but I can’t seem to find it. Looking at tutorials now.
EDIT - I see it’s in the GHIElectronics.NETMF libraries that are already in my project. It looks like the API set is bigger for the Spider and I see the Bitmap stuff in utils. Thanks for the tip.
Gus, I got em. I may port FJCore over to run on .NETMF I wouldn’t require RLP, but it looks like it would be pretty big compiled. Probably slow as heck. I’ll give it a few hours and see how far I get.