Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Bitmap Display

Posted on 2002-05-24
4
Medium Priority
?
305 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
[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
4 Comments
 
LVL 12

Accepted Solution

by:
migel earned 200 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

618 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