mardi 24 février 2015

How to move a small image (or circle) over a large image wp8

I want that one small image (or a circle) move over a large image. And I want to get all the pixel of larger image which are overlapped by small image. Can anyone have any idea to do that.


Many Thanks in advance.



private void Canvas_MouseMove_1(object sender, System.Windows.Input.MouseEventArgs e)
{
wrt = new WriteableBitmap(imag, null);
try
{
System.Windows.Media.Color c = new System.Windows.Media.Color();
c.A = 0;
c.B = 0; c.R = 0; c.G = 0;
currentPoint = e.GetPosition(this.imag);

for (int degrees = 0; degrees <= 360; degrees++)
{
for (int distance = 0; distance <= erasersize; distance++)
{
//double angle = Math.PI * degrees / 180.0;
double x = currentPoint.X + (distance * Math.Cos(degrees));
double y = currentPoint.Y + (distance * Math.Sin(degrees));
wrt.SetPixel(Convert.ToInt32(x), Convert.ToInt32(y) - offset, c);
}
}

}
catch (Exception ex)
{

}
imag.Source = wrt;
App.Editedbmp = wrt;
//imagestack.Push(wrt);
//if (imagelist.Count == 20)
//{
// imagelist.RemoveAt(0);
//}
//else
//{
// imagelist.Add(wrt);
//}
}


Here I'm able to remove image background but the problem it removing very slow because of setpixel() is slow and there is no pointer which can tell what portion of image being removed


Aucun commentaire:

Enregistrer un commentaire