图像的格式是bmp 在photoshop里面看到 当鼠标移动时  有信息是  RGB,XY,等 想知道 在delphi里面如何获取X Y的像素信息 
因为要把图像放大 貌似放大的时候  像素点X Y是不变的 请教在delphi里面有没有什么方法实现: 
当鼠标移动到哪个点 点击 就能出现此点的像素点  XY 
谢谢~

解决方案 »

  1.   


    这个是看整图的像素,你可以参考一下。。unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      FileCtrl, StdCtrls, ExtCtrls, Buttons, XPMan;type
      TForm1 = class(TForm)
        DriveComboBox1: TDriveComboBox;
        FileListBox1: TFileListBox;
        DirectoryListBox1: TDirectoryListBox;
        FilterComboBox1: TFilterComboBox;
        Label1: TLabel;
        BitBtn1: TBitBtn;
        XPManifest1: TXPManifest;
        procedure FileListBox1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FileListBox1Click(Sender: TObject);
    var
      image1:TImage;
    begin
      image1:=TImage.Create(nil);
      try
        image1.AutoSize:=true;
        if FileListbox1.Items.Count<>0 then
        begin
          Image1.Picture.LoadFromFile(FileListBox1.FileName);
          Label1.Caption:='图片象素:['+IntToStr(Image1.Width)+'*'+IntToStr(Image1.Height)+']';
        end;
      finally
        image1.Free;
      end;
    end;end.
      

  2.   


    procedure TForm1.Timer1Timer(Sender: TObject);
    var
      P: TPoint;
      T: TColor;
      R, G, B : byte;
    begin
      GetCursorPos(P);
      P := ScreenToClient(P);
      T := Canvas.Pixels[p.X, P.Y];  R := getRvalue(T);
      G := getGvalue(T);
      B := getBvalue(T);
      Caption := Format('%d %d %d %16x', [R, G, b, T]);
    end;
      

  3.   

    如果要求点击后显示鼠标处的像素点的坐标,只要在图像的onmousedown中添加相关语句就可以了procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      showmessage(inttostr(x)+','+inttostr(y));
    end;如果要求图像放大后像素点不变化,就要求把坐标x,y由绝对坐标转换成相对坐标就可以了。转换方式,可以选择以图像缩放前后的大小比例来定
      

  4.   

    procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      //X,Y为鼠标坐标
      //Image1.Canvas.Pixels[x,y],这个为X,Y处的颜色
    end;