Esempio n. 1
0
        public Spiht3DCoder(IntPtr image, int width, int height, int depth)
        {
            _coefficients = (short *)image.ToPointer();



            _quantization = (short *)Marshal.AllocHGlobal(width * height * depth * 2);

            for (int i = 0; i < width * height * depth; i++)
            {
                *(_quantization + i) = 0;
            }

            _imageSize = new SubbandSize {
                Width = width, Height = height, Depth = depth
            };

            _subbandSizes = SpihtHelpers.CalculateSubbands(width, height, depth);

            _threshold = SpihtHelpers.AbsoluteMax((short *)image.ToPointer(), width * height * depth);

            _lsp = new LinkedList <Spiht3DPixel>();
            _lip = new LinkedList <Spiht3DPixel>();
            _lis = new LinkedList <Spiht3DSet>();

            _thresholdModel = new ArithmeticModel(4096);
            _bitModel       = new ArithmeticModel(2, true);
        }
        void BtnCalculate_TouchUpInside(object sender, EventArgs e)
        {
            if (TxtNumber1.Text != "" && TxtNumber2.Text != "" && isFinishedTheAnimation)
            {
                //The values that are going to be processed by the object.
                double number1;
                double number2;


                if (double.TryParse(TxtNumber1.Text, out number1) && double.TryParse(TxtNumber2.Text, out number2))
                {
                    ArithmeticModel objArithmetic = new ArithmeticModel(number1, number2, GetOperationType());

                    LblResult.Text = objArithmetic.Result;
                }
                else
                {
                    ShowMessage("Error", "Error en los valores de entrada, verifíquelos.");
                }
            }
            else
            {
                ShowMessage("Error", "Llene todos los campos y/o espere a que la barra de operaciones esté quieta.");
            }
        }
        public MainViewModel()
        {
            NumberCommand      = new ActionCommand(DoNumberCommand, () => true);
            OperandCommand     = new ActionCommand(DoOperandCommand, () => true);
            CalculateCommand   = new ActionCommand(DoCalculateCommand, () => _currentOperand.IsEntered);
            ClearCommand       = new ActionCommand(DoClearCommand, () => true);
            MakeDecimalCommand = new ActionCommand(DoMakeDecimalCommand, () => !_currentOperand.IsDecimal);
            ChangeSignCommand  = new ActionCommand(DoChangeSignCommand, () => true);

            _calc     = new ArithmeticModel();
            _operand1 = new Operand();
            _operand2 = new Operand();

            DoClearCommand();
        }
Esempio n. 4
0
 private void Output(bool bit, ArithmeticModel model)
 {
     _coder.EncodeSymbol(model, bit ? 1 : 0);
 }