?
Solved

bitmap display

Posted on 1997-04-24
1
Medium Priority
?
199 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 400 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

741 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