예제 #1
1
        //public:
        public Bullet(Double x_, Double y_, Int32 width_, Int32 height_, Int32 damage_, BulletKind kind_)
        {
            PosX = x_;
            PosY = y_;
            Width = width_;
            Height = height_;
            switch (kind_)
            {
                case BulletKind.Laser:
                    {
                        _type = BulletType.Laser;
                        break;
                    }
                case BulletKind.Exploded:
                    {
                        _type = BulletType.Exploded;
                        break;
                    }
                case BulletKind.Rocket:
                    {
                        _type = BulletType.Rocket;
                        break;
                    }
            }
            Damage = damage_+_type._bonusdamage;
            _active = true;

            _vx = 1; _vy = 0;
            _speed = _type.speed;
        }
        /// <summary>
        /// Rotate an image on a point with a specified angle
        /// </summary>
		/// <param name="pe">The paint area event where the image will be displayed</param>
		/// <param name="img">The image to display</param>
		/// <param name="alpha">The angle of rotation in radian</param>
		/// <param name="ptImg">The location of the left upper corner of the image to display in the paint area in nominal situation</param>
		/// <param name="ptRot">The location of the rotation point in the paint area</param>
		/// <param name="scaleFactor">Multiplication factor on the display image</param>
        protected void RotateImage(PaintEventArgs pe, Image img, Double alpha, Point ptImg, Point ptRot, float scaleFactor)
        {
            double beta = 0; 	// Angle between the Horizontal line and the line (Left upper corner - Rotation point)
            double d = 0;		// Distance between Left upper corner and Rotation point)		
            float deltaX = 0;	// X componant of the corrected translation
            float deltaY = 0;	// Y componant of the corrected translation

			// Compute the correction translation coeff
            if (ptImg != ptRot)
            {
				//
                if (ptRot.X != 0)
                {
                    beta = Math.Atan((double)ptRot.Y / (double)ptRot.X);
                }

                d = Math.Sqrt((ptRot.X * ptRot.X) + (ptRot.Y * ptRot.Y));

                // Computed offset
                deltaX = (float)(d * (Math.Cos(alpha - beta) - Math.Cos(alpha) * Math.Cos(alpha + beta) - Math.Sin(alpha) * Math.Sin(alpha + beta)));
                deltaY = (float)(d * (Math.Sin(beta - alpha) + Math.Sin(alpha) * Math.Cos(alpha + beta) - Math.Cos(alpha) * Math.Sin(alpha + beta)));
            }

            // Rotate image support
            pe.Graphics.RotateTransform((float)(alpha * 180 / Math.PI));

            // Dispay image
            pe.Graphics.DrawImage(img, (ptImg.X + deltaX) * scaleFactor, (ptImg.Y + deltaY) * scaleFactor, img.Width * scaleFactor, img.Height * scaleFactor);

            // Put image support as found
            pe.Graphics.RotateTransform((float)(-alpha * 180 / Math.PI));

        }
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF axial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="PosX">Position X</param>
        /// <param name="PosY">Position Y</param>
        /// <param name="Width">Width</param>
        /// <param name="Height">Height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfAxialShading(
			PdfDocument		Document,
			Double			PosX,
			Double			PosY,
			Double			Width,
			Double			Height,
			PdfShadingFunction	ShadingFunction
			)
            : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "2");

            // bounding box
            Dictionary.AddRectangle("/BBox", PosX, PosY, PosX + Width, PosY + Height);

            // assume the direction of color change is along x axis
            Dictionary.AddRectangle("/Coords", PosX, PosY, PosX + Width, PosY);

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);
            return;
        }
예제 #4
0
        /// <summary>
        ///     Gets the specified percentage of the number.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>Returns the specified percentage of the number</returns>
        public static Double PercentageOf( this Int64 number, Double percent )
        {
            if ( number <= 0 )
                throw new DivideByZeroException( "The number must be greater than zero." );

            return number * percent / 100;
        }
예제 #5
0
 public MapObject(MapObjectKind kind, Double x, Double y, Double r)
 {
     this.kind = kind;
     this.x = x;
     this.y = y;
     this.r = r;
 }
