Solved

bitmap display

Posted on 1997-04-24
1
192 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now