예제 #1
0
        public CtrSwizzle(SwizzlePreparationContext context, CtrTransformation transform = CtrTransformation.None)
        {
            _transform = transform;

            var stride = _transform == CtrTransformation.None || _transform == CtrTransformation.YFlip ? context.Size.Width : context.Size.Height;

            _swizzle = new MasterSwizzle(stride, new Point(0, 0), new[] { (1, 0), (0, 1), (2, 0), (0, 2), (4, 0), (0, 4) });
예제 #2
0
        /// <summary>
        /// Creates a new instance of <see cref="CTRSwizzle"/>.
        /// </summary>
        /// <param name="width">The width of the image to swizzle.</param>
        /// <param name="height">The height of the image to swizzle.</param>
        /// <param name="transform">The transformation mode for this swizzle.</param>
        /// <param name="toPowerOfTwo">Should the dimensions be padded to a power of 2.</param>
        public CTRSwizzle(int width, int height, CtrTransformation transform, bool toPowerOfTwo)
        {
            Width  = (toPowerOfTwo) ? 2 << (int)Math.Log(width - 1, 2) : width;
            Height = (toPowerOfTwo) ? 2 << (int)Math.Log(height - 1, 2) : height;

            _transform = transform;
            var stride = transform == CtrTransformation.None || transform == CtrTransformation.YFlip ? Width : Height;

            _swizzle = new MasterSwizzle(stride, new Point(0, 0), new[] { (1, 0), (0, 1), (2, 0), (0, 2), (4, 0), (0, 4) });