示例#1
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, bounds, false);
     }
 }
示例#2
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, rect, mirrored);
     }
 }
示例#3
0
 public void DrawTexture(STexture Texture, SRectF rect)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, Texture.color);
     }
 }
示例#4
0
        public STexture AddTexture(string TexturePath)
        {
            STexture texture = new STexture();

            if (System.IO.File.Exists(TexturePath))
            {
                bool found = false;
                foreach (STexture tex in _Textures)
                {
                    if (tex.TexturePath == TexturePath)
                    {
                        texture = tex;
                        found   = true;
                        break;
                    }
                }

                if (!found)
                {
                    Bitmap bmp = new Bitmap(TexturePath);
                    return(AddTexture(bmp));
                }
            }

            return(texture);
        }
示例#5
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         Bitmap ColoredBitmap = ColorizeBitmap(_Bitmaps[Texture.index], color);
         _g.DrawImage(ColoredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H));
         ColoredBitmap.Dispose();
     }
 }
示例#6
0
 public bool UpdateTexture(ref STexture Texture, ref byte[] Data)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         BitmapData bmp_data = _Bitmaps[Texture.index].LockBits(new Rectangle(0, 0, _Bitmaps[Texture.index].Width, _Bitmaps[Texture.index].Height),
                                                                ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
         Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
         _Bitmaps[Texture.index].UnlockBits(bmp_data);
     }
     return(true);
 }
示例#7
0
 public void CopyScreen(ref STexture Texture)
 {
     if ((Texture.index == 0) || (Texture.width != GetScreenWidth()) || (Texture.height != GetScreenHeight()))
     {
         RemoveTexture(ref Texture);
         Texture = CopyScreen();
     }
     else
     {
         _Bitmaps[Texture.index] = new Bitmap(_backbuffer);
     }
 }
 public override bool GetFrame(int StreamID, ref STexture Frame, float Time, ref float VideoTime)
 {
     if (_Initialized)
     {
         lock (MutexDecoder)
         {
             if (AlreadyAdded(StreamID))
             {
                 return _Decoder[GetStreamIndex(StreamID)].GetFrame(ref Frame, Time, ref VideoTime);
             }
         }
         
     }
     return false;
 }
示例#9
0
 public void RemoveTexture(ref STexture Texture)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0))
     {
         for (int i = 0; i < _Textures.Count; i++)
         {
             if (_Textures[i].index == Texture.index)
             {
                 _Bitmaps[Texture.index].Dispose();
                 _Textures.RemoveAt(i);
                 Texture.index = -1;
                 break;
             }
         }
     }
 }
示例#10
0
        public CStatic()
        {
            _Theme = new SThemeStatic();
            _ThemeLoaded = false;

            _Texture = new STexture(-1);
            Color = new SColorF();
            Rect = new SRectF();
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Selected = false;
            Alpha = 1f;
            Visible = true;
        }
示例#11
0
        public CStatic(CStatic s)
        {
            _Theme = new SThemeStatic();
            _ThemeLoaded = false;

            _Texture = s.Texture;
            Color = new SColorF(s.Color);
            Rect = new SRectF(s.Rect);
            Reflection = s.Reflection;
            ReflectionSpace = s.ReflectionHeight;
            ReflectionHeight = s.ReflectionSpace;

            Selected = s.Selected;
            Alpha = s.Alpha;
            Visible = s.Visible;
        }
示例#12
0
        public CStatic(STexture texture, SColorF color, SRectF rect)
        {
            _Theme = new SThemeStatic();
            _ThemeLoaded = false;

            _Texture = texture;
            Color = color;
            Rect = rect;
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Selected = false;
            Alpha = 1f;
            Visible = true;
        }
示例#13
0
        public override void Init()
        {
            base.Init();

            _Rect = _Theme.songMenuTileBoard.TileRect;
 
            _NumW = _Theme.songMenuTileBoard.numW;
            _NumH = _Theme.songMenuTileBoard.numH;
            _SpaceW = _Theme.songMenuTileBoard.spaceW;
            _SpaceH = _Theme.songMenuTileBoard.spaceH;

            _PendingTime = 100L;

            _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
            _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);

            _CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName);
            _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName);

            _Tiles = new List<CStatic>();
            for (int i = 0; i < _NumH; i++)
            {
                for (int j = 0; j < _NumW; j++)
                {
                    SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
                        _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
                    CStatic tile = new CStatic(_CoverTexture, Color, rect);
                    _Tiles.Add(tile);
                }
            }

            _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z);

            _PreviewSelected = -1;
            _Offset = 0;

            _CoverBig = _Theme.songMenuTileBoard.StaticCoverBig;
            _TextBG = _Theme.songMenuTileBoard.StaticTextBG;
            _DuetIcon = _Theme.songMenuTileBoard.StaticDuetIcon;
            _VideoIcon = _Theme.songMenuTileBoard.StaticVideoIcon;
            _MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon;
            _MedleyTagIcon = _Theme.songMenuTileBoard.StaticMedleyTagIcon;

            _Artist = _Theme.songMenuTileBoard.TextArtist;
            _Title = _Theme.songMenuTileBoard.TextTitle;
            _SongLength = _Theme.songMenuTileBoard.TextSongLength;
        }