예제 #6
0
        // accept either a POINT(X Y) or a "X Y"
        public point(String ps)
        {
            if (ps.StartsWith(geomType, StringComparison.InvariantCultureIgnoreCase))
            {
                // remove point, and matching brackets
                ps = ps.Substring(geomType.Length);
                if (ps.StartsWith("("))
                {
                    ps = ps.Substring(1);
                }
                if (ps.EndsWith(")"))
                {
                    ps = ps.Remove(ps.Length - 1);
                }

            }
            ps = ps.Trim(); // trim leading and trailing spaces
            String[] coord = ps.Split(CoordSeparator.ToCharArray());
            if (coord.Length == 2)
            {
                X = Double.Parse(coord[0]);
                Y = Double.Parse(coord[1]);
            }
            else
            {
                throw new WaterOneFlowException("Could not create a point. Coordinates are separated by a space 'X Y'");
            }
        }
예제 #7
0
 public Request(Uri url, String director, ref DownloadHandler dlHandler, Double lastVersion)
 {
     this.url = url;
     this.director = director;
     this.dlHandler = dlHandler;
     this.lastVersion = lastVersion;
 }
예제 #8
0
 //
 //**********************************************************************************************
 //
 // Class TDerivedClass
 //   Part of  : TDRFree
 //   Function : Class definition of the derived property
 //   Author   : Jan G. Wesseling
 //   Date     : April 9th, 2013
 //
 //**********************************************************************************************
 //
 public TDerivedClass(Double aLow, Double aHigh, Int32 aR, Int32 aG, Int32 aB, String aName)
 {
     LowLimit = aLow;
       HighLimit = aHigh;
       TheColor = System.Drawing.Color.FromArgb(aR, aG, aB);
       TheName = aName;
 }
예제 #9
0
        public Etiqueta(String partnumber,String descricao,Int64 ean13,String lote,Int32 sequencia,Double quantidade,Tipo tipoEtiqueta)
        {
            switch (tipoEtiqueta )
            {
                case Tipo.QRCODE:

                    PartnumberEtiqueta = partnumber;
                    DescricaoProdutoEtiqueta = descricao;
                    Ean13Etiqueta = ean13;
                    LoteEtiqueta = lote;
                    SequenciaEtiqueta = sequencia;
                    QuantidadeEtiqueta = quantidade;
                    DataHoraValidacao = DateTime.Now;
                    TipoEtiqueta = Tipo.QRCODE;
                    break;

                case Tipo.BARRAS:

                    PartnumberEtiqueta = partnumber;
                    DescricaoProdutoEtiqueta = descricao;
                    Ean13Etiqueta = ean13;
                    LoteEtiqueta = lote;
                    SequenciaEtiqueta = 0;
                    QuantidadeEtiqueta = quantidade;
                    DataHoraValidacao = DateTime.Now;
                    TipoEtiqueta = Tipo.BARRAS;
                    break;

                default:
                    break;
            }
        }
예제 #10
0
        public DistanceGrid(IHasArea shape, Scalar spacing)
        {
            if (shape == null) { throw new ArgumentNullException("shape"); }
            if (spacing <= 0) { throw new ArgumentOutOfRangeException("spacing"); }
            Matrix2x3 ident = Matrix2x3.Identity;
            shape.CalcBoundingRectangle(ref ident, out this.rect);
            
            this.gridSpacing = spacing;
            this.gridSpacingInv = 1 / spacing;
            int xSize = (int)Math.Ceiling((rect.Max.X - rect.Min.X) * gridSpacingInv) + 2;
            int ySize = (int)Math.Ceiling((rect.Max.Y - rect.Min.Y) * gridSpacingInv) + 2;

            this.nodes = new Scalar[xSize][];
            for (int index = 0; index < xSize; ++index)
            {
                this.nodes[index] = new Scalar[ySize];
            }
            Vector2D point;
            point.X = rect.Min.X;
            for (int x = 0; x < xSize; ++x, point.X += gridSpacing)
            {
                point.Y = rect.Min.Y;
                for (int y = 0; y < ySize; ++y, point.Y += gridSpacing)
                {
                    shape.GetDistance(ref point, out nodes[x][y]);
                }
            }
        }
예제 #11
0
 internal ModerationBan(ModerationBanType Type, string Variable, string ReasonMessage, Double Expire)
 {
     this.Type = Type;
     this.Variable = Variable;
     this.ReasonMessage = ReasonMessage;
     this.Expire = Expire;
 }
