<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: AnimateWindow и StretchBlt]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=13334&amp;type=atom" />
	<updated>2018-01-08T20:51:50Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=13334</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122884#p122884" />
			<content type="html"><![CDATA[<p>Так лучше иметь свежие, их всегда сохранить можно. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T20:51:50Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122884#p122884</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122883#p122883" />
			<content type="html"><![CDATA[<p>Так это от задачи зависит, зачем свежие данные, если спустя время нужно будет просмотреть прежний вид всего экрана.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T20:24:41Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122883#p122883</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122882#p122882" />
			<content type="html"><![CDATA[<p>Прежде всего скорость. И всё время свежие данные.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T20:21:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122882#p122882</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122877#p122877" />
			<content type="html"><![CDATA[<p>Так всё же что это даёт?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T18:37:33Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122877#p122877</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122862#p122862" />
			<content type="html"><![CDATA[<p>В моём варианте, если ты заметил, данные берутся непосредственно с DC экрана.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T13:34:11Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122862#p122862</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122861#p122861" />
			<content type="html"><![CDATA[<p>Так экран уже поменяется 100 раз.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T13:33:06Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122861#p122861</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122860#p122860" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Ну а если я захочу поставить на паузу, растянуть окно, и уменьшить зум, что я увижу?</p></blockquote></div><p>Думаю, это несколько избыточно, но решаемо. Просто сохранить последние координаты курсора, и при растягивании перерисовывать относительно этих координат по текущему размеру картинки.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T13:32:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122860#p122860</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122859#p122859" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Это не понял.</p></blockquote></div><p>Про WM_PAINT я отвечал.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T13:19:36Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122859#p122859</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122858#p122858" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Это не понял.</p></blockquote></div><p>Вертикальная синхронизация. Картинка разъежается по горизонтали, это в основном в классической теме, и не сильно заметно, но изредка режет глаз.<br /></p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А зачем это? Для перерисовки картинки нужен только её контент.</p></blockquote></div><p>Ну а если я захочу поставить на паузу, растянуть окно, и уменьшить зум, что я увижу?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T13:17:38Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122858#p122858</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122857#p122857" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Всё равно немного заметен вертикальный рассинхрон и WM_PAINT.</p></blockquote></div><p>Это не понял. </p><div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>И в моём случае this.hMDC это DC всего экрана</p></blockquote></div><p>А зачем это? Для перерисовки картинки нужен только её контент.</p><div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Ещё не понятно, что у тебя показывается у краёв экрана.</p></blockquote></div><p>Ну просто не учтена эта ситуация, думаю, вопрос на пару строк кода.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T13:13:06Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122857#p122857</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122856#p122856" />
			<content type="html"><![CDATA[<p>Ещё не понятно, что у тебя показывается у краёв экрана.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T13:03:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122856#p122856</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122855#p122855" />
			<content type="html"><![CDATA[<p>Всё равно немного заметен вертикальный рассинхрон и WM_PAINT в классической теме. И в моём случае this.hMDC это DC всего экрана, и WM_PAINT происходит медленне, плюс в цикле Draw уже неполучится каждый раз его сохранять.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T12:59:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122855#p122855</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122854#p122854" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#NoEnv
SetBatchLines, -1

Gui, +hwndhGui +AlwaysOnTop -DPIScale
Gui, Margin, 20, 20
Gui, Add, Pic, w351 h351 hwndhPic border
Gui, Show,, Zoom: 5
oZoom := new Zoom(hPic)
Return

GuiClose:
   oZoom := &quot;&quot;
   ExitApp
   
#If WinActive(&quot;ahk_id&quot; . hGui)
WheelUp:: 
WheelDown:: Gui, Show,, % &quot;Zoom: &quot; . oZoom.ChangeZoom(A_ThisHotkey = &quot;WheelUp&quot;)
#If

class Zoom  {
   __New(hPic)  {
      CoordMode, Mouse
      this.hParent := DllCall(&quot;GetParent&quot;, Ptr, hPic)
      WinGetPos,,, W, H, ahk_id %hPic%
      this.PicWidth := W, this.PicHeight := H
      this.CurrentZoom := 5
      this.hDC := DllCall(&quot;GetDC&quot;, Ptr, hPic, Ptr)
      this.hSDC := DllCall(&quot;GetDC&quot;, Ptr, 0, Ptr)
      this.oMDC := new this.CompatibleDC(this.hDC, W, H)
      this.hMDC := this.oMDC.hCDC
      
      this.timer := timer := ObjBindMethod(this, &quot;Draw&quot;)
      SetTimer, % timer, 10
      OnMessage( 0xF, ObjBindMethod(this, &quot;WM_PAINT&quot;) )
   }
   
   __Delete()  {
      timer := this.timer
      SetTimer, % timer, Delete
      this.oMDC := &quot;&quot;
      DllCall(&quot;DeleteDC&quot;, Ptr, this.hDC)
      DllCall(&quot;DeleteDC&quot;, Ptr, this.hSDC)
   }
      
   Draw()  {
      MouseGetPos, mouse_x, mouse_y
      w := this.PicWidth/this.CurrentZoom
      h := this.PicHeight/this.CurrentZoom
      DllCall(&quot;StretchBlt&quot;, Ptr, this.hDC, Int, 0, Int, 0, Int, this.PicWidth - 2, int, this.PicHeight - 2
                          , Ptr, this.hSDC, Int, mouse_x - w/2, Int, mouse_y - h/2, Int, w, Int, h, UInt, SRCCOPY := 0xCC0020)
      this.BitBlt(this.hMDC, this.hDC)
   }
   
   BitBlt(ddc, sdc)  {
      DllCall(&quot;BitBlt&quot;, Ptr, ddc, Int, 0, Int, 0, Int, this.PicWidth, Int, this.PicHeight
                      , Ptr, sdc, Int, 0, Int, 0, UInt, SRCCOPY := 0xCC0020)
   }
   
   ChangeZoom(mode)  {
      this.CurrentZoom += (mode ? 1 : -1)
      (this.CurrentZoom &lt; 1 &amp;&amp; this.CurrentZoom := 1)
      Return this.CurrentZoom
   }
   
   WM_PAINT(wp, lp, msg, hwnd)  {
      if (this.hParent = hwnd)  {
         timer := ObjBindMethod(this, &quot;BitBlt&quot;, this.hDC, this.hMDC)
         SetTimer, % timer, -10
      }
   }
   
   class CompatibleDC
   {
      __New(hDC, w, h)  {
         this.hCDC := DllCall(&quot;CreateCompatibleDC&quot;, Ptr, hDC, Ptr)
         this.hCBM := DllCall(&quot;CreateCompatibleBitmap&quot;, Ptr, hDC, Int, w, Int, h, Ptr)
         this.oBM := DllCall(&quot;SelectObject&quot;, Ptr, this.hCDC, Ptr, this.hCBM, Ptr)
      }
      
      __Delete()  {
         DllCall(&quot;SelectObject&quot;, Ptr, this.hCDC, Ptr, this.oBM, Ptr)
         DllCall(&quot;DeleteDC&quot;, Ptr, this.hCDC)
         DllCall(&quot;DeleteObject&quot;, Ptr, this.hCBM)
      }
   }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T12:40:53Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122854#p122854</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122853#p122853" />
			<content type="html"><![CDATA[<p>Ок, вечером.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-01-08T11:18:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122853#p122853</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AnimateWindow и StretchBlt]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=122852#p122852" />
			<content type="html"><![CDATA[<p>Ну тогда приведи свой код.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-08T11:18:23Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=122852#p122852</id>
		</entry>
</feed>
