Solved

bitmap display

Posted on 1997-04-24
1
193 Views
Last Modified: 2013-11-20
Iam trying to develop a MFC application to view bmps with wiping effect(this is similar to transition effects in slide presentation in MS-PowerPoint presentation) .Can anybody  give some hints to do this
0
Comment
Question by:brijesh042497
1 Comment
 
LVL 1

Accepted Solution

by:
jmmougeolle earned 200 total points
ID: 1301191
The easier way to do this is to use the 2 bitmaps and compute them in a MemDC when making a transition, the first one correspond to the Source bitmap, the second one to the Target Bitmap.

If as an example you would like to make it appear from up to down, like the Effect you could see in Powerpoint named Wipe Down (same effect that you could see in Star Wars Cooool!).

What you got to do is to always compute the displayed bitmap from BitBlt with the 2 bitmap on which you wanna have the transition.

You could construct it easely by 2 BitBlt on the Memory DC in that way:

Bitmap source: CBitmap bmpSource;
Bitmap Target, CBitmap bmpTarget;
Display size      long lFullHeight, lFullWidth;
Current Slide Top Height long lCurrentHeight;

void CMyView::OnDraw( CDC * pDC )
{

if (bDoingATransition)
{
  CDC memdc;
  CClientDC dcClient(this);

  // Create a compatible memory DC
  memdc.CreateCompatibleDC( &dcClient );

  // Select the bitmap into the DC
  poldbmp = memdc.SelectObject( &bmpSource );

  // Copy (BitBlt) bitmap from memory DC to screen DC
  dc.BitBlt(0, 0, lFullWidth, lFullHeight,&memdc,
                0, 0, SRCCOPY );
  memdc.SelectObject( &bmpTarget );
  dc.BitBlt(0, 0, lFullWidth, lCurrentHeight, &memdc,
                0, 0, SRCCOPY );
  memdc.SelectObject( poldbmp );
}
else
{
... //DO standard display Stuff...
}
}

//and in a Timer  you have to change the lCurrentHeight value
void CMyView::OnTimer(UINT nIDEvent)
{
if (nIDEvent = ID_TIMER_DO_TRANSITION_WIPE_DOWN)
{
  lCurrentHeight += lCurrentHeight/8;
  if (lCurrentHeight >= lFullHeight)
  {
      bTransitionDone = TRUE;
      bDoingATransition = FALSE;
      //Put here the code to change Source Bitmap and fill it
      //with the current Target Bitmap
   }
}
else
  CView::OnTimer((nIDEvent);
}


For the other transition, just change the way to compute the Result in MemDC. Most of the powerpoint transition can be just done by modifying the BitBlits parameters, and change on the compute on timer. For more sofisticated ones, you got to do mulitpple BitBlt, for, as an exemple, display a little square of each appear, one after the other...

And you could also create new ones easely...but that's another story!

May the MFC be with you!

jmmougeolle@calva.net strikes again!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question