本文整理汇总了C#中SdlDotNet.Graphics.Surface.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.Dispose方法的具体用法?C# Surface.Dispose怎么用?C# Surface.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SdlDotNet.Graphics.Surface
的用法示例。
在下文中一共展示了Surface.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSurface
public static Surface GetSurface(byte[] imgBytes, Size boxSize)
{
Surface boxSurf = new Surface(boxSize);
boxSurf.Fill(Color.White); //Fill background to white color
//Get and resize image
if (imgBytes != null)
{
Surface imgSurf = new Surface(imgBytes);
double scale = Ratio.CalculateScale(imgSurf.Size,
new Size(boxSize.Width, boxSize.Height),
Ratio.RatioType.FitImage); //Calculate ratio
Surface scaledSurf = imgSurf.CreateScaledSurface(scale, true);
imgSurf.Dispose();
Point pt = new Point((boxSize.Width - scaledSurf.Width) / 2, //Left point
(boxSize.Height - scaledSurf.Height) / 2); //Top point
boxSurf.Blit(scaledSurf, pt);
scaledSurf.Dispose(); //Clear imgSurf memory
}
//Draw border
for(int i = 0; i < BORDER; i++)
boxSurf.Draw(new Box(new Point(i, i), new Point(boxSize.Width - i - 1, boxSize.Height - i - 1)), Color.Gray);
return boxSurf;
}
示例2: UpdateBackground
private void UpdateBackground()
{
mBackground = new SdlDotNet.Graphics.Surface(base.Size);
base.Buffer.Fill(mBackColor);
if (mBackColor.A != 0) {
mBackground.Fill(mBackColor);
} else {
mBackground.Transparent = true;
mBackground.TransparentColor = Color.Transparent;
mBackground.Fill(Color.Transparent);
}
mCheckedBoxBounds = new Rectangle(new Point(2, 2), new Size(this.Height - 4, this.Height - 4));
Gfx.Primitives.Box box = new SdlDotNet.Graphics.Primitives.Box(mCheckedBoxBounds.Location, mCheckedBoxBounds.Size);
mBackground.Draw(box, Color.Black);
if (mChecked) {
Gfx.Surface filled = new SdlDotNet.Graphics.Surface(box.Size);
filled.Fill(Color.Black);
mBackground.Blit(filled, box.Location);
filled.Close();
filled.Dispose();
}
if (mText != "") {
Gfx.Font font = new Gfx.Font(IO.IO.CreateOSPath("Fonts\\PMU.ttf"), this.Height);
mBackground.Blit(font.Render(mText, mForeColor, mAntiAlias), new Point(20, -4));
font.Close();
}
base.Buffer.Blit(mBackground, new Point(0, 0));
}
示例3: CreateSurface
protected override Surface CreateSurface ()
{
if (player == null || player.Surface == null)
return null;
Console.WriteLine ("MovieElement: Creating new surface");
Surface surf;
surf = new Surface (player.Surface);
if (scale
&& (player.Width != Width
|| player.Height != Height)) {
double horiz_zoom = (double)Width / player.Width;
double vert_zoom = (double)Height / player.Height;
double zoom;
if (horiz_zoom < vert_zoom)
zoom = horiz_zoom;
else
zoom = vert_zoom;
// FIXME: NewSDL
// surf.Scale (zoom);
}
if (dim != 0) {
Surface dim_surf = new Surface (surf.Size);
dim_surf.Alpha = dim;
dim_surf.AlphaBlending = true;
dim_surf.Blit (surf);
surf.Dispose ();
surf = dim_surf;
}
return surf;
}
示例4: UpdateSurface
private void UpdateSurface()
{
mBackground.Fill(mBackColor);
if (base.IsColorTransparent(mBackColor)) {
mBackground.Transparent = true;
mBackground.TransparentColor = mBackColor;
} else {
mBackground.Transparent = false;
}
decimal newWidth = (decimal)base.Width * ((decimal)mPercent / (decimal)100);
Size barSize = new Size(System.Math.Max(0, (int)newWidth - 2), System.Math.Max(0, base.Height - 2));
Gfx.Surface barSurface = new SdlDotNet.Graphics.Surface(barSize);
barSurface.Fill(mBarColor);
mBackground.Blit(barSurface, new Point(1, 1));
barSurface.Close();
barSurface.Dispose();
if (mText != "" && mFont != null) {
Gfx.Surface fontSurf = mFont.Render(mText, Color.Black, false);
mBackground.Blit(fontSurf, GetCenter(mBackground, fontSurf.Size), new Rectangle(0, 0, this.Width, this.Height));
}
Draw3dBorder();
base.Buffer.Blit(mBackground, new Point(0, 0));
}