예제 #12
0
        internal StimTrain(Int32 pulseWidth, Double amplitude, List<Int32> channels, List<Int32> interpulseIntervals)
        {
            //Interpulse intervals come in as us

            this.channel = new List<int>(channels.Count);
            for (int i = 0; i < channels.Count; ++i)
                this.channel.Add(channels[i]);

            width1 = new List<int>(channels.Count);
            width2 = new List<int>(channels.Count);
            interphaseLength = new List<int>(channels.Count);
            prePadding = new List<int>(channels.Count);
            postPadding = new List<int>(channels.Count);
            amp1 = new List<double>(channels.Count);
            amp2 = new List<double>(channels.Count);
            offsetVoltage = new List<double>(channels.Count);
            this.interpulseIntervals = new List<Int32>(interpulseIntervals.Count);

            for (int c = 0; c < channels.Count; ++c)
            {
                width1.Add(pulseWidth);
                width2.Add(pulseWidth);
                amp1.Add(amplitude);
                amp2.Add(-amplitude);

                offsetVoltage.Add(0.0); //Default to no offset voltage

                interphaseLength.Add(0);
                prePadding.Add(Convert.ToInt32((double)StimPulse.STIM_SAMPLING_FREQ * (double)100 / 1000000)); //Fix at 100 us
                postPadding.Add(Convert.ToInt32((double)StimPulse.STIM_SAMPLING_FREQ * (double)100 / 1000000)); //Fix at 100 us
            }
            for (int c = 0; c < interpulseIntervals.Count; ++c) //There'll be one less
                this.interpulseIntervals.Add(Convert.ToInt32((double)StimPulse.STIM_SAMPLING_FREQ * (double)interpulseIntervals[c] / 1000));
        }
예제 #13
0
파일: Polygon2D.cs 프로젝트: JOndarza/CAD
 public Polygon2D(int s, Point3d c, Double a)
 {
     this.Sides = s;
     this.Center = c;
     this.Apotema = a;
     CreateGeometry();
 }
예제 #14
0
 private void operator_click(object sender, EventArgs e)
 {
     Button b = (Button)sender;  //"convert" our object to the button
     operation = b.Text; //storing the operator user clicked
     value = Double.Parse(result.Text); // converting the value that is in our texfield into double and storing it
     operation_pressed = true;     
 }
예제 #15
0
파일: SupportTicket.cs 프로젝트: habb0/Bfly
        internal SupportTicket(UInt32 Id, int Score, int Type, UInt32 SenderId, UInt32 ReportedId, String Message, UInt32 RoomId, String RoomName, Double Timestamp, object senderName, object reportedName, object modName)
        {
            this.Id = Id;
            this.Score = Score;
            this.Type = Type;
            this.Status = TicketStatus.OPEN;
            this.SenderId = SenderId;
            this.ReportedId = ReportedId;
            this.ModeratorId = 0;
            this.Message = Message;
            this.RoomId = RoomId;
            this.RoomName = RoomName;
            this.Timestamp = Timestamp;

            if (senderName == DBNull.Value)
                this.SenderName = string.Empty;
            else
                this.SenderName = (string)senderName;

            if (reportedName == DBNull.Value)
                this.ReportedName = string.Empty;
            else
                this.ReportedName = (string)reportedName;

            if (modName == DBNull.Value)
                this.ModName = string.Empty;
            else
                this.ModName = (string)modName;
        }
예제 #16
0
        public static MassInfo FromPolygon(Vector2D[] vertexes, Scalar mass)
        {
            if (vertexes == null) { throw new ArgumentNullException("vertexes"); }
            if (vertexes.Length == 0) { throw new ArgumentOutOfRangeException("vertexes"); }

            if (vertexes.Length == 1) { return new MassInfo(mass, 0); }

            Scalar denom = 0.0f;
            Scalar numer = 0.0f;

            for (int j = vertexes.Length - 1, i = 0; i < vertexes.Length; j = i, i++)
            {
                Scalar a, b, c;
                Vector2D P0 = vertexes[j];
                Vector2D P1 = vertexes[i];
                Vector2D.Dot(ref P1, ref P1, out a);
                Vector2D.Dot(ref P1, ref P0, out b);
                Vector2D.Dot(ref P0, ref P0, out c);
                a += b + c;
                Vector2D.ZCross(ref P0, ref P1, out b);
                b = MathHelper.Abs(b);
                denom += (b * a);
                numer += b;
            }
            return new MassInfo(mass, (mass * denom) / (numer * 6));
        }
 public override Double Get(Double x, Double y, Double z)
 {
     return this.Source.Get(
         x * this.XScale.Get(x, y, z), 
         y * this.YScale.Get(x, y, z), 
         z * this.ZScale.Get(x, y, z));
 }
