c# - How to save ink strokes along with background in a GIF in Windows 8? -


i have canvas transparent background. strokes drawn on it. while saving using saveasync method of inkmanager class, saves strokes not transparent background. there way can save background ?

else if there way can render inkmanager strokes on writablebitmap ?

this how saving.

storagefile ink_file = await m_localfolder.createfileasync(path, creationcollisionoption.replaceexisting);  using (var stream = await ink_file.openasync(windows.storage.fileaccessmode.readwrite)) {     using (var outputstream = stream.getoutputstreamat(0))     {         uint x = await i.saveasync(outputstream);         await outputstream.flushasync();     }  } 

the hard way:

well way in pure c# "load" rendered gif , background want use writablebitmaps memory. after have bitmap representations of both copy pixel data background bitmap's pixelbuffer byte[], you'll use composite strokes on top of. use pixelbuffer of gif image step through discarding pixels transparent combining ones aren't onto byte[] started off plain background image, careful dimensions here have little math figure out byte corresponds color channel on pixel. rigorous not difficult.

the easy way:

luckily you, took bother of wrapping kind of byte[] manipulating stuff nice portable library people seem love, available here: http://writeablebitmapex.codeplex.com/

basically, library give access normal drawing , "bitblt-ing" (a.k.a. bit-block-transferring) functionality. should able "blt" transparent image on top of opaque 1 composite in few lines code. no mess, no loops... hope helps -ck


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -