Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Read a GFIE (Greenfish Icon Editor Pro) document and draws it to a image
- * Currently supports:
- * - Multiple Layers
- * - Layer Visibility
- * Currently doesn't supports:
- * - Pages
- * - Layer Opacity and Blend Mode
- *
- * Depedencies
- *
- * GFIEFormat class from Greenfish Image Converter
- */
- Bitmap gfieToImg(string file,int page){
- GfieDocument doc = new GfieDocument();
- doc.LoadAsGfie(file);
- GfieDocument.LayerCollection ls = doc.Pages[page].Layers;
- Bitmap bmp=new Bitmap(ls.Width,ls.Height);
- Graphics g=Graphics.FromImage(bmp);
- for(int i=(ls.Layers.Count-1);i>=0;i--){
- GfieDocument.Layer ly=ls.Layers[i];
- if(ly.Visible&&ly.Opacity>127){
- g.DrawImageUnscaled(ly.Image.Image,0,0);
- }
- }
- g.Flush();
- return bmp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement