91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-25
  • 語言: C#
  • 標簽: RGB565??

資源簡介

C# 獲取圖片某像素點RGB565值 ScreenShot:http://blog.csdn.net/mostone/article/details/12353683

資源截圖

代碼片段和文件信息

//?Image?Color?Picker
//?by?mostone@hotmail.com
//?http://blog.csdn.net/mostone
//?2013-10-06

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;

namespace?mostone
{
????public?partial?class?FormMain?:?Form
????{

????????Bitmap?bmpZoom?=?null;
????????Bitmap?bmpSrc?=?null;

????????public?FormMain()
????????{
????????????InitializeComponent();
????????}

????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????DialogResult?isDone?=?openFileDialog1.ShowDialog();
????????????????if?(isDone?==?DialogResult.OK)
????????????????{
????????????????????pictureBox1.Image?=?null;
????????????????????pictureBox2.Image?=?null;
????????????????????bmpSrc?=?null;
????????????????????bmpZoom?=?null;

????????????????????Image?img?=?Bitmap.FromFile(openFileDialog1.FileName);
????????????????????pictureBox1.Image?=?img;
????????????????????bmpSrc?=?new?Bitmap(img);
????????????????}
????????????}
????????????catch?(Exception?ex)
????????????{
????????????????pictureBox1.Image?=?null;
????????????????bmpSrc?=?null;
????????????????MessageBox.Show(ex.Message);
????????????}

????????}

????????private?void?pictureBox1_MouseClick(object?sender?MouseEventArgs?e)
????????{
????????????const?int?zoomSize?=?8;
????????????if?(this.bmpSrc?==?null)
????????????{
????????????????return;
????????????}

????????????bmpZoom?=?null;
????????????bmpZoom?=?new?Bitmap(pictureBox2.Width?pictureBox2.Height);
????????????Graphics?grpDst?=?Graphics.FromImage(bmpZoom);

????????????//?zoom?to?8x
????????????int?width?=?pictureBox2.Width?/?zoomSize;
????????????int?height?=?pictureBox2.Height?/?zoomSize;

????????????int?offsetX?=?width?/?2;
????????????int?offsetY?=?height?/?2;

????????????int?x?=?e.X?-?offsetX;
????????????int?y?=?e.Y?-?offsetY;
????????????if?(offsetX?+?e.X?>=?bmpSrc.Width)
????????????{
????????????????x?=?bmpSrc.Width?-?offsetX?*?2;
????????????}
????????????else?if?(x?????????????{
????????????????x?=?0;
????????????}

????????????if?(offsetY?+?e.Y?>=?bmpSrc.Height)
????????????{
????????????????y?=?bmpSrc.Height?-?offsetY?*?2;
????????????}
????????????else?if?(y?????????????{?
????????????????y?=?0;
????????????}

????????????Color?color;
????????????int?oriX?=?x;
????????????for?(int?row?=?0;?row?????????????{
????????????????if?(y?>=?bmpSrc.Height)?break;

????????????????for?(int?col?=?0;?col?????????????????{
????????????????????if?(x?>=?bmpSrc.Width)?break;

????????????????????//?get?pixel?color
????????????????????color?=?bmpSrc.GetPixel(x?y);
????????????????????//?draw?zoom?block
????????????????????grpDst.FillRectangle(new?SolidBrush(color)?col?row?zoomSize?zoom

評論

共有 條評論