Closed kf6kjg closed 3 years ago
@kf6kjg Try using the BitmapUtility.
Ok, that seems to work though with an occasional crash:
var xbmu = new BitmapUtility(mapbmp.Bitmap);
GL.Blit();
xbmu.CopyFrom(GL, 0, 0, mapbmp.Width, mapbmp.Height - 1); // BUG: Leaves black lines on the edges. But if I don't subtract the one pixel I get a crash. Implies bug in the underlying code.
Should I Blit
then CopyFrom
as shown or the other way 'round?
GL.Blit()
will only copy the frameBuffers contents onto the form you selected, so it would be logical for first copy the contents of the bitmap onto the renderXF frameBuffer, and then copy that to the form.
Additionally I strongly suggest using the using statement as it ensures the bitmap bits are locked and then freed once the using statement ends, so the app wont be reading possible garbage left over by the GC.
// Lock the bits
using (BitmapUtility xbmu = new BitmapUtility(infoBitmap))
{
xbmu.CopyFrom(GL, 0, 0, 300, 100);
}
// Bits are free'd
As for the crashing for the minus 1 issue, I will try to release a fixed version later today, as I remember dealing with these kinds of issues when writing the improved bitmap blitter for DrawXF.
Thank you. I'll get switched over to the using syntax shortly.
So in my case, where I have no form, I don't need the Blit call.
At risk of going off topic should I switch over to xfdraw?
@kf6kjg Currently XFDraw doesn't have custom shader support, but it should have the basic custom shaders in less than a week. Because of this I would suggest waiting before commencing and new projects, however if you cannot wait id suggest just using renderXF.
BlitInto is now gone, replaced by the fully formed BlitIntoBitmap. Thank you.
If you don't get to it first, I probably will.
Method
renderX::BlitInto(BitMap, Rectangle)
is currently a no-op. This functionality is core to my needs: I do not have a screen or window to draw to, only a bitmap or equivalent.