当前位置: 首页>>代码示例>>C#>>正文


C# Pixbuf.ApplyEmbeddedOrientation方法代码示例

本文整理汇总了C#中Gdk.Pixbuf.ApplyEmbeddedOrientation方法的典型用法代码示例。如果您正苦于以下问题:C# Pixbuf.ApplyEmbeddedOrientation方法的具体用法?C# Pixbuf.ApplyEmbeddedOrientation怎么用?C# Pixbuf.ApplyEmbeddedOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdk.Pixbuf的用法示例。


在下文中一共展示了Pixbuf.ApplyEmbeddedOrientation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Import

        public void Import(string fileName)
        {
            Pixbuf bg;

            // Handle any EXIF orientation flags
            using (var fs = new FileStream (fileName, FileMode.Open, FileAccess.Read))
                bg = new Pixbuf (fs);

            bg = bg.ApplyEmbeddedOrientation ();

            Size imagesize = new Size (bg.Width, bg.Height);

            Document doc = PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize);
            doc.HasFile = true;
            doc.ImageSize = imagesize;
            doc.Workspace.CanvasSize = imagesize;

            Layer layer = doc.AddNewLayer (Path.GetFileName (fileName));

            using (Cairo.Context g = new Cairo.Context (layer.Surface)) {
                CairoHelper.SetSourcePixbuf (g, bg, 0, 0);
                g.Paint ();
            }

            bg.Dispose ();
        }
开发者ID:jobernolte,项目名称:Pinta,代码行数:26,代码来源:GdkPixbufFormat.cs

示例2: ImageCanvas

        public ImageCanvas(string fileName, List<BarierPoint> shapeListPoint)
        {
            this.fileName = fileName;
            if (shapeListPoint != null)
                this.shapeListPoint = shapeListPoint;
            else
                shapeListPoint = new List<BarierPoint>();

            if(MainClass.Settings.ImageEditors == null){
                MainClass.Settings.ImageEditors =  new Option.Settings.ImageEditorSetting();
                MainClass.Settings.ImageEditors.LineWidth = 3;
                MainClass.Settings.ImageEditors.PointWidth = 5;

                MainClass.Settings.ImageEditors.LineColor = new Option.Settings.BackgroundColors(10,10,255,32767);
                MainClass.Settings.ImageEditors.PointColor = new Option.Settings.BackgroundColors(10,10,255,32767);
                MainClass.Settings.ImageEditors.SelectPointColor = new Option.Settings.BackgroundColors(255,10,10,32767);
            }

            lineWitdth = MainClass.Settings.ImageEditors.LineWidth;
            pointWidth = MainClass.Settings.ImageEditors.PointWidth;

            Gdk.Color gdkLineColor = new Gdk.Color(MainClass.Settings.ImageEditors.LineColor.Red,
                MainClass.Settings.ImageEditors.LineColor.Green,MainClass.Settings.ImageEditors.LineColor.Blue);

            Gdk.Color gdkPointColor =  new Gdk.Color(MainClass.Settings.ImageEditors.PointColor.Red,
                MainClass.Settings.ImageEditors.PointColor.Green,MainClass.Settings.ImageEditors.PointColor.Blue);

            Gdk.Color gdkSelPointColor =  new Gdk.Color(MainClass.Settings.ImageEditors.SelectPointColor.Red,
                MainClass.Settings.ImageEditors.SelectPointColor.Green,MainClass.Settings.ImageEditors.SelectPointColor.Blue);

            colorLine = gdkLineColor.ToCairoColor(MainClass.Settings.ImageEditors.LineColor.Alpha);
            colorPoint = gdkPointColor.ToCairoColor(MainClass.Settings.ImageEditors.PointColor.Alpha);
            colorSelectPoint = gdkSelPointColor.ToCairoColor(MainClass.Settings.ImageEditors.SelectPointColor.Alpha);

            Gdk.Pixbuf bg;
            try{
                using (var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open))
                    bg = new Gdk.Pixbuf(fs);

                bg = bg.ApplyEmbeddedOrientation();
                this.HeightImage = bg.Height;
                this.WidthImage= bg.Width;

            }catch(Exception ex){
                Tool.Logger.Error(ex.Message,null);
            }
        }
开发者ID:moscrif,项目名称:ide,代码行数:47,代码来源:ImageCanvas.cs

示例3: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose e)
        {
            Gdk.Pixbuf bg;
            try{
                //if(fileName.ToLower().EndsWith (".svg")){
                    //bg = Rsvg.Pixbuf.FromFile(fileName);
                //	bg = Rsvg.Tool.PixbufFromFileAtSize(fileName,800,600);

                //} else{
                    using (var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open))
                        bg = new Gdk.Pixbuf(fs);
                //}

            }catch(Exception ex){
                Tool.Logger.Error(ex.Message,null);
                return true;
            }

            bg = bg.ApplyEmbeddedOrientation();
            this.HeightImage = bg.Height;
            this.WidthImage= bg.Width;
            if ( this.listPoint == null ){
                this.listPoint = new List<BarierPoint>();
                if( this.shapeListPoint != null ){
                    foreach(BarierPoint bp in this.shapeListPoint){
                        BarierPoint updateBp = new BarierPoint();
                        updateBp.X = bp.X +(1/HeightImage);
                        updateBp.Y = -bp.Y +(1/WidthImage);
                        listPoint.Add(updateBp);
                    }
                }
            }

            //Size imagesize = new Size (bg.Width, bg.Height);

            width = (int)(bg.Width * scaling);
            height = (int)(bg.Height * scaling);

            int x, y, w, h, d = 0;
            this.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);

            drawOffsetX = (w - width) / 2;
            if (drawOffsetX < 0)
                drawOffsetX = 0;

            drawOffsetY = (h - height) / 2;
            if (drawOffsetY < 0)
                drawOffsetY = 0;

            using (Context cr = Gdk.CairoHelper.Create(e.Window)) {
                if(!MainClass.Platform.IsMac){
                    FillChecks (cr, 0, 0,w,h);//w, h);
                    cr.Save ();

                    cr.DrawRectangle(new Cairo.Rectangle(drawOffsetX - 1, drawOffsetY - 1, width + 1, height + 1), new Cairo.Color(0, 0, 0), 1);
                    cr.Rectangle(new Cairo.Rectangle(drawOffsetX - 1, drawOffsetY - 1, width, height));
                    cr.Clip();
                }

                cr.Scale(scaling, scaling);

                CairoHelper.SetSourcePixbuf(cr, bg, drawOffsetX / scaling, drawOffsetY / scaling);

                cr.Paint();

                this.WidthRequest = width + 1;
                this.HeightRequest = height + 1;

                if (showBarierLayer) {
                    Draw(cr, width, height);
                }
                cr.Scale(scaling, scaling);
            }
            return true;
            /*using (Context cr = Gdk.CairoHelper.Create (e.Window)) {
                int w, h;
                e.Window.GetSize (out w, out h);
                Draw (cr, w, h);
            }
            return true;*/
        }
开发者ID:moscrif,项目名称:ide,代码行数:81,代码来源:ImageCanvas.cs


注:本文中的Gdk.Pixbuf.ApplyEmbeddedOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。