示例#14
0
        public CStatic(string TextureSkinName, SColorF color, SRectF rect)
        {
            _Theme = new SThemeStatic();
            _Theme.TextureName = TextureSkinName;
            _ThemeLoaded = false;

            _Texture = new STexture(-1);
            Color = color;
            Rect = rect;
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Selected = false;
            Alpha = 1f;
            Visible = true;
        }
示例#15
0
        public CCursor(string textureName, SColorF color, float w, float h, float z)
        {
            _CursorFadingTimer = new Stopwatch();
            ShowCursor = true;
            _CursorTargetAlpha = 1f;
            _CursorStartAlpha = 0f;
            _CursorFadingTime = 0.5f;

            _CursorName = textureName;
            _Cursor = CDraw.AddTexture(CTheme.GetSkinFilePath(_CursorName));

            _Cursor.color = color;
            _Cursor.rect.W = w;
            _Cursor.rect.H = h;
            _Cursor.rect.Z = z;

            _Movetimer = new Stopwatch();
        }
示例#16
0
        public STexture CopyScreen()
        {
            STexture texture = new STexture(0);
            Bitmap   bmp     = new Bitmap(_backbuffer);

            _Bitmaps.Add(bmp);

            texture.index = _Bitmaps.Count - 1;

            texture.width  = bmp.Width;
            texture.height = bmp.Height;

            // Add to Texture List
            texture.color = new SColorF(1f, 1f, 1f, 1f);
            texture.rect  = new SRectF(0f, 0f, texture.width, texture.height, 0f);
            _Textures.Add(texture);

            return(texture);
        }
示例#17
0
        public STexture AddTexture(Bitmap bmp)
        {
            Bitmap bmp2 = new Bitmap(bmp);

            _Bitmaps.Add(bmp2);
            STexture texture = new STexture();

            texture.index = _Bitmaps.Count - 1;

            texture.width  = bmp.Width;
            texture.height = bmp.Height;

            // Add to Texture List
            texture.color       = new SColorF(1f, 1f, 1f, 1f);
            texture.rect        = new SRectF(0f, 0f, texture.width, texture.height, 0f);
            texture.TexturePath = String.Empty;

            _Textures.Add(texture);

            return(texture);
        }
示例#18
0
 public bool GetFrame(ref STexture Frame)
 {
     if ((_CurrentFrame != null) && (_Webcam != null))
     {
         lock (_CurrentFrame)
         {
             BitmapData bitmapdata = _CurrentFrame.LockBits(new Rectangle(0, 0, _CurrentFrame.Width, _CurrentFrame.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
             byte[] data = new byte[4 * _CurrentFrame.Width * _CurrentFrame.Height];
             Marshal.Copy(bitmapdata.Scan0, data, 0, data.Length);
             _CurrentFrame.UnlockBits(bitmapdata);
             if (((Frame.index == -1) || (_CurrentFrame.Width != Frame.width)) || (_CurrentFrame.Height != Frame.height))
             {
                 CDraw.RemoveTexture(ref Frame);
                 Frame = CDraw.AddTexture(_CurrentFrame.Width, _CurrentFrame.Height, ref data);
             }
             else
             {
                 CDraw.UpdateTexture(ref Frame, ref data);
             }
         }
     }
     return false;
 }
示例#19
0
        private void UploadNewFrame(ref STexture frame)
        {
            if (!_FileOpened)
                return;

            lock (MutexFramebuffer)
            {
                int num = FindFrame();

                if (num >= 0)
                {
                    if (frame.index == -1 || _Width != frame.width || _Height != frame.height)
                    {
                        CDraw.RemoveTexture(ref frame);
                        frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].data);
                    }
                    else
                    {
                        CDraw.UpdateTexture(ref frame, ref _FrameBuffer[num].data);
                    }

                    lock (MutexSyncSignals)
                    {
                        _CurrentVideoTime = _FrameBuffer[num].time;
                    }
                    _Finished = false;
                    //EventDecode.Set();
                }
                else
                {
                    if (_NoMoreFrames)
                        _Finished = true;
                }
            }
        }
