?
Solved

Bitmap Display

Posted on 2002-05-24
4
Medium Priority
?
301 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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. …
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

777 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