本文整理汇总了C#中Vocaluxe.Lib.Draw.STexture类的典型用法代码示例。如果您正苦于以下问题:C# STexture类的具体用法?C# STexture怎么用?C# STexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
STexture类属于Vocaluxe.Lib.Draw命名空间,在下文中一共展示了STexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
}
示例6: DrawTexture
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
{
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例15: DrawTextureReflection
public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
{
}