Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
StandardImageHelper.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 namespace SiliconStudio.Paradox.Graphics
6 {
7  /// <summary>
8  /// This class is responsible to provide image loader for png, gif, bmp.
9  /// </summary>
10  partial class StandardImageHelper
11  {
12  static unsafe void CopyMemoryBGRA(IntPtr dest, IntPtr src, int sizeInBytesToCopy)
13  {
14  if (sizeInBytesToCopy % 4 != 0)
15  throw new ArgumentException("Should be a multiple of 4.", "sizeInBytesToCopy");
16 
17  var bufferSize = sizeInBytesToCopy / 4;
18  var srcPtr = (uint*)src;
19  var destPtr = (uint*)dest;
20  for (int i = 0; i < bufferSize; ++i)
21  {
22  var value = *srcPtr++;
23  // BGRA => RGBA
24  value = (value & 0xFF000000) | ((value & 0xFF0000) >> 16) | (value & 0x00FF00) | ((value & 0x0000FF) << 16);
25  *destPtr++ = value;
26  }
27  }
28  }
29 }
This class is responsible to provide image loader for png, gif, bmp.
char * dest
Definition: lz4.h:61