Solved

bitmap display

Posted on 1997-04-24
1
194 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 110
EvenOdd challenge 10 126
canBalance challenge 34 98
ASP.NET C# MessageBox.Show Showing a modal dialog box or form when the application ... 2 163
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.

861 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