예제 #18
0
        //note that this only needs to filter the channels on this particular device
        public SALPA3(int length_sams,int asym_sams,int blank_sams,int ahead_sams, int forcepeg_sams, rawType railLow, rawType railHigh, int numElectrodes, int bufferLength, rawType[] thresh)
        {
            //MB defaults:
            this.length_sams = length_sams;   // 75;
            this.asym_sams = asym_sams;// 10;
            this.blank_sams = blank_sams;// 75;//HACK try 20
            this.ahead_sams = ahead_sams;// 5;
            //this.period_sams = period_sams;// 0;
            //this.delay_sams = 0;
            this.forcepeg_sams = forcepeg_sams;//10;

            this.thresh = thresh;
            this.numElectrodes = numElectrodes;
            this.railHigh = railHigh;
            this.railLow = railLow;
            this.numSamples = bufferLength;

            this.PRE = 2 * length_sams ;
            this.POST = 2 * length_sams + 1 + ahead_sams;
            fitters = new LocalFit[numElectrodes];
            for (int i = 0; i < numElectrodes; i++)
            {
                fitters[i] = new LocalFit(thresh[i], length_sams, blank_sams, ahead_sams, asym_sams, railHigh, railLow, bufferLength, forcepeg_sams);
            }
        }
예제 #19
0
 public LeastSquaresRuntime(Double[,] trainingSet, Double[,] trainingOutput, Double[,] testSet, int[] expected)
 {
     this.trainingSet = trainingSet;
     this.trainingOutput = trainingOutput;
     this.testSet = testSet;
     this.expected = expected;
 }
예제 #20
0
 public static Double GetBigEndian(Double value) {
     if (BitConverter.IsLittleEndian) {
         return swapByteOrder(value);
     } else {
         return value;
     }
 }
예제 #21
0
 public virtual void Draw(Double pPercent)
 {
     Node.Position = new Vector3(Methods.CubicStep(ox, odx, x, dx, pPercent), Methods.CubicStep(oy, ody, y, dy, pPercent), 0);
     Node.Orientation =
         Quaternion.FromAngleAxis(Methods.CubicStep(oa, oda, a, da, pPercent) * Constants.DegreesToRadians, Vector3.UnitZ) *
         Quaternion.FromEulerAnglesInDegrees(-16 * Methods.LinearStep(oda, da, pPercent), 0.0, 0.0);
 }
예제 #22
0
 public EltSyntax(CommonSyntax syntax)
     : base(syntax)
 {
     m_Name = syntax.getName();
     m_Descriptor = syntax.getDescriptor();
     m_Value = syntax.getValue();
 }
        //*************************************************************************
        //  Constructor: BrandesVertexCentralities()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="BrandesVertexCentralities" /> class.
        /// </summary>
        //*************************************************************************
        public BrandesVertexCentralities()
        {
            m_dBetweennessCentrality = 0;
            m_dClosenessCentrality = 0;

            AssertValid();
        }
예제 #24
0
        ///<summary>
        /// Creates a new instance of the Page Setup Form
        ///</summary>
        ///<param name="settings"></param>
        public PageSetupForm(PrinterSettings settings)
        {
            //This call is required by the Windows Form Designer.
            InitializeComponent();

            //Store the printer settings
            _printerSettings = settings;

            //Gets the list of available paper sizes
            ComboPaperSizes.SuspendLayout();
            PrinterSettings.PaperSizeCollection paperSizes = _printerSettings.PaperSizes;
            foreach (PaperSize ps in paperSizes)
                ComboPaperSizes.Items.Add(ps.PaperName);
            ComboPaperSizes.SelectedItem = settings.DefaultPageSettings.PaperSize.PaperName;
            if (ComboPaperSizes.SelectedIndex == -1) ComboPaperSizes.SelectedIndex = 1;
            ComboPaperSizes.ResumeLayout();

            //Gets the paper orientation
            if (_printerSettings.DefaultPageSettings.Landscape)
                _rdbLandscape.Checked = true;
            else
                _rdbPortrait.Checked = true;

            //Gets the margins
            _left = settings.DefaultPageSettings.Margins.Left / 100.0;
            txtBoxLeft.Text = String.Format("{0:0.00}", _left);
            _top = settings.DefaultPageSettings.Margins.Top / 100.0;
            txtBoxTop.Text = String.Format("{0:0.00}", _top);
            _bottom = settings.DefaultPageSettings.Margins.Bottom / 100.0;
            txtBoxBottom.Text = String.Format("{0:0.00}", _bottom);
            _right = settings.DefaultPageSettings.Margins.Right / 100.0;
            txtBoxRight.Text = String.Format("{0:0.00}", _right);
        }
