What does this code do??

Discussion in 'iOS Programming' started by DimplePanchal, Aug 28, 2011.

  1. DimplePanchal macrumors newbie

    Joined:
    Jun 3, 2011
    Location:
    Ahmedabad
    #1
    Code:
    System::Drawing::Graphics^ grp = System::Drawing::Graphics::FromImage(bmpDest);
    			System::Drawing::Bitmap^ bmp = gcnew 
    				System::Drawing::Bitmap(Width, Height, grp);
    			System::Drawing::Imaging::BitmapData^ bmpData = bmp->LockBits(
    				System::Drawing::Rectangle(0, 0, Width, Height),
    				System::Drawing::Imaging::ImageLockMode::ReadWrite,
    				System::Drawing::Imaging::PixelFormat::Format24bppRgb);
    			System::Diagnostics::Debug::Assert(bmpData->Stride == ScanWidth);
    			memcpy((char*)(void*)bmpData->Scan0, Data, bmpData->Stride*bmpData->Height);
    			bmp->UnlockBits(bmpData);
    I am trying to convert this code in iphone. But I am having one confusion. Is this code creating entire image or is just replacing an array of pixels...???
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    In the C language, the memcpy function copies bytes from one memory space to another. The gcnew statement makes me suspect that a new buffer is being created for those copied bytes.

    You haven't posted much code, but I also suspect that bmpDest and Data are somehow related.

    I'm not familiar with the :: syntax. What language is this?
     
  3. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #3
    This is Microsoft C++ with managed extensions. The OP should probably ask in a .NET forum.
     

Share This Page