Solved

Bitmap Display

Posted on 2002-05-24
4
260 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

929 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

20 Experts available now in Live!

Get 1:1 Help Now