Jump to content
  • Advertisement
Sign in to follow this  
calvinhobbs

Pixel size and line thickness

This topic is 5172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a MFC application which can plot data points in a graph. 1. Is it possible that while plotting a pixel point, I could change the size of it? The code which I have used: CDC *dc; CPoint cPt; cPt.x = 0.1; cPt.y = 0.1; dc->SetPixel(cPt,cRGB); // CRGB is an instance of COLORREF 2. Is it possible to change the default thickness of the line? For drawing the line: dc->LineTo(cPt); Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
To change the thickness of a line, you'll have to change the pen you are using :


CPen pen(PS_SOLID, 5 /*thickness*/, RGB(0,0,0));
CPen *oldpen;

// new thickness/color/styleoldpen = dc->SelectObject(&pen);
dc->LineTo(pt);
// return to the original thickness/color/style
dc->SelectObject(oldpen);



Not sure but it may also change the pixel size (not tested... I haven't drawn a pixel using SetPixel() for at least 5 years :)

HTH

Share this post


Link to post
Share on other sites


Specifying the thickness in CPen worked for drawing the line but did not work for the increasing the pixel size ..

How do you plot a point in MFC and specify the size of it?

Any hints please ..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by calvinhobbs


Specifying the thickness in CPen worked for drawing the line but did not work for the increasing the pixel size ..

How do you plot a point in MFC and specify the size of it?

Any hints please ..


uh, the physical size (i.e. size as seen on the display) of a pixel is determined by your resolution. if you want to draw an arbitrarily sized point, then you need to draw multiple pixels (the smallest point, of course, is the size of a pixel).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
btw.. you could just draw a line which is one-unit long, to draw a 'point'. then you can use the pen to determine the size of such a point.

:-/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!