示例#20
0
        public bool GetFrame(ref STexture frame, float Time, ref float VideoTime)
        {
            if (!_FileOpened)
                return false;

            if (_Paused)
                return false;

            if (_SetLoop)
            {
                lock (MutexSyncSignals)
                { 
                    _SetTime += _LoopTimer.ElapsedMilliseconds / 1000f;
                    VideoTime = _SetTime;

                    _LoopTimer.Stop();
                    _LoopTimer.Reset();
                    _LoopTimer.Start();
                }

                
                UploadNewFrame(ref frame);
                //EventDecode.Set();
                return true;
            }

            if (_SetTime != Time)
            {
                lock (MutexSyncSignals)
                {
                    _SetTime = Time;                   
                }
                UploadNewFrame(ref frame);
                VideoTime = _CurrentVideoTime;
                //EventDecode.Set();
                return true;
            }
            return false;
        }
示例#21
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
示例#22
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
示例#23
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, rect, mirrored);
     }
 }
示例#24
0
 public void DrawTexture(STexture Texture, SRectF rect)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, Texture.color);
     }
 }
示例#25
0
        public STexture CopyScreen()
        {
            STexture texture = new STexture(0);
            Bitmap bmp = new Bitmap(_backbuffer);
            _Bitmaps.Add(bmp);

            texture.index = _Bitmaps.Count - 1;

            texture.width = bmp.Width;
            texture.height = bmp.Height;

            // Add to Texture List
            texture.color = new SColorF(1f, 1f, 1f, 1f);
            texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
            _Textures.Add(texture);

            return texture;
        }
示例#26
0
 public bool UpdateTexture(ref STexture Texture, ref byte[] Data)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         BitmapData bmp_data = _Bitmaps[Texture.index].LockBits(new Rectangle(0, 0, _Bitmaps[Texture.index].Width, _Bitmaps[Texture.index].Height),
             ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
         Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
         _Bitmaps[Texture.index].UnlockBits(bmp_data);
     }
     return true;
 }
示例#27
0
 public void RemoveTexture(ref STexture Texture)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0))
     {
         for (int i = 0; i < _Textures.Count; i++)
         {
             if (_Textures[i].index == Texture.index)
             {
                 _Bitmaps[Texture.index].Dispose();
                 _Textures.RemoveAt(i);
                 Texture.index = -1;
                 break;
             }
         }
     }
 }
示例#28
0
 public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
示例#29
0
        public STexture QuequeTexture(int W, int H, ref byte[] Data)
        {
            STexture texture = new STexture(-1);
            STextureQueque queque = new STextureQueque();

            queque.data = Data;
            queque.height = H;
            queque.width = W;
            texture.height = H;
            texture.width = W;

            lock (MutexTexture)
            {
                texture.index = _IDs.Dequeue();
                queque.ID = texture.index;
                _Queque.Add(queque);
                _Textures[texture.index] = texture;
            }

            return texture;
        }
示例#30
0
        public STexture AddTexture(string TexturePath)
        {
            STexture texture = new STexture();
            if (System.IO.File.Exists(TexturePath))
            {
                bool found = false;
                foreach(STexture tex in _Textures)
                {
                    if (tex.TexturePath == TexturePath)
                    {
                        texture = tex;
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    Bitmap bmp = new Bitmap(TexturePath);
                    return AddTexture(bmp);
                }
            }

            return texture;
        }
示例#31
0
 public void RemoveTexture(ref STexture Texture)
 {
     if ((Texture.index > 0) && (_Textures.Count > 0))
     {
         lock (MutexTexture)
         {
             _IDs.Enqueue(Texture.index);
             GL.DeleteTexture(Texture.ID);
             if (Texture.PBO > 0)
                 GL.DeleteBuffers(1, ref Texture.PBO);
             _Textures.Remove(Texture.index);
             Texture.index = -1;
             Texture.ID = -1;
         }
     }
 }
示例#32
0
 public void CopyScreen(ref STexture Texture)
 {
     if ((Texture.index == 0) || (Texture.width != GetScreenWidth()) || (Texture.height != GetScreenHeight()))
     {
         RemoveTexture(ref Texture);
         Texture = CopyScreen();
     }
     else
     {
         _Bitmaps[Texture.index] = new Bitmap(_backbuffer);
     }
 }
示例#33
0
        public bool Unload()
        {
            STexture[] textures = new STexture[_Textures.Count];
            _Textures.Values.CopyTo(textures, 0);
            for (int i = 0; i < _Textures.Count; i++ )
            {
                RemoveTexture(ref textures[i]);
            }

            return true;
        }
示例#34
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, bounds, false);
     }
 }
