Esempio n. 1
0
 public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
 {
     CDraw.DrawTexture(textureRef, bounds, aspect);
 }
Esempio n. 2
0
 public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color)
 {
     CDraw.DrawTexture(textureRef, bounds, aspect, color);
 }
Esempio n. 3
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color)
 {
     CDraw.DrawTexture(texture, rect, color);
 }
Esempio n. 4
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
 {
     CDraw.DrawTexture(texture, rect, color, bounds, mirrored);
 }
Esempio n. 5
0
 public void DrawRect(SColorF color, SRectF rect)
 {
     CDraw.DrawRect(color, rect);
 }
Esempio n. 6
0
        public static void LoadSkins()
        {
            for (int index = 0; index < _Skins.Count; index++)
            {
                bool           loaded    = false;
                XPathDocument  xPathDoc  = null;
                XPathNavigator navigator = null;

                try
                {
                    xPathDoc  = new XPathDocument(Path.Combine(_Skins[index].Path, _Skins[index].FileName));
                    navigator = xPathDoc.CreateNavigator();
                    loaded    = true;
                }
                catch (Exception e)
                {
                    CLog.LogError("Error loading skin " + _Skins[index].FileName + ": " + e.Message);
                    loaded = false;
                    if (navigator != null)
                    {
                        navigator = null;
                    }

                    if (xPathDoc != null)
                    {
                        xPathDoc = null;
                    }
                }

                if (loaded)
                {
                    string value = String.Empty;


                    // load skins/textures
                    List <string> keys = new List <string>(_Skins[index].SkinList.Keys);

                    foreach (string name in keys)
                    {
                        try
                        {
                            CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty);
                            SkinElement sk = _Skins[index].SkinList[name];
                            sk.Value      = value;
                            sk.VideoIndex = -1;
                            sk.Texture    = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value));
                            _Skins[index].SkinList[name] = sk;
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
                            CLog.LogError("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
                        }
                    }


                    // load videos
                    for (int i = 0; i < _Skins[index].VideoList.Count; i++)
                    {
                        try
                        {
                            CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty);
                            SkinElement sk = new SkinElement();
                            sk.Name       = _Skins[index].VideoList[i].Name;
                            sk.Value      = value;
                            sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[index].Path, sk.Value));
                            CVideo.VdSetLoop(sk.VideoIndex, true);
                            CVideo.VdPause(sk.VideoIndex);
                            sk.Texture = new STexture(-1);
                            _Skins[index].VideoList[i] = sk;
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
                            CLog.LogError("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
                        }
                    }

                    // load colors
                    LoadColors(navigator, index);
                }
            }
        }
Esempio n. 7
0
 public void UnloadTexture()
 {
     CDraw.RemoveTexture(ref Texture);
 }
Esempio n. 8
0
 public CTextureRef EnqueueTexture(string fileName)
 {
     return(CDraw.EnqueueTexture(fileName));
 }
Esempio n. 9
0
 public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight, bool allMonitors = true)
 {
     CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight, allMonitors);
 }
Esempio n. 10
0
 public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
 {
     CDraw.DrawRect(color, rect, allMonitors);
 }
Esempio n. 11
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false, bool allMonitors = true)
 {
     CDraw.DrawTexture(texture, rect, color, bounds, mirrored, allMonitors);
 }
Esempio n. 12
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool allMonitors = true)
 {
     CDraw.DrawTexture(texture, rect, color, false, allMonitors);
 }
Esempio n. 13
0
 public void UnloadSkin()
 {
     CDraw.RemoveTexture(ref _Cursor);
 }
Esempio n. 14
0
 public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight)
 {
     CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight);
 }
