本文整理汇总了C#中Media.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Media.Clone方法的具体用法?C# Media.Clone怎么用?C# Media.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindOrAdd
/// <summary>
/// Check in the database if a media similar to "newM"
/// already exists. If the answer is "yes", then the Media
/// from the database is returned. If the answer is "no", then
/// the provided Media is added into the database and returned
/// to the caller.
/// </summary>
/// <param name="newM"></param>
/// <returns></returns>
private Media FindOrAdd(Media newM)
{
foreach (Media m in medias)
{
if (m.IsSimilarTo(newM) == true)
{
return m;
}
}
newM = (Media)newM.Clone();
medias.Add(newM);
if (MediaAdded != null)
{
MediaAdded(newM, EventArgs.Empty);
}
return newM;
}
示例2: BlitFromMemory
public override void BlitFromMemory( Media.PixelBox src, Media.BasicBox dstBox )
{
if ( this.Buffer.Contains( dstBox ) == false )
{
throw new ArgumentOutOfRangeException( "dstBox", "Destination box out of range" );
}
PixelBox scaled;
if ( src.Width != dstBox.Width || src.Height != dstBox.Height || src.Depth != dstBox.Depth )
{
//Scale to destination size
//This also does pixel format conversion if needed
this.AllocateBuffer();
scaled = this.Buffer.GetSubVolume( dstBox );
Image.Scale( src, scaled, ImageFilter.Bilinear );
}
else if ( ( src.Format != format ) || ( ( GLES2PixelUtil.GetGLOriginFormat( src.Format ) == 0 ) && ( src.Format != PixelFormat.R8G8B8 ) ) )
{
//Extents match, but format is not accepted as valid source format for GL
//do conversion in temporary buffer
this.AllocateBuffer();
scaled = this.Buffer.GetSubVolume( dstBox );
PixelConverter.BulkPixelConversion( src, scaled );
if ( src.Format == PixelFormat.A4R4G4B4 )
{
// ARGB->BGRA
GLES2PixelUtil.ConvertToGLFormat( ref scaled, ref scaled );
}
}
else
{
this.AllocateBuffer();
scaled = src.Clone();
if ( src.Format == PixelFormat.R8G8B8 )
{
scaled.Format = PixelFormat.B8G8R8;
PixelConverter.BulkPixelConversion( src, scaled );
}
}
this.Upload( scaled, dstBox );
this.FreeBuffer();
}
示例3: ShowRtpPacket
void ShowRtpPacket(object sender, Media.Rtp.RtpPacket packet)
{
try
{
if (this.InvokeRequired) Invoke(new FillGridRtp(AddRtp), packet.Clone(true, true, true, true, true));
else RTPPacketBinding.Add((IPacket)packet.Clone(true, true, true, true, true));
}
catch { }
}