windows phone 8 - How to crop an image to 9 pieces -
windows phone 8 - How to crop an image to 9 pieces -
i have image , 9 little images. crop image 9 pieces , show them on 9 little images. utilize windows phone 8. have me ?
thank you
sourcebitmap writeablebitmap
for example, lets have xaml (where bigimage image want crop)
class="lang-xaml prettyprint-override"><scrollviewer> <stackpanel> <image x:name="bigimage" source="/assets/alignmentgrid.png"></image> <image x:name="cropimage1"></image> </stackpanel> </scrollviewer>
then in code behind
class="lang-c# prettyprint-override">using system.windows.media.imaging; // using writeablebitmapex private void phoneapplicationpage_loaded(object sender, routedeventargs e) { // create writeablebitmap bigimage source writeablebitmap wb = new writeablebitmap((bitmapsource)this.bigimage.source); // calculate , crop writeablebitmap crop1 = wb.crop(0, 0, 100, 100); // set cropimage1 image image crop bigger 1 this.cropimage1.source = crop1; }
if want see great solution without using writeablebitmapex (basically gonna code own crop returns writeablebitmap) webpage you:
crop image implementation (it's easy program, need tad bit of algebra)
windows-phone-8
Comments
Post a Comment