c# - Windows Phone generating Tile - cant seem to make it transparent -


i generating tile within application , when displayed background image using basis fro the tile has lost transparency (and therefore not picking theme color.

the background image has icon on , transparent - when use standard tile (i.e. not generate image ) thens fine , transparency good..

but when use background image , add own container on not transparent background showing black.

the relevant code follows:

    // [...]     var container = new grid();       if (iswide)     {              container = createcontainerwide(tileinfo);     }     else     {         container = createcontainermedium(tileinfo);     }      // add background     container.background = new imagebrush     {         imagesource = background,         opacity = opacity     };      // force container render     container.arrange(new rect(0, 0, width, height));      // write image disk , return filename     return writeshelltileuielementtodisk(container, basefilename); }  static string writeshelltileuielementtodisk(uielement element, string basefilename) {     var wb = new writeablebitmap(element, null);      // content must in sub-folder of isostore     string filename = sharedimagepath + basefilename + imageextension;     var stream = new isolatedstoragefilestream(filename, system.io.filemode.create, isf);      // write jpeg using standard tile size     // bitmap has (0,0) size , fails unknown reasons argument exception     if (wb.pixelheight > 0)         wb.savejpeg(stream, wb.pixelwidth, wb.pixelheight, 0, jpegquality);     else     {         debug.writeline("can't write out file because bitmap had 0,0 size; not sure why");         // indicate there issue         filename = null;     }      stream.close();      // return filename     return filename; } 

doesn't seem make difference set opacity of imagebrush to.

if used solid color rataher transparent layer fine. somehow creation of png losing transparency.

any ideas?

  • thanks

this answer might helpful. instead of saving jpg can save image png support transparency. the library mentioned in answer quite useful.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -