When using the RotateImage method of the bitmap object, it takes about 500ms to complete its operation. Is there anyway to speed this up?
I need about a 9Hz refresh rate on the image. What I am doing is making a steering wheel that I can rotate as data is updated which occurs at about 10Hz. The only way I could think of doing this is with the Bitmap since there is no native gauge object.
Thoughts?
// Background
byte[] bgImage = Resources.GetBytes(Resources.BinaryResources.bg);
Bitmap bgBitMap = new Bitmap(bgImage, Bitmap.BitmapImageType.Jpeg);
lcd.DrawImage(0, 0, bgBitMap, 0, 0, SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
lcd.Flush();
// LR logo
byte[] lrBytes = Resources.GetBytes(Resources.BinaryResources.lrLogo);
Bitmap lrBitmap = new Bitmap(lrBytes, Bitmap.BitmapImageType.Jpeg);
lcd.DrawImage(0,0, lrBitmap, 0, 0, 150,45);
lcd.Flush(0,0,150,45);
// Steering wheel
byte[] image = Resources.GetBytes(Resources.BinaryResources.sw);
Bitmap bitMap = new Bitmap(image, Bitmap.BitmapImageType.Jpeg);
lcd.DrawImage(125,50, bitMap, 0, 0, 200, 200);
lcd.Flush(125,50,200,200);
int degrees = -90;
Stopwatch sw = new Stopwatch();
while (true)
{
sw.Start();
//Thread.Sleep(10); // Update rate on steering wheel is 10Hz or 100ms(p)
lcd.RotateImage(degrees++, 125,50,bitMap, 0,0, 200,200, 255);
lcd.Flush(125, 50, 200, 200);
sw.Stop();
int et = sw.ElapsedDuration.Milliseconds;
if (degrees == 180)
degrees = -90;
}