public XLIMOrienter(int width, int height, XLIMOrientation orientation) { Width = (uint)nlpo2(gcm(width, 8)); Height = (uint)nlpo2(gcm(height, 8)); uint stride = orientation == XLIMOrientation.None ? Width : Height; PanelsPerWidth = (uint)gcm((int)stride, 8) / 8; _orientation = orientation; }
public XLIMOrienter(int width, int height, XLIMOrientation orientation) { Width = (uint)NextLargestPow2(GreatestCommonMultiple(width, 8)); Height = (uint)NextLargestPow2(GreatestCommonMultiple(height, 8)); uint stride = orientation == XLIMOrientation.None ? Width : Height; PanelsPerWidth = (uint)GreatestCommonMultiple((int)stride, 8) / 8; _orientation = orientation; }
public static byte[] MakePixelData(byte[] input, ref int w, ref int h, XLIMOrientation x = XLIMOrientation.None) { int width = w; w = XLIMUtil.nlpo2(w); h = XLIMUtil.nlpo2(h); if (!(Math.Min(w, h) < 32)) { w = h = Math.Max(w, h); // resize } byte[] pixels = new byte[w * h * 4]; var orienter = new XLIMOrienter(w, h, x); for (uint i = 0; i < pixels.Length / 4; i++) { var c = orienter.Get(i); var offset = (c.X * 4) + (c.Y * width); Array.Copy(input, offset, pixels, i * 4, 4); } return(pixels); }
public static bool HasFlagFast(this XLIMOrientation value, XLIMOrientation flag) { return((value & flag) != 0); }