Beispiel #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) });
Beispiel #2
0
        public CTRSwizzle(int width, int height, Transformation transform = Transformation.None, bool toPowerOf2 = true)
        {
            Width  = (toPowerOf2) ? 2 << (int)Math.Log(width - 1, 2) : width;
            Height = (toPowerOf2) ? 2 << (int)Math.Log(height - 1, 2) : height;

            _transform = transform;
            //"transform == Transformation.None ? Width : Height" before; Based on some changes to G1T in Kuriimu1; may be subject to change later
            _zorder = new MasterSwizzle(transform == Transformation.None ? Width : Width, new Point(0, 0), new[] { (1, 0), (0, 1), (2, 0), (0, 2), (4, 0), (0, 4) });
Beispiel #3
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) });
Beispiel #4
0
        /// <summary>
        /// Creates a new instance of <see cref="LinearSwizzle"/>.
        /// </summary>
        /// <param name="widthStride"></param>
        /// <param name="heightStride"></param>
        public LinearSwizzle(int widthStride, int heightStride)
        {
            Width  = widthStride;
            Height = heightStride;

            var bitField = new List <(int, int)>();

            for (int i = 1; i < widthStride; i *= 2)
            {
                bitField.Add((i, 0));
            }
            for (int i = 1; i < heightStride; i *= 2)
            {
                bitField.Add((0, i));
            }
            Swizzle = new MasterSwizzle(widthStride, new Point(0, 0), bitField.ToArray());
        }
Beispiel #5
0
 public NitroSwizzle(SwizzlePreparationContext context)
 {
     _swizzle        = new MasterSwizzle(context.Size.Width, new Point(0, 0), new[] { (1, 0), (2, 0), (4, 0), (0, 1), (0, 2), (0, 4) });
Beispiel #6
0
        /// <summary>
        /// Creates a new instance of <see cref="NitroSwizzle"/>
        /// </summary>
        /// <param name="width">The width of the image to swizzle.</param>
        /// <param name="height">The height of the image to swizzle.</param>
        public NitroSwizzle(int width, int height)
        {
            Width  = width;
            Height = height;

            _swizzle = new MasterSwizzle(Width, new Point(0, 0), new[] { (1, 0), (2, 0), (4, 0), (0, 1), (0, 2), (0, 4) });
Beispiel #7
0
        /// <summary>
        /// Creates a new instance of <see cref="BCSwizzle"/>.
        /// </summary>
        /// <param name="width">The width of the image to swizzle.</param>
        /// <param name="height">The height of the image to swizzle.</param>
        public BCSwizzle(int width, int height)
        {
            Width  = (width + 3) & ~3;
            Height = (height + 3) & ~3;

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