예제 #25
0
파일: SIPrefixes.cs 프로젝트: razaraz/Pscx
        public static String ToString(Double value, SIUnit unit, String format, IFormatProvider formatProvider)
        {
            var unitStr = unit.Symbol;

            if (value != 0)
            {
                var scale = 0;
                var log10 = Math.Log10(value);

                if (log10 < 0)
                {
                    value = MakeLarger(value, unit, out scale);
                }
                else if (log10 > 0)
                {
                    value = MakeSmaller(value, unit, out scale);
                }

                if (scale != 0)
                {
                    unitStr = Prefixes[scale].Symbol + unit.Symbol;
                }
            }

            return String.Format(formatProvider, "{0} {1}", value, unitStr);
        }
예제 #26
0
 public Parcela(int numeroParcela, DateTime dataPagamento, Double valorPagamento, bool pago)
 {
     this._numeroParcela = numeroParcela;
     this._dataPagamento = dataPagamento;
     this._valorPago = valorPagamento;
     this._pago = pago;
 }
예제 #27
0
        public PropertyModel Statistics(PropertyModel property, Double[] original, Double[] predicted)
        {


            int length = (predicted.Length <= original.Length) ? predicted.Length : original.Length;

            double[] dist = new double[length];

            if (length == 0)
                return null;
            else
            {
                int count = 0;
                for (int i = 0; i < length; i++)
                {
                    dist[i] = Math.Abs(original[i] - predicted[i]);
                    if (dist[i] <= property.Threshold)
                        count++;
                    i++;
                }
                property.Minimum = dist.Min();
                property.Maximum = dist.Max();
                property.Average = dist.Sum() / length;
                property.Accuracy = (double)count * 100 / length;

                return property;

            }

        }
예제 #28
0
        public void Normalise() {
            number f = (number)(1.0f / Math.Sqrt(this.Dot(this)));

            x *= f;
            y *= f;
            z *= f;
        }
예제 #29
0
 public AnalogInputChannel(String name, String physicalChannel, AITerminalConfiguration terminalConfig, Double calibration)
 {
     this.name = name;
     this.physicalChannel = physicalChannel;
     this.terminalConfig = terminalConfig;
     this.calibration = calibration;
 }
예제 #30
0
 /// <summary>
 /// Constructor for public DoubleAnimationClockResource.
 /// This constructor accepts the base value and AnimationClock.
 /// Note that since there is no current requirement that we be able to set or replace either the
 /// base value or the AnimationClock, this is the only way to initialize an instance of
 /// DoubleAnimationClockResource.
 /// Also, we currently Assert that the resource is non-null, since without mutability
 /// such a resource isn't needed.
 /// We can easily extend this class if/when new requirements arise.
 /// </summary>
 /// <param name="baseValue"> Double - The base value. </param>
 /// <param name="animationClock"> AnimationClock - cannot be null. </param>
 public DoubleAnimationClockResource(
     Double baseValue,
     AnimationClock animationClock
     ): base( animationClock )
 {
     _baseValue = baseValue;
 }
