Solved

Bitmap Display

Posted on 2002-05-24
4
248 Views
Last Modified: 2013-11-20
Hi,

I have a circle inside which I need to dispaly a bitmap. The bitmap is originally rectangular but I need to make it circular and display the modified circular image inside the circle which I have drawn. But because of overlapping I am not able to display the circular bitmap look like it is fitting inside a circle. Can anyone help me with this.

Regards,
Chutki.
0
Comment
Question by:Chutki
4 Comments
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 7031938
Hi You can use clipping mechanism
that us
1.Create Elleptical Region by CRgn::CreateEllipticRgn( int x1, int y1, int x2, int y2 );
2. set clipping in the destination DC
cDC.SelectClipRegion();
3. BitBlt your image
4.remove clipping by SelectClipRegion(NULL);
code example

// assume BITMAP is square and dimension is 2*nRadii;

MyView::DrawBMPInEllepce(CDC* pDC, CBitmap* pBM, POINT ptCenter, int nRadii)
{
CRgn clipRGN;
clipRGN.CreateEllipticRgn(ptCenter.x-nRadii, ptCenter.y-nRadii, ptCenter.x+nRadii, ptCenter.y+nRadii);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap* pbmOld = dcMem.SelectObject(pBM);
pDC->SelectClipRegion(&clipRGN);

pDC->bitBlt(ptCenter.x-nRadii, ptCenter.y-nRadii, 2*nRadii, 2*nRadii, &dcMem, 0,0, SRCCOPY);

dcMem.SelectObject(pbmOld);
pDC->SelectClipRegion(NULL);
}
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 47
Perl Awk Need Help 3 94
Expand macro to ask for filename column 8 35
iSeries DB2 Query 2 84
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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

757 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

18 Experts available now in Live!

Get 1:1 Help Now