示例#35
0
        public bool UpdateTexture(ref STexture Texture, ref byte[] Data)
        {
            if (_TextureExists(ref Texture))
            {
                if (_UsePBO)
                {
                    try
                    {
                        GL.BindBuffer(BufferTarget.PixelUnpackBuffer, Texture.PBO);

                        IntPtr Buffer = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly);
                        Marshal.Copy(Data, 0, Buffer, Data.Length);

                        GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);

                        GL.BindTexture(TextureTarget.Texture2D, Texture.ID);
                        GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)Texture.width, (int)Texture.height,
                            OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);

                        GL.BindTexture(TextureTarget.Texture2D, 0);
                        GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);

                        return true;
                    }
                    catch (Exception)
                    {
                        throw;
                        //_UsePBO = false;
                    }
                }

                GL.BindTexture(TextureTarget.Texture2D, Texture.ID);

                GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)Texture.width, (int)Texture.height,
                    OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, Data);

                //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
                //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);

                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);

                //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
                //GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
                //GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);

                GL.BindTexture(TextureTarget.Texture2D, 0);

                return true;
            }
            return false;
        }
示例#36
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         Bitmap ColoredBitmap = ColorizeBitmap(_Bitmaps[Texture.index], color);
         _g.DrawImage(ColoredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H));
         ColoredBitmap.Dispose();
     }
 }
示例#37
0
        public static bool GetCover(string CoverPath, ref STexture tex, int MaxSize)
        {
            bool result = false;

            if (!File.Exists(CoverPath))
            {
                CLog.LogError("Can't find File: " + CoverPath);
                return false;
            }

            SQLiteConnection connection = new SQLiteConnection();
            connection.ConnectionString = "Data Source=" + _CoverFilePath;
            SQLiteCommand command;
            try
            {
                connection.Open();
            }
            catch (Exception)
            {
                return false;
            }
            command = new SQLiteCommand(connection);

            command.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path";
            command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = CoverPath;

            SQLiteDataReader reader = null;
            try
            {
                reader = command.ExecuteReader();
            }
            catch (Exception)
            {
                throw;
            }

            if (reader != null && reader.HasRows)
            {
                reader.Read();
                int id = reader.GetInt32(0);
                int w = reader.GetInt32(1);
                int h = reader.GetInt32(2);
                reader.Close();

                command.CommandText = "SELECT Data FROM CoverData WHERE CoverID = " + id.ToString();
                try
                {
                    reader = command.ExecuteReader();
                }
                catch (Exception)
                {
                    throw;
                }

                if (reader.HasRows)
                {
                    result = true;
                    reader.Read();
                    byte[] data = GetBytes(reader);
                    tex = CDraw.AddTexture(w, h, ref data);
                }
            }
            else
            {
                if (reader != null)
                    reader.Close();

                Bitmap origin;
                try
                {
                    origin = new Bitmap(CoverPath);
                }
                catch (Exception)
                {
                    CLog.LogError("Error loading Texture: " + CoverPath);
                    tex = new STexture(-1);

                    if (reader != null)
                    {
                        reader.Close();
                        reader.Dispose();
                    }
                    command.Dispose();
                    connection.Close();
                    connection.Dispose();

                    return false;
                }

                int w = MaxSize;
                int h = MaxSize;

                if (origin.Width >= origin.Height && origin.Width > w)
                    h = (int)Math.Round((float)w / origin.Width * origin.Height);
                else if (origin.Height > origin.Width && origin.Height > h)
                    w = (int)Math.Round((float)h / origin.Height * origin.Width);

                Bitmap bmp = new Bitmap(w, h);
                Graphics g = Graphics.FromImage(bmp);
                g.DrawImage(origin, new Rectangle(0, 0, w, h));
                g.Dispose();
                tex = CDraw.AddTexture(bmp);
                byte[] data = new byte[w * h * 4];

                BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                Marshal.Copy(bmp_data.Scan0, data, 0, w*h*4);
                bmp.UnlockBits(bmp_data);
                bmp.Dispose();

                command.CommandText = "INSERT INTO Cover (Path, width, height) " +
                    "VALUES (@path, " + w.ToString() + ", " + h.ToString() + ")";
                command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = CoverPath;
                command.ExecuteNonQuery();

                command.CommandText = "SELECT id FROM Cover WHERE [Path] = @path";
                command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = CoverPath;
                reader = null;
                try
                {
                    reader = command.ExecuteReader();
                }
                catch (Exception)
                {
                    throw;
                }

                if (reader != null)
                {
                    reader.Read();
                    int id = reader.GetInt32(0);
                    reader.Close();
                    command.CommandText = "INSERT INTO CoverData (CoverID, Data) " +
                    "VALUES ('" + id.ToString() + "', @data)";
                    command.Parameters.Add("@data", System.Data.DbType.Binary, 20).Value = data;
                    command.ExecuteReader();
                    result = true;
                }
            }

            if (reader != null)
            {
                reader.Close();
                reader.Dispose();
            }
            command.Dispose();
            connection.Close();
            connection.Dispose();

            return result;
        }
