From: Peter Olcott on 2 Mar 2010 23:03 "Tom Serface" <tom(a)camaswood.com> wrote in message news:Ols4NLouKHA.3896(a)TK2MSFTNGP02.phx.gbl... >I use GDI+ from C++ and it works just fine if you do, as >many have suggested, include the right libs. I also use >the CImage class: > > http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx > > that does a lot of the work for you. There are lots of > interesting articles on the web about this ATL class. I > find it very easy to use. It supports the same image > types as GDI+ as you'd expect. I don't think that it sued to load these other file types, and was not aware that it did now until I examined it again. I will try this out. > > Tom > > "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message > news:W7mdncFCK47CsRHWnZ2dnUVZ_v-dnZ2d(a)giganews.com... >> All of the links that I have found say they are showing >> you how to use GDI+ from C++, by they actually show you >> how to use GDI+ from C, not C++. For example they show >> you how to modify the WinMain() function. There is no >> WinMain() function in my MFC code. >> >> I want to be able to load and save PNG files and BMP >> files. Since Windows now does this, I would prefer to use >> Windows instead of any third party library. >>
From: Tom Serface on 3 Mar 2010 08:04 In that case CImage would work great for you. It can read, convert, and save any of the GDI+ types. Tom "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message news:crydnUAuO991QRDWnZ2dnUVZ_hqdnZ2d(a)giganews.com... > > "Tom Serface" <tom(a)camaswood.com> wrote in message > news:Ols4NLouKHA.3896(a)TK2MSFTNGP02.phx.gbl... >>I use GDI+ from C++ and it works just fine if you do, as many have >>suggested, include the right libs. I also use the CImage class: >> >> http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx >> >> that does a lot of the work for you. There are lots of interesting >> articles on the web about this ATL class. I find it very easy to use. >> It supports the same image types as GDI+ as you'd expect. >> >> Tom > > The main thing (and possibly the only thing) that I need from GDI+ is to > read and write PNG files. > >> >> "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message >> news:W7mdncFCK47CsRHWnZ2dnUVZ_v-dnZ2d(a)giganews.com... >>> All of the links that I have found say they are showing you how to use >>> GDI+ from C++, by they actually show you how to use GDI+ from C, not >>> C++. For example they show you how to modify the WinMain() function. >>> There is no WinMain() function in my MFC code. >>> >>> I want to be able to load and save PNG files and BMP files. Since >>> Windows now does this, I would prefer to use Windows instead of any >>> third party library. >>> > >
From: Tom Serface on 3 Mar 2010 08:10 Here's a tiny code snippet: CImage image; image.Load(csMyGraphicFile); // Don't need to know type at this point HRESULT hr = image.Save(csPNGPath,Gdiplus::ImageFormatPNG); if(SUCCEEDED(hr)) // It worked Tom "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message news:crydnUAuO991QRDWnZ2dnUVZ_hqdnZ2d(a)giganews.com... > > "Tom Serface" <tom(a)camaswood.com> wrote in message > news:Ols4NLouKHA.3896(a)TK2MSFTNGP02.phx.gbl... >>I use GDI+ from C++ and it works just fine if you do, as many have >>suggested, include the right libs. I also use the CImage class: >> >> http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx >> >> that does a lot of the work for you. There are lots of interesting >> articles on the web about this ATL class. I find it very easy to use. >> It supports the same image types as GDI+ as you'd expect. >> >> Tom > > The main thing (and possibly the only thing) that I need from GDI+ is to > read and write PNG files. > >> >> "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message >> news:W7mdncFCK47CsRHWnZ2dnUVZ_v-dnZ2d(a)giganews.com... >>> All of the links that I have found say they are showing you how to use >>> GDI+ from C++, by they actually show you how to use GDI+ from C, not >>> C++. For example they show you how to modify the WinMain() function. >>> There is no WinMain() function in my MFC code. >>> >>> I want to be able to load and save PNG files and BMP files. Since >>> Windows now does this, I would prefer to use Windows instead of any >>> third party library. >>> > >
From: Peter Olcott on 3 Mar 2010 09:33 "Tom Serface" <tom(a)camaswood.com> wrote in message news:e9SFSItuKHA.4492(a)TK2MSFTNGP05.phx.gbl... > In that case CImage would work great for you. It can > read, convert, and save any of the GDI+ types. I don't think that it can handle TIFF files, but that its OK. It is far less hassle than the GDI+ stuff. It only took me about an hour to fully implement as opposed to ten hours to halfway implement. The one thing that was holding me up with the GDI+ stuff was that to get an HBITMAP, I had to provide a background color. I can't see why it needs to know this. > > Tom > > "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message > news:crydnUAuO991QRDWnZ2dnUVZ_hqdnZ2d(a)giganews.com... >> >> "Tom Serface" <tom(a)camaswood.com> wrote in message >> news:Ols4NLouKHA.3896(a)TK2MSFTNGP02.phx.gbl... >>>I use GDI+ from C++ and it works just fine if you do, as >>>many have suggested, include the right libs. I also use >>>the CImage class: >>> >>> http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx >>> >>> that does a lot of the work for you. There are lots of >>> interesting articles on the web about this ATL class. I >>> find it very easy to use. It supports the same image >>> types as GDI+ as you'd expect. >>> >>> Tom >> >> The main thing (and possibly the only thing) that I need >> from GDI+ is to read and write PNG files. >> >>> >>> "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message >>> news:W7mdncFCK47CsRHWnZ2dnUVZ_v-dnZ2d(a)giganews.com... >>>> All of the links that I have found say they are showing >>>> you how to use GDI+ from C++, by they actually show you >>>> how to use GDI+ from C, not C++. For example they show >>>> you how to modify the WinMain() function. There is no >>>> WinMain() function in my MFC code. >>>> >>>> I want to be able to load and save PNG files and BMP >>>> files. Since Windows now does this, I would prefer to >>>> use Windows instead of any third party library. >>>> >> >>
From: Peter Olcott on 3 Mar 2010 09:50 "Tom Serface" <tom(a)camaswood.com> wrote in message news:eL%23ygLtuKHA.3408(a)TK2MSFTNGP06.phx.gbl... > Here's a tiny code snippet: > > CImage image; > image.Load(csMyGraphicFile); // Don't need to know type at > this point > HRESULT hr = > image.Save(csPNGPath,Gdiplus::ImageFormatPNG); > if(SUCCEEDED(hr)) // It worked > > Tom Ah that is how you test to see if it worked, good I will add this to my code. Also apparently it can infer the file save type from the filename suffix, thus the explicit type does not seem to be required. Since I am getting the filename suffix from a common dialogbox, I can count on it being correct. > > "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message > news:crydnUAuO991QRDWnZ2dnUVZ_hqdnZ2d(a)giganews.com... >> >> "Tom Serface" <tom(a)camaswood.com> wrote in message >> news:Ols4NLouKHA.3896(a)TK2MSFTNGP02.phx.gbl... >>>I use GDI+ from C++ and it works just fine if you do, as >>>many have suggested, include the right libs. I also use >>>the CImage class: >>> >>> http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx >>> >>> that does a lot of the work for you. There are lots of >>> interesting articles on the web about this ATL class. I >>> find it very easy to use. It supports the same image >>> types as GDI+ as you'd expect. >>> >>> Tom >> >> The main thing (and possibly the only thing) that I need >> from GDI+ is to read and write PNG files. >> >>> >>> "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message >>> news:W7mdncFCK47CsRHWnZ2dnUVZ_v-dnZ2d(a)giganews.com... >>>> All of the links that I have found say they are showing >>>> you how to use GDI+ from C++, by they actually show you >>>> how to use GDI+ from C, not C++. For example they show >>>> you how to modify the WinMain() function. There is no >>>> WinMain() function in my MFC code. >>>> >>>> I want to be able to load and save PNG files and BMP >>>> files. Since Windows now does this, I would prefer to >>>> use Windows instead of any third party library. >>>> >> >>
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: How to run MultiDigiMon.exe ? Next: Incorrect control background colors on CTabCtrl |