Silverlight 中的位图图像大小限制

发布于 2024-09-26 07:53:43 字数 233 浏览 7 评论 0原文

我正在制作一个 Windows Phone 7 应用程序,其中涉及从网络获取大图像并将其放入 ScrollViewer 中供用户滚动浏览。不过,我认为我遇到了 BitmapImage 的限制,因为图像似乎在高度或宽度上被截断为 2048 像素。

这是 Silverlight BitmapImage 的已知限制吗?在这种情况下是否可以使用其他类来允许滚动大图像?

谢谢

I'm making a Windows Phone 7 application which involves getting large images from the web and putting it in a ScrollViewer for the user to scroll through. I think I'm hitting a limitation of BitmapImage, though, as the image seems to get cut off at 2048 pixels in either height or width.

Is this a known limitation of Silverlight BitmapImage and is there some other class to use in this case to allow scrolling through the large images?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2024-10-03 07:53:43

是的,有 2k x 2k 的限制。这是限制,白皮书“为 Windows Phone 创建高性能 Silverlight 应用程序”http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=3a8636bf-185f-449a-a0ce-83502b9ec0ec

大小限制:自 Windows 以来
手机摄像头为 5 MP,屏幕
分辨率比其他的小
平台、图像的限制
可以处理 2k x 2k 像素。
任何比这更大的东西都会
自动采样较低
分辨率和图像会丢失
一些丰富性。处理图像
大于 2k x 2k 有
需要处理的场景
大于 2k x 2k 的图像,例如照片
编辑器或裁剪图像。在那些
场景,您可以处理图像
大于 2k x 2k 的
文件,然后显示一部分
适合 2K x 2K。您可以使用
WriteableBitmap 与的组合
加载Jpeg来完成它。 示例#5 –
加载大图像

XAML:

<StackPanel>
    <Image Height="3000" Width="3000" Name="image1" Stretch="Fill" />
    <Button Content="Load" Height="70" Width="152" Click="btnLoad_Click" />
</StackPanel>

代码隐藏:

private void btnLoad_Click(object sender, RoutedEventArgs e)
{
    StreamResourceInfo sri = null;
    Uri uri = new                                                                           Uri("LoadJpegSample;component/Test3k3k.JPG", UriKind.Relative);
    sri = Application.GetResourceStream(uri);

    WriteableBitmap wb = new WriteableBitmap((int)this.image1.Width, (int)this.image1.Height);

    Extensions.LoadJpeg(wb, sri.Stream);
    this.image1.Source = wb;
}

使用大于时要知道的事情
2k x 2k 图像:

  • 显示速度明显变慢
  • 请勿将其用于动画或平移场景。

如果没有可用的 JPEG 流,WriteableBitmapEx 的 Resize 方法也可以用于此任务。

Yes, there is a limit of 2k x 2k. This is limitation and a workaround are described in the white paper "Creating High Performing Silverlight Applications for Windows Phone" http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=3a8636bf-185f-449a-a0ce-83502b9ec0ec

Size Limitations: Since the Windows
Phone camera is 5 MP and the screen
resolution is smaller than on other
platforms, the limits for images that
can be processed are 2k x 2k pixels.
Anything larger than that will be
automatically sampled at a lower
resolution and the image will lose
some richness. Processing Images
Larger than 2k x 2k There are
scenarios where you need to process
images larger than 2k x 2k, e.g. Photo
editor, or cropping images. In those
scenarios, you can process the images
that are larger than 2k x 2k into a
file, and then display a portion that
fits into 2K x 2K. You can use the
combination of WriteableBitmap with
LoadJpeg to do it.   Example #5 –
LoadingLargeImages

XAML:

<StackPanel>
    <Image Height="3000" Width="3000" Name="image1" Stretch="Fill" />
    <Button Content="Load" Height="70" Width="152" Click="btnLoad_Click" />
</StackPanel>

Code Behind:

private void btnLoad_Click(object sender, RoutedEventArgs e)
{
    StreamResourceInfo sri = null;
    Uri uri = new                                                                           Uri("LoadJpegSample;component/Test3k3k.JPG", UriKind.Relative);
    sri = Application.GetResourceStream(uri);

    WriteableBitmap wb = new WriteableBitmap((int)this.image1.Width, (int)this.image1.Height);

    Extensions.LoadJpeg(wb, sri.Stream);
    this.image1.Source = wb;
}

Things to Know When Using Larger than
2k x 2k Images:

  • It is significantly slower to display
  • Do NOT use it for animation or panning scenarios.

The Resize method of the WriteableBitmapEx can also be used for this task if no JPEG stream is available.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文