![]() Is it valid to create compatible member DCs and bitmaps at initialisation and retain them for the life of the application? You said -> "Thirdly I'd avoid creating DCs all over the place." ![]() Presumably I would need to use 'StretchBlt' to scale but this would be a once-only exercise at initialisation. At initialisation I could scale each of the component bitmaps so that I only use 'BitBlt' to combine them as required. The code currently allows the bitmaps to be scaled to any size but in practice I would have a fixed (small) size on the form view and a second larger size in the dialog. You said -> "Secondly I'd cache pre-scaled versions of the image (avoid using StretchBlt unless really necessary). "ĭo you mean that I can alter the format of the native bitmaps to match the screen DC in some way? What if the app is run on a different PC with a different configuration? You said -> "Firstly, I'd ensure that I'm storing the images in the same format as the screen's DC. Last edited by Dg Gorilla July 7th, 2003 at 11:47 AM. Bitmaps onto background BitmapīOOL CDlgPanel1::GenerateOverallBitmap(CDC *pDC)ĬBitmap* pOldBitmap = ( CBitmap* )memDC.SelectObject( &pBitmapData->Bitmap ) M_ ( &m_BmpDataLedRed.Properties ) īOOL CDlgPanel1: rawScaledBitmap(CRect targetRect, CDC *pDC)ĬBitmap* pOldBitmap = ( CBitmap* )memDC.SelectObject( &m_BmpDataBackground.Bitmap ) declare objects for background bitmap and two coloured LEDs struct to keep bitmap and properties objects together The following code snippets are extracted from the dialog class:. The dialog also uses this function to draw on its own CPaintDC device context (when responding to OnPaint) and the CClientDC device context when updating at other times. This member allows the form view to get the dialog class to draw a small panel in the forms CClientDCĭevice context. The dialog class provides a member function 'DrawScaledBitmap' with takes a target rect and a device context pointer. ![]() The dialog class for each equipment item is responsible for generating the bitmap. The panel is then displayed on a larger scale in a modal dialog. Each panel can be viewed in more detail by clicking on the panel. The code is organised such that a form view displays a number of equipment front panels. that the code itself is sound (famous last words I know). I'm pretty sure from looking at this forum, MSDN, etc. Is this method is only suitable for once only 'paints'? Is there a better, faster method? two bitmap updates per second) I found it to be extremely processor intensive (50%+ according to Task Manager). However, when I coded an example which flashed an LED once per second ( i.e. Then StretchBlt would be used to scale the front panel bitmap and copy it into the client area of a form view.Īs the state of the 'equipment' changes then the panel bitmap would be regenerated to reflect the new status. Each 'panel' would be generated by BitBlt'ing individual LED & Switch position bitmaps onto a blank panel bitmap. ![]() It was my original intention to use the StretchBlt/BitBlt functions. I am in the initial stages of coding an application that will provide a visual representation of the front panels of physical equipment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |