{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/Win2D/issues/125","labels_url":"https://api.github.com/repos/Microsoft/Win2D/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/Win2D/issues/125/comments","events_url":"https://api.github.com/repos/Microsoft/Win2D/issues/125/events","html_url":"https://github.com/Microsoft/Win2D/issues/125","id":99234729,"number":125,"title":"Text Transformation causes \"unsmooth\" rendering.","user":{"login":"SebastianStehle","id":1236435,"avatar_url":"https://avatars.githubusercontent.com/u/1236435?v=3","gravatar_id":"","url":"https://api.github.com/users/SebastianStehle","html_url":"https://github.com/SebastianStehle","followers_url":"https://api.github.com/users/SebastianStehle/followers","following_url":"https://api.github.com/users/SebastianStehle/following{/other_user}","gists_url":"https://api.github.com/users/SebastianStehle/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastianStehle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastianStehle/subscriptions","organizations_url":"https://api.github.com/users/SebastianStehle/orgs","repos_url":"https://api.github.com/users/SebastianStehle/repos","events_url":"https://api.github.com/users/SebastianStehle/events{/privacy}","received_events_url":"https://api.github.com/users/SebastianStehle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-05T15:41:49Z","updated_at":"2015-08-06T08:47:42Z","closed_at":null,"body":"Hello together,\r\n\r\nI render a canvas behind a ScrollViewer to support scrolling and zooming (I know that this is a strange solution, but all important interfaces are internal or sealed).\r\n\r\n\tprivate void CanvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)\r\n\t{\r\n\t\tfloat zoom = scrollViewer.ZoomFactor;\r\n\t\t\r\n\t\tfloat inverseZoom = 1f / scrollViewer.ZoomFactor;\r\n\r\n\t\tfloat scaledContentW = Document.Size.X * scrollViewer.ZoomFactor;\r\n\t\tfloat scaledContentH = Document.Size.Y * scrollViewer.ZoomFactor;\r\n\r\n\t\tfloat translateX;\r\n\t\tfloat translateY;\r\n\r\n\t\tif (scaledContentW < scrollViewer.ViewportWidth)\r\n\t\t{\r\n\t\t\ttranslateX = ((float)scrollViewer.ViewportWidth * inverseZoom - Document.Size.X) * 0.5f;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ttranslateX = -inverseZoom * (float)scrollViewer.HorizontalOffset;\r\n\t\t}\r\n\r\n\t\tif (scaledContentH < scrollViewer.ViewportHeight)\r\n\t\t{\r\n\t\t\ttranslateY = ((float)scrollViewer.ViewportHeight * inverseZoom - Document.Size.Y) * 0.5f;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ttranslateY = -inverseZoom * (float)scrollViewer.VerticalOffset;\r\n\t\t}\r\n\r\n\t\tfloat visibleX = inverseZoom * (float)scrollViewer.HorizontalOffset;\r\n\t\tfloat visibleY = inverseZoom * (float)scrollViewer.VerticalOffset; ;\r\n\r\n\t\tfloat visibleW = Math.Min(Document.Size.X, inverseZoom * (float)scrollViewer.ViewportWidth);\r\n\t\tfloat visibleH = Math.Min(Document.Size.Y, inverseZoom * (float)scrollViewer.ViewportHeight);\r\n\r\n\t\tRect2 visibleRect = new Rect2(visibleX, visibleY, visibleW, visibleH);\r\n\r\n\t\ttransform =\r\n\t\t\tMatrix3x2.CreateTranslation(\r\n\t\t\t\ttranslateX,\r\n\t\t\t\ttranslateY) *\r\n\t\t\tMatrix3x2.CreateScale(zoom);\r\n\t\t\t\r\n\t\t// Render with Transform\r\n\t}\r\n\r\nThis works fine but the text is jumping around by 1 or 2 pixels. I thought this might happen because of clear type, but even when I change the textaliasing to grayscale it doesnt help.\r\n\r\nI render the text in the vertical and horizontal center of a rect. I also tried to position it manually to ensure that I dont get any subpixels but it doesnt help.\r\n\r\nAny ideas?\r\n\r\nEDIT: I just noticed that sometimes the whole canvas content jumps around 10 pixels or so when zooming, very strange."},"comment":{"url":"https://api.github.com/repos/Microsoft/Win2D/issues/comments/128294203","html_url":"https://github.com/Microsoft/Win2D/issues/125#issuecomment-128294203","issue_url":"https://api.github.com/repos/Microsoft/Win2D/issues/125","id":128294203,"user":{"login":"SebastianStehle","id":1236435,"avatar_url":"https://avatars.githubusercontent.com/u/1236435?v=3","gravatar_id":"","url":"https://api.github.com/users/SebastianStehle","html_url":"https://github.com/SebastianStehle","followers_url":"https://api.github.com/users/SebastianStehle/followers","following_url":"https://api.github.com/users/SebastianStehle/following{/other_user}","gists_url":"https://api.github.com/users/SebastianStehle/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastianStehle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastianStehle/subscriptions","organizations_url":"https://api.github.com/users/SebastianStehle/orgs","repos_url":"https://api.github.com/users/SebastianStehle/repos","events_url":"https://api.github.com/users/SebastianStehle/events{/privacy}","received_events_url":"https://api.github.com/users/SebastianStehle/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T08:47:42Z","updated_at":"2015-08-06T08:47:42Z","body":"I created a sample application. I recognized that XAML has the same problem with texts, but when zooming very fast you will see the synchronization problems."}}