Solved

Bitmap Display

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 78
Pressing cancel button with C# UI Automation 3 66
ASCII Non-Printable characters/codes and their HTML equivalents 6 114
Excel file not created as expected 7 71
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 …
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

785 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