If you just need to render an image (either from a file or from memory), I believe IPicture interface is the easiest approach. You don't need to use any 3rd party library. Other thing would be if you have to perform image manipulations. I may be wrong though ...
Carlos ----- Original Message ----- From: "Weston Fryatt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 9:33 PM Subject: Re: [msvc] Render a picture on the DC > DC manipulation seems easy until you try to do something with it... I just > spend the past 2 weeks.. trying to load an image from memory and create a > CBitmap from it... sound easy.. until you try it... Every single function in > the GDI or GDI+ wants you to load an image from a "file".. I finally had to > use Lead Tools which can easily do this and work for all version ndows. > > Anyway... as long as you can get your image loaded into a DC the function > that you want to use is: > > >From MSDN: > BOOL StretchBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int > xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop ); > > Copies a bitmap from a source rectangle into a destination rectangle, > stretching or compressing the bitmap if necessary to fit the dimensions of > the destination rectangle. The function uses the stretching mode of the > destination device context (set by SetStretchBltMode) to determine how to > stretch or compress the bitmap. > > The StretchBlt function moves the bitmap from the source device given by > pSrcDC to the destination device represented by the device-context object > whose member function is being called. The xSrc, ySrc, nSrcWidth, and > nSrcHeight parameters define the upper-left corner and dimensions of the > source rectangle. The x, y, nWidth, and nHeight parameters give the > upper-left corner and dimensions of the destination rectangle. The raster > operation specified by dwRop defines how the source bitmap and the bits > already on the destination device are combined. > > > > BTW, I highly recommend Lead Tools if you are going to be doing a lot of DC > or Image manipulation. It is will worth the money! > > > ----- Original Message ----- > From: "Ehsan Akhgari" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, February 13, 2004 2:13 PM > Subject: [msvc] Render a picture on the DC > > > > I'm a kiddie when it comes to DC manipulation, so forgive me if from now > on > > I seem stupid! > > > > I need to read an image file (let's say, a .jpg) from disk, and display it > > as needed (with resizing depending on the control's dimensions) on my > > ActiveX control's DC (windowed control). There's nothing special about > > this. And the file format does not matter; it can be .bmp, .gif, .jpg, > > .png, anything. > > > > What I need is a solution that is simple, fast, usable on all versions of > > windows, and easy to perform for a DC kiddie. And I need to prepare it as > > quickly as I can, because the deadline I have to face is very near. > > > > I did a search on MSDN, and found lots of information. Many of it looks > > good, but I don't have enough knowledge to make a decision on which path > to > > take, nor do I have enough time to read up on the subject on my own (my > > usual method of learning.) > > > > So is anyone feeling like struggling with a DC newbie? :-) > > > > Thanks! > > ------------- > > Ehsan Akhgari > > > > Farda Technology (www.farda-tech.com) > > > > List Owner: [EMAIL PROTECTED] > > > > [ Email: [EMAIL PROTECTED] ] > > [ WWW: http://www.beginthread.com/Ehsan ] > > > > In the mountains the shortest way is from peak to peak, but for that route > > you must have long legs. Aphorisms should be peaks, and those spoken to > > should be tall and lofty. > > -Thus Spoke Zarathustra, F. W. Nietzsche > > > > > > > > > > _______________________________________________ > > msvc mailing list > > [EMAIL PROTECTED] > > See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for > subscription changes, and list archive. > > > > > _______________________________________________ > msvc mailing list > [EMAIL PROTECTED] > See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
