• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Draw.STexture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Vocaluxe.Lib.Draw.STexture的典型用法代码示例。如果您正苦于以下问题:C# STexture类的具体用法?C# STexture怎么用?C# STexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



STexture类属于Vocaluxe.Lib.Draw命名空间,在下文中一共展示了STexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetFrame

 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;
 }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:15,代码来源:CVideoDecoderFFmpeg.cs


示例2: CStatic

        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;
        }
开发者ID:hessbe,项目名称:Vocaluxe,代码行数:16,代码来源:CStatic.cs


示例3: GetFrame

 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;
 }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:23,代码来源:CAForgeNet.cs


示例4: UpdateTexture

 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;
 }
开发者ID:zhaozw,项目名称:Vocaluxe,代码行数:11,代码来源:CDrawWinForm.cs


示例5: RemoveTexture

 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;
             }
         }
     }
 }
开发者ID:zhaozw,项目名称:Vocaluxe,代码行数:16,代码来源:CDrawWinForm.cs


示例6: DrawTexture

 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
开发者ID:zhaozw,项目名称:Vocaluxe,代码行数:3,代码来源:CDrawWinForm.cs


示例7: CopyScreen

        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;
        }
开发者ID:zhaozw,项目名称:Vocaluxe,代码行数:18,代码来源:CDrawWinForm.cs


示例8: DrawTextureReflection

        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);
            }
        }
开发者ID:stsundermann,项目名称:Vocaluxe,代码行数:90,代码来源:COpenGL.cs


示例9: DrawTexture

        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);
            }
        }
开发者ID:stsundermann,项目名称:Vocaluxe,代码行数:29,代码来源:COpenGL.cs


示例10: AddTexture

        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;
        }
开发者ID:zhaozw,项目名称:Vocaluxe,代码行数:25,代码来源:CDrawWinForm.cs


示例11: QuequeTexture

        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;
        }
开发者ID:stsundermann,项目名称:Vocaluxe,代码行数:21,代码来源:COpenGL.cs


示例12: RemoveTexture

 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;
         }
     }
 }
开发者ID:stsundermann,项目名称:Vocaluxe,代码行数:16,代码来源:COpenGL.cs


示例13: Unload

        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;
        }
开发者ID:stsundermann,项目名称:Vocaluxe,代码行数:11,代码来源:COpenGL.cs


示例14: UpdateTexture

        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;
        }
开发者ID:stsundermann,项目名称:Vocaluxe,代码行数:52,代码来源:COpenGL.cs


示例15: DrawTextureReflection

 public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
开发者ID:zhaozw,项目名称:Vocaluxe,代码行数:3,代码来源:CDrawWinForm.cs


示例16: GetCover

        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));
//.........这里部分代码省略.........
开发者ID:bohning,项目名称:Vocaluxe,代码行数:101,代码来源:CDataBase.cs


示例17: UploadNewFrame

        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;
                }
            }
        }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:35,代码来源:CVideoDecoderFFmpeg.cs


示例18: CStatic

        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;
        }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:16,代码来源:CStatic.cs


示例19: Init

        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;
        }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:47,代码来源:CSongMenuTileBoard.cs


示例20: CCursor

        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();
        }
开发者ID:bohning,项目名称:Vocaluxe,代码行数:18,代码来源:CGraphics.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Basement.DataEntities类代码示例发布时间:2022-05-26
下一篇:
C# Draw.SRectF类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap