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


C# CairoContextEx.Scale方法代码示例

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


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

示例1: Draw

        public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            gr.Scale (area_width, area_height);

            gr.LineWidth = 0.01;
            gr.Color = new Cairo.Color (0, 0, 0, 1);

            gr.SetPangoLargeFontSize ();
            gr.DrawTextCentered (0.5, 0.1, ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Get ready to memorize the next objects..."));
            gr.Stroke ();

            gr.SetPangoFontSize (0.35);
            gr.DrawTextCentered (0.5, 0.5, countdown_time.ToString ());
            gr.Stroke ();

            gr.Arc (0.5, 0.5, 0.25, 0, 2 * Math.PI);
            gr.Stroke ();
            gr.Arc (0.5, 0.5, 0.28, 0, 2 * Math.PI);
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:20,代码来源:CountDownView.cs

示例2: Draw

        public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double y = 0.04, x = 0.05;
            const double space_small = 0.02;
            List <PlayerPersonalRecord> records;
            string s, tip, played;
            double width, height;

            gr.Scale (area_width, area_height);
            gr.Color = new Cairo.Color (0, 0, 0, 1);

            gr.MoveTo (x, y);
            gr.ShowPangoText (Translations.GetString ("Score"), false, -1, 0);
            DrawBand (gr, 0.03, y - 0.01);

            y += 0.08;
            gr.MoveTo (x, y);

            s = session.History.GetResult (Translations);

            // Translator: This will be part of the sentence "Games won: 10 (6 played)"
            played = String.Format (Translations.GetPluralString ("{0} played", "{0} played", session.History.GamesPlayed),
                session.History.GamesPlayed);

            if (s == string.Empty) {
                gr.ShowPangoText (String.Format (Translations.GetPluralString ("Games won: {0} ({1})",
                    "Games won: {0} ({1})", session.History.GamesWon), session.History.GamesWon, played));
            }
            else {
                gr.ShowPangoText (String.Format (Translations.GetPluralString ("{0}. Games won: {1} ({2})",
                    "{0}. Games won: {1} ({2})", session.History.GamesWon),	s, session.History.GamesWon, played));
            }

            y += 0.06;
            gr.MoveTo (x, y);
            gr.ShowPangoText (String.Format (Translations.GetString ("Time played {0} (average per game {1})"), session.GameTime, session.TimePerGame));

            y += 0.09;
            DrawColumnBarGraphic (gr, x, y);

            y += 0.36;
            gr.MoveTo (x, y);
            gr.SetPangoFontSize (smaller_font);
            // Translators: translated string should not be longer that the English original (space restriction on the UI)
            gr.ShowPangoText (Translations.GetString ("For details on how gbrainy's scoring works refer to the help."));

            y += 0.07;
            gr.SetPangoNormalFontSize ();
            records	= session.PlayerHistory.GetLastGameRecords ();
            gr.MoveTo (x, y);

            if (records.Count == 0) {
                bool caching = cached_sessionid != session.ID;

                gr.ShowPangoText (Translations.GetString ("Tips for your next games"), false, -1, 0);
                DrawBand (gr, 0.03, y - 0.01);

                y += 0.08;

                if (caching)
                    tips.Clear ();

                for (int i = 0; i < tips_shown; i++)
                {
                    if (caching)
                        tips.Add (game_tips.Tip);

                    tip = "- " + tips [i];

                    gr.MeasureString (tip, 1.0 - x, true, out width, out height);

                    if (y + height > 0.98)
                        break;

                    gr.DrawStringWithWrapping (x, y, tip , 1.0 - x);
                    y += height + space_small;
                }

                if (caching)
                    cached_sessionid = session.ID;
            }
            else  {
                gr.ShowPangoText (Translations.GetString ("Congratulations! New personal record"), false, -1, 0);
                DrawBand (gr, 0.03, y - 0.01);

                y += 0.08;

                for (int i = 0; i < records.Count; i++)
                {
                    switch (records[i].GameType) {
                    case GameTypes.LogicPuzzle:
                        s = String.Format (Translations.
                            GetString ("By scoring {0} in logic puzzle games you have established a new personal record. Your previous record was {1}."),
                            records[i].NewScore,
                            records[i].PreviousScore);
                        break;
                    case GameTypes.Calculation:
                        s = String.Format (Translations.
                            GetString ("By scoring {0} in calculation games you have established a new personal record. Your previous record was {1}."),
                            records[i].NewScore,
//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:gbrainy,代码行数:101,代码来源:FinishView.cs

示例3: OnDrawn

            protected override bool OnDrawn(Cairo.Context cc)
            {
                if(!IsRealized)
                    return false;

                int w, h, nw, nh;
                double x = 0, y = 0;

                CairoContextEx cr = new CairoContextEx (cc.Handle);
                cr.PangoFontDescription = PangoContext.FontDescription;
                w = Window.Width;
                h = Window.Height;

                nh = nw = Math.Min (w, h);

                if (nw < w) {
                    x = (w - nw) / 2d;
                }

                if (nh < h) {
                    y = (h - nh) / 2d;
                }

                cr.Translate (x, y);
                cr.Scale (nw, nh);

                view.Draw (cr, nw, nh, Direction == Gtk.TextDirection.Rtl);

                ((IDisposable)cr).Dispose();
                   			return true;
            }
开发者ID:GNOME,项目名称:gbrainy,代码行数:31,代码来源:PlayerHistoryDialog.cs

示例4: DrawPreview

 public override void DrawPreview(CairoContextEx gr, int width, int height, bool rtl)
 {
     gr.Scale (width, height);
     gr.Color = new Cairo.Color (0, 0, 0);
     gr.LineWidth = LineWidth;
     DrawObjectToMemorize (gr, width, height, rtl);
 }
开发者ID:GNOME,项目名称:gbrainy,代码行数:7,代码来源:Memory.cs

示例5: OnExposeEvent

            protected override bool OnExposeEvent(Gdk.EventExpose args)
            {
                if(!IsRealized)
                    return false;

                int w, h, nw, nh;
                double x = 0, y = 0;

                Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
                CairoContextEx cr = new CairoContextEx (cc.Handle, this);
                args.Window.GetSize (out w, out h);

                nh = nw = Math.Min (w, h);

                if (nw < w) {
                    x = (w - nw) / 2d;
                }

                if (nh < h) {
                    y = (h - nh) / 2d;
                }

                cr.Translate (x, y);
                cr.Scale (nw, nh);

                view.Draw (cr, nw, nh, Direction == Gtk.TextDirection.Rtl);

                ((IDisposable)cc).Dispose();
                ((IDisposable)cr).Dispose();
                   			return base.OnExposeEvent(args);
            }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:31,代码来源:PlayerHistoryDialog.cs

示例6: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            if (!IsRealized)
                return false;

            int w, h, total_w, total_h;

            Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
            CairoContextEx cr = new CairoContextEx (cc.Handle, this);

            args.Window.GetSize (out total_w, out total_h);

            h = total_h - question_high;
            if (UseSolutionArea)
                h -= solution_high;

            w = total_w;

            // We want a square drawing area for the puzzles then the figures are shown as designed.
            // For example, squares are squares. This also makes sure that proportions are kept when resizing
            DrawingSquare = Math.Min (w, h);

            if (DrawingSquare < w)
                OffsetX = (w - DrawingSquare) / 2d;
            else
                OffsetX = 0;

            if (DrawingSquare < h)
                OffsetY = (h - DrawingSquare) / 2d;
            else
                OffsetY = 0;

            OffsetY += question_high;

            // Draw a background taking all the window area
            cr.Save ();
            cr.Scale (total_w, total_h);
            cr.DrawBackground ();

            if (Paused == false) {
                DrawQuestionAndAnswer (cr, total_h);
            } else {
                cr.SetPangoFontSize (0.08);
                cr.DrawTextCentered (0.5, 0.5, Catalog.GetString ("Paused"));
                cr.Stroke ();
            }
            cr.Restore ();

            if (Paused == false) {
                // Draw the game area
                cr.Translate (OffsetX, OffsetY);
                cr.SetPangoNormalFontSize ();
                cr.Color = new Color (1, 1, 1, 0.5);
                Drawable.Draw (cr, DrawingSquare, DrawingSquare, Direction == Gtk.TextDirection.Rtl);
                cr.Stroke ();
            }

            ((IDisposable)cc).Dispose();
            ((IDisposable)cr).Dispose();
            return true;
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:61,代码来源:GameDrawingArea.cs

示例7: Draw

        public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double y = 0.03;

            gr.Scale (area_width, area_height);
            gr.LineWidth = 0.005;

            gr.Color = new Cairo.Color (0, 0, 0, 1);

            gr.MoveTo (0.05, y);
            // Translators: {0} is the version number of the program
            gr.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Welcome to gbrainy {0}"), Defines.VERSION), true, -1, 0);
            gr.Stroke ();

            gr.DrawStringWithWrapping (0.05, y + 0.07,
                ServiceLocator.Instance.GetService <ITranslations> ().GetString ("gbrainy is a brain teaser game and trainer to have fun and to keep your brain trained. It includes:"),
                1 - 0.05);

            y = 0.22 + space * 3;
            gr.DrawStringWithWrapping (0.05, y + 0.17,  ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Use the Settings to adjust the difficulty level of the game."),
                1 - 0.05);
            gr.Stroke ();

            foreach (Toolkit.Container container in containers)
                container.Draw (gr, area_width, area_height, rtl);
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:26,代码来源:WelcomeView.cs


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