Delphi Can
FireMonkey Resimlerde Pan ve Zoom İşlemleri - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Eğitim (https://www.delphican.com/forumdisplay.php?fid=19)
+---- Forum: Makale (https://www.delphican.com/forumdisplay.php?fid=20)
+---- Konu Başlığı: FireMonkey Resimlerde Pan ve Zoom İşlemleri (/showthread.php?tid=532)

Sayfalar: 1 2


Cvp: FireMonkey Resimlerde Pan ve Zoom İşlemleri - Fesih ARSLAN - 19-03-2018

(15-03-2018, Saat: 23:04)pro_imaj Adlı Kullanıcıdan Alıntı: Merhaba;

Bu konuda 10.2.3 versiyonun bir gelişme yok mu yoksa yine Fesih bey'in belirttiği şekilde mi yapılıyor hala. Kurup deneyen var mı acaba.

İyi çalışmalar.

Merhaba,
Tahminimce o kısım (pan, zoom vb. interaktif etkileşimler) biz geliştiricilere bırakılmış. 
TGestureManager, Pan veya Zoom ile sınırlı olmayıp bir çok kullanıcı etkileşimi içerdiğinden ve TFMXObject sınıfı tarafından ortak kullanılan bir özellik olduğundan TImage için özelleştirilmiş değildir. 
İstediğiniz özellikler Quark Cube tarafından Image bileşenine entegre edilmiş hali açık kaynak kod olarak paylaşılmaktadır.





Kaynak: FMX Image Layout


Cvp: FireMonkey Resimlerde Pan ve Zoom İşlemleri - pro_imaj - 16-04-2018

Merhaba;

Fesih bey'in örneğine göre birkaç işlem eksik şekilde aşağıdaki şekilde uygulanabilir.


Image nesnesinin Zoom işlemleri için;

1- Forma bir adet Image nesnesi yerleştirin.
2- Image nesnesine herhangi bir resim ekleyin.
4- Object Inspector'dan Formun Touch>InteractiveGestures özelliğinin Zoom özelliğini True yapın.
5- Projenin aşağıdaki aşağıdaki tanımlamaları yapın;

var
  FLastDistance: Integer;
  PinchZoom: TForm1;

procedure TForm1.FormGesture(Sender: TObject;
  const EventInfo: TGestureEventInfo; var Handled: Boolean);
var
  LObj: IControl;
  LImage: TImage;
  LImageCenter: TPointF;
begin
  if EventInfo.GestureID = igiZoom then
  begin
    LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location));
    if LObj is TImage then
    begin
      if (not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) and
        (not(TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then
      begin
        { zoom the image }
        LImage := TImage(LObj.GetObject);
        LImageCenter := LImage.Position.Point + PointF(LImage.Width / 2,
          LImage.Height / 2);
        LImage.Width := LImage.Width + (EventInfo.Distance - FLastDistance);
        LImage.Height := LImage.Height + (EventInfo.Distance - FLastDistance);
        LImage.Position.X := LImageCenter.X - LImage.Width / 2;
        LImage.Position.Y := LImageCenter.Y - LImage.Height / 2;
      end;
      FLastDistance := EventInfo.Distance;
    end;
  end;
end;

İşlem tamamdır.

Kaynak : Object Pascal\Mobile Snippets\InteractiveGestures\ImageZoom


FireMonkey Resimlerde Pan ve Zoom İşlemleri - engerex - 24-09-2019

(10-01-2017, Saat: 15:59)Fesih ARSLAN Adlı Kullanıcıdan Alıntı: Merhaba;
Bildiğiniz gibi Image nesnesinin doğal Pan ve Zoom özelliği henüz yok. (İlerleyen sürümlerde olur İnşallah) Her iki özelliği kullanabilmek için aşağıdaki işlem adımlarını takip ederek projenize entegre edebilirsiniz.

Image nesnesinin Pan ve Zoom işlemleri için;

1- Forma bir adet GestureManager ve bir Image nesnesi yerleştirin.
2- Image nesnesine herhangi bir resim ekleyin.
3- Object Inspector'dan Formun Touch>GestureManager özelliğinde GestureManager1'i seçin.
4- Object Inspector'dan Formun Touch>InteractiveGestures özelliğinin Zoom ve Pan özelliğini True yapın.
5- projenin private bölümünde aşağıdaki tanımlamaları yapın;

 private
   FEnSonKonum: TPointF;
   FEnSonMesafe: Integer;

6- Formun OnGesture olayında aşağıdaki kodları yazın.

var
 LObj: IControl;
 LImage: TImage;
 LImageMerkez: TPointF;
begin
 //Zoom için
 if EventInfo.GestureID = igiZoom then
 begin
   LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location));
   if LObj is TImage then
   begin
     if (not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) and
       (not(TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then
     begin
       LImage := TImage(LObj.GetObject);
       LImageMerkez := LImage.Position.Point + PointF(LImage.Width / 2,
         LImage.Height / 2);
       LImage.Width := LImage.Width + (EventInfo.Distance - FEnSonMesafe);
       LImage.Height := LImage.Height + (EventInfo.Distance - FEnSonMesafe);
       LImage.Position.X := LImageMerkez.X - LImage.Width / 2;
       LImage.Position.Y := LImageMerkez.Y - LImage.Height / 2;
     end;
     FEnSonMesafe := EventInfo.Distance;
   end;
 end;

 //Pan için
 if EventInfo.GestureID = igiPan then
 begin
   LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location));
  if LObj is TImage then
   begin
     if not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags) then
     begin
       LImage := TImage(LObj.GetObject);
       LImage.Position.X := LImage.Position.X + (EventInfo.Location.X - FEnSonKonum.X);
       LImage.Position.Y := LImage.Position.Y + (EventInfo.Location.Y - FEnSonKonum.Y);
     end;
       FEnSonKonum  := EventInfo.Location;
   end;
 end;

end;


İyi çalışmalar
 


image.png