Esempio n. 15
0
        public CGlyph(char chr, float MaxHigh)
        {
            _SIZEh = MaxHigh;

            float           outline = CFonts.Outline;
            TextFormatFlags flags   = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;

            float factor = GetFactor(chr, flags);

            CFonts.Height = SIZEh * factor;
            Bitmap bmp = new Bitmap(10, 10);

            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);

            Font fo    = CFonts.GetFont();
            Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);

            SizeF size = g.MeasureString(chr.ToString(), fo);

            g.Dispose();
            bmp.Dispose();

            bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height);
            g   = System.Drawing.Graphics.FromImage(bmp);
            g.Clear(System.Drawing.Color.Transparent);

            g.SmoothingMode     = SmoothingMode.AntiAlias;
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            CFonts.Height       = SIZEh;
            fo = CFonts.GetFont();

            PointF point = new PointF(
                outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + SIZEh / 5f,
                (sizeB.Height - size.Height - (size.Height + SIZEh / 4f) * (1f - factor)) / 2f);

            GraphicsPath path = new GraphicsPath();

            path.AddString(
                chr.ToString(),
                fo.FontFamily,
                (int)fo.Style,
                SIZEh,
                point,
                new StringFormat());

            Pen pen = new Pen(
                Color.FromArgb(
                    (int)CFonts.OutlineColor.A * 255,
                    (int)CFonts.OutlineColor.R * 255,
                    (int)CFonts.OutlineColor.G * 255,
                    (int)CFonts.OutlineColor.B * 255),
                SIZEh * outline);

            pen.LineJoin = LineJoin.Round;
            g.DrawPath(pen, path);
            g.FillPath(Brushes.White, path);

            /*
             * g.DrawString(
             *  chr.ToString(),
             *  fo,
             *  Brushes.White,
             *  point);
             * */

            Texture = CDraw.AddTexture(bmp);
            //bmp.Save("test.png", ImageFormat.Png);
            Chr   = chr;
            width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width);

            bmp.Dispose();
            g.Dispose();
            fo.Dispose();
        }
Esempio n. 16
0
 public CTextureRef AddTexture(string fileName)
 {
     return(CDraw.AddTexture(fileName));
 }
Esempio n. 17
0
        /// <summary>
        /// Loads all cover which are defined in the cover config file.
        /// </summary>
        private static void LoadCover(string coverThemeName)
        {
            SCoverTheme coverTheme = new SCoverTheme();

            coverTheme = CoverTheme(coverThemeName);

            if (coverTheme.Name != String.Empty)
            {
                bool           loaded    = false;
                XPathDocument  xPathDoc  = null;
                XPathNavigator navigator = null;

                try
                {
                    xPathDoc  = new XPathDocument(Path.Combine(CSettings.sFolderCover, coverTheme.File));
                    navigator = xPathDoc.CreateNavigator();
                    loaded    = true;
                }
                catch (Exception)
                {
                    loaded = false;
                    if (navigator != null)
                    {
                        navigator = null;
                    }

                    if (xPathDoc != null)
                    {
                        xPathDoc = null;
                    }
                }

                if (loaded)
                {
                    lock (_MutexCover)
                    {
                        _Cover.Clear();
                        List <string> cover = CHelper.GetValuesFromXML("Cover", navigator);
                        for (int i = 0; i < cover.Count; i++)
                        {
                            SCover sk    = new SCover();
                            string name  = String.Empty;
                            string value = String.Empty;
                            CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Name", navigator, ref name, String.Empty);
                            CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Path", navigator, ref value, String.Empty);
                            sk.Name  = name;
                            sk.Value = Path.Combine(coverTheme.Folder, value);
                            if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value))))
                            {
                                sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value)));
                            }
                            else
                            {
                                sk.Texture = _NoCover;
                            }

                            _Cover.Add(sk);

                            if (sk.Name == "NoCover")
                            {
                                _NoCover = sk.Texture;
                            }
                        }
                    }
                }

                CHelper       Helper = new CHelper();
                List <string> files  = new List <string>();

                files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true));
                files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true));
                files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true));
                files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true));


                foreach (string file in files)
                {
                    string name = Path.GetFileNameWithoutExtension(file);

                    if (!CoverExists(name))
                    {
                        SCover sk = new SCover();

                        string value = String.Empty;

                        sk.Name  = name;
                        sk.Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file));

                        sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, sk.Value));

                        _Cover.Add(sk);
                    }
                }
            }
        }
Esempio n. 18
0
 public void RemoveTexture(ref CTextureRef texture)
 {
     CDraw.RemoveTexture(ref texture);
 }
Esempio n. 19
0
 public void DrawTexture(CTextureRef texture, SRectF rect)
 {
     CDraw.DrawTexture(texture, rect);
 }
Esempio n. 20
0
 public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
 {
     CDraw.DrawRectReflection(color, rect, space, height);
 }
Esempio n. 21
0
        private void _Add(int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
        {
            _CheckModifiers();
            x = (int)(x * (float)CSettings.RenderW * CConfig.Config.Graphics.NumScreens / CDraw.GetScreenWidth());
            while (x > CSettings.RenderW)
            {
                x -= CSettings.RenderW;
            }
            y = (int)(y * (float)CSettings.RenderH / CDraw.GetScreenHeight());

            var pool = new SMouseEvent(ESender.Mouse, _Mod, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh);

            lock (_CopyLock)
            {
                _EventsPool.Add(pool);
            }
        }