图片如何移动一个像素,更改其MD5值 .net c# 移动一像素?整行或整列移动吧? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 嗯 随便反正移动一像素,更改他的MD5值~~ /// <summary> /// 平移图像 /// </summary> /// <param name="bm"></param> /// <param name="nOffset">平移的方向</param> /// <param name="nOffset">平移的偏移量</param> /// <param name="nOffset">平移的填充像素</param> private void Translate(Bitmap bm, Direction Direction, int nOffset, Color crFill) { switch (Direction) { case Direction.Left: { // 向左平移 nDeep 位 for (int idxCol = nOffset; idxCol < bm.Width; ++idxCol) { int idxColDst = idxCol - nOffset; for (int idxRow = 0; idxRow < bm.Height; ++idxRow) { Color crSrc = bm.GetPixel(idxCol, idxRow); bm.SetPixel(idxColDst, idxRow, crSrc); } } // 被移空的地方填充crFill设定的背景 FillRect(bm, new Point(bm.Width - nOffset, 0), new Point(bm.Width - 1, bm.Height - 1), crFill); } break; case Direction.Right: { // 向右平移 for (int idxCol = bm.Width - nOffset - 1; idxCol >= 0; --idxCol) { int idxColDst = idxCol + nOffset; for (int idxRow = 0; idxRow < bm.Height; ++idxRow) { Color crSrc = bm.GetPixel(idxCol, idxRow); bm.SetPixel(idxColDst, idxRow, crSrc); } } // 填充 FillRect(bm, new Point(0, 0), new Point(nOffset - 1, bm.Height - 1), crFill); } break; case Direction.Down: { // 向下平移 for (int idxRow = bm.Height - nOffset - 1; idxRow >= 0; --idxRow) { int idxRowDst = idxRow + nOffset; for (int idxCol = 0; idxCol < bm.Width; ++idxCol) { Color crSrc = bm.GetPixel(idxCol, idxRow); bm.SetPixel(idxCol, idxRowDst, crSrc); } } // 填充 FillRect(bm, new Point(0, 0), new Point(bm.Width - 1, nOffset - 1), crFill); } break; case Direction.Up: { // 向上平移 for (int idxRow = nOffset; idxRow < bm.Height; ++idxRow) { int idxRowDst = idxRow - nOffset; for (int idxCol = 0; idxCol < bm.Width; ++idxCol) { Color crSrc = bm.GetPixel(idxCol, idxRow); bm.SetPixel(idxCol, idxRowDst, crSrc); } } // 填充 FillRect(bm, new Point(0, bm.Height - nOffset), new Point(bm.Width - 1, bm.Height - 1), crFill); } break; } } /// <summary> /// 填充矩形 /// </summary> /// <param name="bm">要填充的图像</param> /// <param name="ptStart">填充开始位置</param> /// <param name="ptEnd">填充结束位置</param> /// <param name="ptEnd">填充的像素值</param> private void FillRect(Bitmap bm, Point ptStart, Point ptEnd, Color crFill) { for (int idxCol = ptStart.X; idxCol <= ptEnd.X; ++idxCol) { for (int idxRow = ptStart.Y; idxRow <= ptEnd.Y; ++idxRow) { bm.SetPixel(idxCol, idxRow, crFill); } } } 如何对DT 进行 时间范围查询 请问如何让多个消息响应同一个函数,谢谢。 我想在一个Label中输出两种颜色不同的字体 datagridview ??? 在程序中如何改變文件的屬,我要鎖定文件 弱弱的问一下EventLog类生成的log放在哪了?? ???为什么我的form都乱了阿 小问题 高分求介绍c#控件的电子书 如何将一组以逗号隔开的字符串组成一个数组呀!那为高手快帮帮我呀! 有这样子一个需求,该如何做呢? DEV控件中Treelist
/// <summary>
/// 平移图像
/// </summary>
/// <param name="bm"></param>
/// <param name="nOffset">平移的方向</param>
/// <param name="nOffset">平移的偏移量</param>
/// <param name="nOffset">平移的填充像素</param>
private void Translate(Bitmap bm, Direction Direction, int nOffset, Color crFill)
{
switch (Direction)
{
case Direction.Left:
{
// 向左平移 nDeep 位
for (int idxCol = nOffset; idxCol < bm.Width; ++idxCol)
{
int idxColDst = idxCol - nOffset; for (int idxRow = 0; idxRow < bm.Height; ++idxRow)
{
Color crSrc = bm.GetPixel(idxCol, idxRow);
bm.SetPixel(idxColDst, idxRow, crSrc);
}
}
// 被移空的地方填充crFill设定的背景
FillRect(bm,
new Point(bm.Width - nOffset, 0),
new Point(bm.Width - 1, bm.Height - 1),
crFill);
}
break; case Direction.Right:
{
// 向右平移
for (int idxCol = bm.Width - nOffset - 1; idxCol >= 0; --idxCol)
{
int idxColDst = idxCol + nOffset; for (int idxRow = 0; idxRow < bm.Height; ++idxRow)
{
Color crSrc = bm.GetPixel(idxCol, idxRow);
bm.SetPixel(idxColDst, idxRow, crSrc);
}
}
// 填充
FillRect(bm,
new Point(0, 0),
new Point(nOffset - 1, bm.Height - 1),
crFill);
}
break; case Direction.Down:
{
// 向下平移
for (int idxRow = bm.Height - nOffset - 1; idxRow >= 0; --idxRow)
{
int idxRowDst = idxRow + nOffset; for (int idxCol = 0; idxCol < bm.Width; ++idxCol)
{
Color crSrc = bm.GetPixel(idxCol, idxRow);
bm.SetPixel(idxCol, idxRowDst, crSrc);
}
}
// 填充
FillRect(bm,
new Point(0, 0),
new Point(bm.Width - 1, nOffset - 1),
crFill);
}
break; case Direction.Up:
{
// 向上平移
for (int idxRow = nOffset; idxRow < bm.Height; ++idxRow)
{
int idxRowDst = idxRow - nOffset; for (int idxCol = 0; idxCol < bm.Width; ++idxCol)
{
Color crSrc = bm.GetPixel(idxCol, idxRow);
bm.SetPixel(idxCol, idxRowDst, crSrc);
}
}
// 填充
FillRect(bm,
new Point(0, bm.Height - nOffset),
new Point(bm.Width - 1, bm.Height - 1),
crFill);
}
break; }
} /// <summary>
/// 填充矩形
/// </summary>
/// <param name="bm">要填充的图像</param>
/// <param name="ptStart">填充开始位置</param>
/// <param name="ptEnd">填充结束位置</param>
/// <param name="ptEnd">填充的像素值</param>
private void FillRect(Bitmap bm, Point ptStart, Point ptEnd, Color crFill)
{
for (int idxCol = ptStart.X; idxCol <= ptEnd.X; ++idxCol)
{
for (int idxRow = ptStart.Y; idxRow <= ptEnd.Y; ++idxRow)
{
bm.SetPixel(idxCol, idxRow, crFill);
}
}
}