示例#38
0
 public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
示例#39
0
 public bool UpdateTexture(ref STexture Texture, IntPtr Data)
 {
     return(true);
 }
示例#40
0
 public bool UpdateTexture(ref STexture Texture, IntPtr Data)
 {
     return true;
 }
示例#41
0
        public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
        {
            if (_TextureExists(ref Texture))
            {
                GL.BindTexture(TextureTarget.Texture2D, Texture.ID);

                GL.Enable(EnableCap.Blend);
                GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);

                GL.Begin(BeginMode.Quads);

                GL.TexCoord2(0f + begin * Texture.width_ratio, 0f);
                GL.Vertex3(rect.X + begin * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);

                GL.TexCoord2(0f + begin * Texture.width_ratio, Texture.height_ratio);
                GL.Vertex3(rect.X + begin * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);

                GL.TexCoord2(Texture.width_ratio * end, Texture.height_ratio);
                GL.Vertex3(rect.X + end * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);

                GL.TexCoord2(Texture.width_ratio * end, 0f);
                GL.Vertex3(rect.X + end * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);

                GL.End();

                GL.Disable(EnableCap.Blend);
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
        }
示例#42
0
        public STexture AddTexture(Bitmap bmp)
        {
            Bitmap bmp2 = new Bitmap(bmp);
            _Bitmaps.Add(bmp2);
            STexture texture = new STexture();

            texture.index = _Bitmaps.Count - 1;

            texture.width = bmp.Width;
            texture.height = bmp.Height;

            // Add to Texture List
            texture.color = new SColorF(1f, 1f, 1f, 1f);
            texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
            texture.TexturePath = String.Empty;

            _Textures.Add(texture);

            return texture;
        }
示例#43
0
        public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
        {
            if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f)
                return;

            if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X)
                return;

            if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y)
                return;

            if (height > bounds.H)
                height = bounds.H;

            if (_TextureExists(ref Texture))
            {
                GL.BindTexture(TextureTarget.Texture2D, Texture.ID);

                float x1 = (bounds.X - rect.X) / rect.W * Texture.width_ratio;
                float x2 = (bounds.X + bounds.W - rect.X) / rect.W * Texture.width_ratio;
                float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * Texture.height_ratio;
                float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * Texture.height_ratio;

                if (x1 < 0)
                    x1 = 0f;

                if (x2 > Texture.width_ratio)
                    x2 = Texture.width_ratio;

                if (y1 < 0)
                    y1 = 0f;

                if (y2 > Texture.height_ratio)
                    y2 = Texture.height_ratio;

                float rx1 = rect.X;
                float rx2 = rect.X + rect.W;
                float ry1 = rect.Y + rect.H + space;
                float ry2 = rect.Y + rect.H + space + height;

                if (rx1 < bounds.X)
                    rx1 = bounds.X;

                if (rx2 > bounds.X + bounds.W)
                    rx2 = bounds.X + bounds.W;

                if (ry1 < bounds.Y + space)
                    ry1 = bounds.Y + space;

                if (ry2 > bounds.Y + bounds.H + space + height)
                    ry2 = bounds.Y + bounds.H + space + height;

                GL.Enable(EnableCap.Blend);

                GL.MatrixMode(MatrixMode.Texture);
                GL.PushMatrix();

                if (rect.Rotation != 0f)
                {
                    GL.Translate(0.5f, 0.5f, 0);
                    GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
                    GL.Translate(-0.5f, -0.5f, 0);
                }

                GL.Begin(BeginMode.Quads);

                GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
                GL.TexCoord2(x2, y2);
                GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);

                GL.Color4(color.R, color.G, color.B, 0f);
                GL.TexCoord2(x2, y1);
                GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);

                GL.Color4(color.R, color.G, color.B, 0f);
                GL.TexCoord2(x1, y1);
                GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);

                GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
                GL.TexCoord2(x1, y2);
                GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);

                GL.End();

                GL.PopMatrix();

                GL.Disable(EnableCap.Blend);
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
        }