为了计算IMAGE中图形的坐标,需要知道图形的DPI,不知那位可给予指点???

解决方案 »

  1.   

    to  ehom(?!) :
    是吗?
    image.Picture.Bitmap.Height/Width是分辨率吗?分辨率好象应当是:
    image.Picture.Bitmap.Height和image.Picture.Bitmap.width,您是否是这个意思?
      

  2.   

    不嫌我烦的话插一句:
      图像分辨率的单位是ppi,dpi是用在打印机上的——打印机上一个dot并不等价于一个pixel。
    对图像使用dpi是毫无意义的。
      

  3.   

    只知道TBitmap的Resolution怎么取!
    首先要理解BITMAPINFOHEADER这个东东,看这个就知道是什么了
    typedef struct tagBITMAPINFO { 
      BITMAPINFOHEADER bmiHeader; 
      RGBQUAD          bmiColors[1]; 
    } BITMAPINFO, *PBITMAPINFO; 
    再看这个
    typedef struct tagBITMAPINFOHEADER{
      DWORD  biSize; 
      LONG   biWidth; 
      LONG   biHeight; 
      WORD   biPlanes; 
      WORD   biBitCount; 
      DWORD  biCompression; 
      DWORD  biSizeImage; 
      LONG   biXPelsPerMeter; 
      LONG   biYPelsPerMeter; 
      DWORD  biClrUsed; 
      DWORD  biClrImportant; 
    } BITMAPINFOHEADER, *PBITMAPINFOHEADER; 
    这里的biXPersPerMeter和biYPersPerMeter就是X、Y两轴的图像解析度!!
    如果想要读出这个值就要看看TBitmap的源码,看看Borland怎么读Bitmap头的,然后写个小函数就可以了......
      

  4.   

    图标的颜色经两次异或后,为什么不会返回到原先的色彩?<我要实现当鼠标移动到图标时,图标有所变化> ( 积分:100, 回复:1, 阅读:7 )procedure TfrmDeskTop.ReDrawDeskIcon(var Icon: TIcon);
    var
     Bitmap, Mask: TBitmap;
     x, y: integer;
     Color: Longint;
     R, G, B, Gr: byte;
     ImageList: TImageList;
    begin
     Bitmap := TBitmap.Create;
     Mask := TBitmap.Create; ImageList := TImageList.CreateSize(32, 32);
     ImageList.AddIcon(Icon);
     ImageList.GetBitmap(0, Bitmap);//以上三行实现Ico到Bitmap的转换 with Bitmap.Canvas do
     for x := Cliprect.Left to Cliprect.Right do
       for y := Cliprect.Top to Cliprect.Bottom do
       begin
         Color := ColorToRGB(Pixels[x, y]);
         B := (Color and $FF0000) shr 16;
         G := (Color and $FF00) shr 8;
         R := (Color and $FF);     B := B xor $FF;
         G := G xor $FF;
         R := R xor $FF;     Pixels[x, y] := (B shl 16 ) or ( G shl 8) or R;
       end;
     Mask.Assign(Bitmap);
     ImageList.Height := Bitmap.Height;
     ImageList.Width := Bitmap.Width;
     ImageList.Clear;
     ImageList.Add(Bitmap, Mask);
     ImageList.GetIcon(0, Icon);//以上实现Bitmap到Ico的转换 ImageList.Free;
     Bitmap.Free;
     Mask.Free;
    end;
    =====================
    调用这个过程后图标失真...........
    大伙教教我该如何改...................谢谢..
    ==============================================
    那个x,y的最大值就是像素了吧...大伙顺便看看问题如何解决?