Solved

bitmap display

Posted on 1997-04-24
1
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 98
notReplace  challenge 53 151
Bartender label printing - switch on and off graphics 3 77
Problem to App source 6 94
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

730 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