2013-07-04 22 views
2

我正在尝试为我的Windows Phone 8应用程序制作一些美味的活动磁贴操作。我选择使用Cycle Tile模板来制作一些非常漂亮的滑动图像,但存在一个问题:Microsoft似乎已经为所有图像添加了灰色半透明滤镜,以便底部的标题文本即使在白色的图像。如果开发人员打算使用WritableBitmap来制作Metro风格的拼贴画,这很烦人。白人出来,为类白色灰度和主题颜色是阴影比所有其他瓦片较暗:CycleTile在我的图片窗口电话上放一个阴影

WHY!?

(在视觉树中一个用户控件)代码:

const double TILE_H = 336; 
    const double TILE_W = 691; 
    Size TILE_SIZE = new Size(TILE_W, TILE_H); 
    const string FILEDIREC = "/Shared/ShellContent"; 

    LayoutRoot.Height = TILE_H; 
    LayoutRoot.Width = TILE_W; 
    LayoutRoot.Clip = new RectangleGeometry() { Rect = new Rect(new Point(), TILE_SIZE) }; 
    LayoutRoot.Background = new SolidColorBrush(
     ((Color)Application.Current.Resources["PhoneAccentColor"])); 

    TextBlock tb = new TextBlock(); 
    Canvas.SetLeft(tb, 200.0); 
    tb.Text = "Why is this text grey? + lots more text"; 
    tb.FontSize = 50; 
    tb.Width = 300; 
    tb.Foreground = new SolidColorBrush(Colors.White); 
    tb.TextWrapping = TextWrapping.Wrap; 
    LayoutRoot.Children.Add(tb); 

    var bmp = new WriteableBitmap((int)TILE_W, (int)TILE_H); 
    bmp.Render(LayoutRoot, null); 
    bmp.Invalidate(); 
    var isf = IsolatedStorageFile.GetUserStoreForApplication(); 
    var filename = FILEDIREC + "/tile.jpg"; 
    if (!isf.DirectoryExists(FILEDIREC)) 
    { 
     isf.CreateDirectory(FILEDIREC); 
    } 
    using (var stream = isf.OpenFile(filename, System.IO.FileMode.OpenOrCreate)) 
    { 
     bmp.SaveJpeg(stream, (int)TILE_W, (int)TILE_H, 0, 100); 

    } 
    imageURIs.Add(new Uri("isostore:" + filename, UriKind.Absolute)); 
    //similar process for other images used by CycleTileData 
    //these images then added to CycleTileData in the usual way 

任何帮助,解释,建议或变通办法得到degreying将不胜感激。谢谢。我试过在不同的瓷砖类型中使用图像,例如。翻转砖的正面没有问题。

+0

我还没有看到像这样产生自定义瓷砖的问题。您可以发布您用于生成拼贴的代码(即正在创建的位图)吗? –

+0

我有完全相同的问题....真的希望从某人回答:)。 – Niels

回答

1

我没有看到任何明显的代码问题,但我想尝试的是使用独立的存储资源管理器并下载文件并查看它的外观。

当生成自定义贴图时,您可能需要考虑生成PNG而不是JPG。其中一个好处是您可以生成透明图像(这意味着您的图块将始终具有正确的主题背景颜色),PNG也使用无损压缩方案,因此不会引入压缩工件。

看看this answer我在哪里描述如何在我的一个应用程序中生成拼贴。希望这对你有一些用处。