国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開(kāi)通VIP
在 WPF 應(yīng)用程序中進(jìn)行像素對(duì)齊


在 WPF 應(yīng)用程序中進(jìn)行像素對(duì)齊

.NET Framework 3.5
更新:2007 年 11 月

WPF 圖形系統(tǒng)使用與設(shè)備無(wú)關(guān)的單元來(lái)支持分辨率和設(shè)備無(wú)關(guān)性。每個(gè)與設(shè)備無(wú)關(guān)的像素都會(huì)隨系統(tǒng)上的每英寸點(diǎn)數(shù) (dpi) 設(shè)置自動(dòng)縮放。這支持 WPF 應(yīng)用程序可以根據(jù)不同的 dpi 設(shè)置進(jìn)行適當(dāng)?shù)目s放,并使應(yīng)用程序可以自動(dòng)識(shí)別 dpi。

但是,這種 dpi 無(wú)關(guān)性可能會(huì)因?yàn)橄忼X而呈現(xiàn)出不規(guī)則的邊緣。當(dāng)邊緣的位置處于設(shè)備像素內(nèi)而不是位于設(shè)備像素之間時(shí),可出現(xiàn)這些通常顯示為模糊邊緣或半透明的效果邊緣。為解決此問(wèn)題,WPF 提供了一種通過(guò)像素對(duì)齊將可視化樹(shù)中的對(duì)象邊緣與設(shè)備像素對(duì)齊或固定到設(shè)備像素的方法,從而消除了因消除鋸齒而產(chǎn)生的半透明邊緣。

像素對(duì)齊是一種通過(guò)對(duì)可見(jiàn)幾何圖形應(yīng)用較小的偏移量以將幾何圖形與設(shè)備像素對(duì)齊、從而消除視覺(jué)偽影效果的方法。

本主題包括下列各節(jié)。

<Page x:Class="PixelSnapping.Images"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    Title="Images"    >  <StackPanel>    <!-- Image has a pixel dimension of 144x96. -->    <!-- Because the image has a even width and height,          an even border width and height allows the image to proper center.     -->    <Border HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" Height="100">      <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="sharpness.png" Stretch="None"/>    </Border>    <!-- Image has a pixel dimension of 144x96. -->    <!-- Because the image has a even width and height,          an odd border width and height causes the image to soften.     -->    <Border HorizontalAlignment="Left" VerticalAlignment="Top" Width="201" Height="101">      <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="sharpness.png" Stretch="None"/>    </Border>  </StackPanel>  <!-- Grid Background -->  <Page.Background>    <DrawingBrush  Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">      <DrawingBrush.Drawing>        <DrawingGroup>          <GeometryDrawing Brush="White">            <GeometryDrawing.Geometry>              <RectangleGeometry Rect="0,0,1,1" />            </GeometryDrawing.Geometry>          </GeometryDrawing>          <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z " Brush="#CCCCFF" />          <GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="#CCCCFF" />        </DrawingGroup>      </DrawingBrush.Drawing>    </DrawingBrush>  </Page.Background></Page>

遺憾的是,僅調(diào)整容器對(duì)象的大小并不能保證設(shè)備像素的對(duì)齊。應(yīng)用程序的整個(gè)布局可以對(duì)圖像的對(duì)齊產(chǎn)生影響。顯示每英寸點(diǎn)數(shù) (dpi) 也會(huì)影響圖像的對(duì)齊。在以上示例中,僅在將顯示設(shè)置為 96 每英寸點(diǎn)數(shù) (dpi) 時(shí),圖像對(duì)齊才起作用。在其他設(shè)置中,需要調(diào)整布局以適應(yīng)顯示設(shè)置。在 Windows Presentation Foundation (WPF) 應(yīng)用程序中,應(yīng)盡量避免高頻圖像。



本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
【技術(shù)】4K屏終于不“糊”,Windows10高DPI新特性嘗鮮!
WPF中的屏幕分辨率
40億像素相機(jī)驚人表現(xiàn)
工筆畫 貓
[疑難雜癥]如何消除BitmapEffect的遺留效果
外文書上的毛衣圖片
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服