02-09-2020, 04:53 PM
I have an IW app which is a map tile server that creates tiles (via bitmap then to png) if they do not already exist using threads. UserSession thread should be equivalent in your case.
Below is a sample locking / unlocking a bitmap while editing and should eliminate collisions.
Regards,
Mark
Below is a sample locking / unlocking a bitmap while editing and should eliminate collisions.
Code:
try {
try {
...
if(!bmp->Canvas->TryLock()) { LogError("BMP TryLock failed."); return; }
...
//SAMPLE BMP MANIPULATION
...
bmp->Canvas->CopyMode = cmSrcCopy;
bmp->Canvas->CopyRect(Types::TRect(0,0,IDIM,IDIM),bmp_odim->Canvas,Types::TRect((ODIM-IDIM)/2,(ODIM-IDIM)/2,((ODIM-IDIM)/2)+IDIM,((ODIM-IDIM)/2)+IDIM));
//END SAMPLE
...
} catch (Exception &e) {
LogError("RenderToCanvas: "+e.Message);
}
} __finally {
if(bmp->Canvas->LockCount) bmp->Canvas->Unlock();
}Regards,
Mark

