Click here to Skip to main content
15,900,258 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Advice? Pin
Cyrilix6-Jun-07 6:34
Cyrilix6-Jun-07 6:34 
GeneralRe: Advice? Pin
Frogboy1816-Jun-07 7:00
Frogboy1816-Jun-07 7:00 
GeneralRe: Advice? Pin
Christian Graus6-Jun-07 10:50
protectorChristian Graus6-Jun-07 10:50 
GeneralRe: Advice? Pin
Frogboy1816-Jun-07 11:03
Frogboy1816-Jun-07 11:03 
GeneralRe: Advice? Pin
Christian Graus6-Jun-07 12:03
protectorChristian Graus6-Jun-07 12:03 
GeneralRe: Advice? Pin
Mark Salsbery6-Jun-07 13:13
Mark Salsbery6-Jun-07 13:13 
QuestionImage Resizing Methods(Image Processing) Pin
Software_Specialist5-Jun-07 3:58
Software_Specialist5-Jun-07 3:58 
AnswerRe: Image Resizing Methods(Image Processing) [modified] Pin
Mark Salsbery5-Jun-07 6:50
Mark Salsbery5-Jun-07 6:50 
// A simple method
 
#using <System.Drawing.dll>
 
using namespace System;
using namespace System::Drawing;
using namespace System::Drawing::Drawing2D;
using namespace System::Drawing::Imaging;
 
...
 
Bitmap ^pSrcBitmap = gcnew Bitmap("C:\\test.bmp");
 
// resize image dimensions to twice the original sizes
Int32 DestImageWidth = pSrcBitmap->Width * 2;
Int32 DestImageHeight = pSrcBitmap->Height * 2;
 
Bitmap ^pDestBitmap = gcnew Bitmap(DestImageWidth, DestImageHeight, pSrcBitmap->PixelFormat);
 
Graphics ^pDestGraphics = Graphics::FromImage(pDestBitmap);
pDestGraphics->InterpolationMode = InterpolationMode::HighQualityBicubic;
pDestGraphics->CompositingMode = CompositingMode::SourceCopy;
 
pDestGraphics->DrawImage(pSrcBitmap, 0, 0, DestImageWidth, DestImageHeight);
 
pDestBitmap->Save("C:\\testresized.bmp");

// A more complex method
 
#using <System.Drawing.dll>
 
using namespace System;
using namespace System::Drawing;
using namespace System::Drawing::Drawing2D;
using namespace System::Drawing::Imaging;
 
...
 
Bitmap ^pSrcBitmap = gcnew Bitmap("C:\\test.bmp");
 
// resize image dimensions to twice the original sizes
Int32 DestImageWidth = pSrcBitmap->Width * 2;
Int32 DestImageHeight = pSrcBitmap->Height * 2;
 
Bitmap ^pDestBitmap = gcnew Bitmap(DestImageWidth, DestImageHeight, pSrcBitmap->PixelFormat);
 
BitmapData ^pSrcBitmapData = pSrcBitmap->LockBits(Rectangle(0,0,pSrcBitmap->Width,pSrcBitmap->Height), 
                                            ImageLockMode::ReadOnly, pSrcBitmap->PixelFormat);
BitmapData ^pDestBitmapData = pDestBitmap->LockBits(Rectangle(0,0,DestImageWidth,DestImageHeight), 
                                            ImageLockMode::WriteOnly, pSrcBitmap->PixelFormat);
 
<code>//pSrcBitmapData and pDestBitmapData have all the information you need to directly manipulate
//  the pixel data (bits pointer, width, height, stride)
//Use any method you want to resize the image data from the source to the destination bitmap</code>...
 
pSrcBitmap->UnlockBits(pSrcBitmapData);
pDestBitmap->UnlockBits(pDestBitmapData);
 
pDestBitmap->Save("C:\\testresized.bmp");







-- modified at 12:56 Tuesday 5th June, 2007

"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

GeneralRe: Image Resizing Methods(Image Processing) Pin
Software_Specialist5-Jun-07 22:14
Software_Specialist5-Jun-07 22:14 
GeneralRe: Image Resizing Methods(Image Processing) Pin
Mark Salsbery6-Jun-07 5:07
Mark Salsbery6-Jun-07 5:07 
GeneralRe: Image Resizing Methods(Image Processing) Pin
Christian Graus6-Jun-07 10:52
protectorChristian Graus6-Jun-07 10:52 
GeneralRe: Image Resizing Methods(Image Processing) Pin
Mark Salsbery6-Jun-07 13:00
Mark Salsbery6-Jun-07 13:00 
GeneralRe: Image Resizing Methods(Image Processing) Pin
Software_Specialist6-Jun-07 20:56
Software_Specialist6-Jun-07 20:56 
GeneralRe: Image Resizing Methods(Image Processing) Pin
Mark Salsbery7-Jun-07 4:34
Mark Salsbery7-Jun-07 4:34 
AnswerRe: Image Resizing Methods(Image Processing) Pin
Christian Graus6-Jun-07 10:53
protectorChristian Graus6-Jun-07 10:53 
GeneralRe: Image Resizing Methods(Image Processing) Pin
Software_Specialist7-Jun-07 12:05
Software_Specialist7-Jun-07 12:05 
QuestionHow to copy data from one listbox to another? vc++ 2005 Pin
sync_austin5-Jun-07 1:59
sync_austin5-Jun-07 1:59 
AnswerRe: How to copy data from one listbox to another? vc++ 2005 Pin
Christian Graus5-Jun-07 2:46
protectorChristian Graus5-Jun-07 2:46 
QuestionI need help in c++ search in a text file Pin
non light1-Jun-07 23:22
non light1-Jun-07 23:22 
AnswerRe: I need help in c++ search in a text file Pin
Christian Graus2-Jun-07 13:10
protectorChristian Graus2-Jun-07 13:10 
QuestionERROR in reload operator Pin
Chen-XuNuo1-Jun-07 21:59
Chen-XuNuo1-Jun-07 21:59 
AnswerRe: ERROR in reload operator Pin
Christian Graus2-Jun-07 13:14
protectorChristian Graus2-Jun-07 13:14 
GeneralRe: ERROR in reload operator Pin
Chen-XuNuo3-Jun-07 18:54
Chen-XuNuo3-Jun-07 18:54 
GeneralRe: ERROR in reload operator Pin
Christian Graus4-Jun-07 11:18
protectorChristian Graus4-Jun-07 11:18 
QuestionGetProcesses in C++ Pin
gapfulgence1-Jun-07 11:04
gapfulgence1-Jun-07 11:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.