예제 #31
0
        ///<summary>Выполняет нормализацию изображения.</summary>
        ///<param name="BMP">Изображение.</param>
        public static unsafe System.Drawing.Bitmap RestoreColors(System.Drawing.Bitmap BMP)
        {
            var Result   = new System.Drawing.Bitmap(BMP.Width, BMP.Height);
            var arrRed   = new System.UInt16[256];
            var arrGreen = new System.UInt16[256];
            var arrBlue  = new System.UInt16[256];
            var Width    = BMP.Width;
            var Height   = BMP.Height;
            var BD       = BMP.LockBits(new System.Drawing.Rectangle(0, 0, Width, Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            System.Threading.Tasks.Parallel.For(0, Height, (System.Int32 y) => {
                var Address = (System.Byte *)(BD.Scan0.ToInt32() + y * BD.Stride);
                for (System.Int32 x = 0; x < Width; x++)
                {
                    lock (arrBlue){
                        arrBlue[*Address] += 1;
                    }
                    Address += 1;
                    lock (arrGreen){
                        arrGreen[*Address] += 1;
                    }
                    Address += 1;
                    lock (arrRed){
                        arrRed[*Address] += 1;
                    }
                    Address += 1;
                }
            });
            System.Double q       = Width * Height * 0.01;
            System.UInt16 newMinR = 0;
            System.UInt16 newMaxR = 0;
            System.UInt16 newMinG = 0;
            System.UInt16 newMaxG = 0;
            System.UInt16 newMinB = 0;
            System.UInt16 newMaxB = 0;
            System.UInt64 s       = 0;
            for (System.Byte i = 0; i <= 255; i++)
            {
                s += arrRed[i];
                if (s >= q)
                {
                    newMinR = i;
                    break;
                }
            }
            s = 0;
            for (System.Byte i = 255; i >= 0; i--)
            {
                s += arrRed[i];
                if (s >= q)
                {
                    newMaxR = i;
                    break;
                }
            }
            s = 0;
            for (System.Byte i = 0; i <= 255; i++)
            {
                s += arrGreen[i];
                if (s >= q)
                {
                    newMinG = i;
                    break;
                }
            }
            s = 0;
            for (System.Byte i = 255; i >= 0; i--)
            {
                s += arrGreen[i];
                if (s >= q)
                {
                    newMaxG = i;
                    break;
                }
            }
            s = 0;
            for (System.Byte i = 0; i <= 255; i++)
            {
                s += arrBlue[i];
                if (s >= q)
                {
                    newMinB = i;
                    break;
                }
            }
            s = 0;
            for (System.Byte i = 255; i >= 0; i--)
            {
                s += arrBlue[i];
                if (s >= q)
                {
                    newMaxB = i;
                    break;
                }
            }
            var BW_BD = Result.LockBits(new System.Drawing.Rectangle(0, 0, Width, Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            System.Threading.Tasks.Parallel.For(0, Height, (System.Int32 y) => {
                System.Byte *BW_Address;
                System.Byte *In_Address;
                System.Int16 newR = 0;
                System.Int16 newG = 0;
                System.Int16 newB = 0;
                In_Address        = (System.Byte *)(BD.Scan0.ToInt32() + y * BD.Stride);
                BW_Address        = (System.Byte *)(BW_BD.Scan0.ToInt32() + y * BW_BD.Stride);
                for (System.Int32 x = 0; x < Width; x++)
                {
                    newB = System.Convert.ToInt16(System.Math.Round((System.Single)(*In_Address - newMinB) * 255.0f / (newMaxB - newMinB + 1)));
                    if (newB < 0)
                    {
                        newB = 0;
                    }
                    if (newB > 255)
                    {
                        newB = 255;
                    }
                    In_Address += 1;
                    newG        = System.Convert.ToInt16(System.Math.Round((System.Single)(*In_Address - newMinG) * 255.0f / (newMaxG - newMinG + 1)));
                    if (newG < 0)
                    {
                        newG = 0;
                    }
                    if (newG > 255)
                    {
                        newG = 255;
                    }
                    In_Address += 1;
                    newR        = System.Convert.ToInt16(System.Math.Round((System.Single)(*In_Address - newMinR) * 255.0f / (newMaxR - newMinR + 1)));
                    if (newR < 0)
                    {
                        newR = 0;
                    }
                    if (newR > 255)
                    {
                        newR = 255;
                    }
                    In_Address += 1;
                    *BW_Address = (System.Byte)newB;
                    BW_Address += 1;
                    *BW_Address = (System.Byte)newG;
                    BW_Address += 1;
                    *BW_Address = (System.Byte)newR;
                    BW_Address += 1;
                }
            });
            BMP.UnlockBits(BD);
            Result.UnlockBits(BW_BD);
            arrRed   = null;
            arrGreen = null;
            arrBlue  = null;
            System.GC.Collect();
            return(Result);
        }