本文整理汇总了C#中SdlDotNet.Graphics.Surface.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.Close方法的具体用法?C# Surface.Close怎么用?C# Surface.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SdlDotNet.Graphics.Surface
的用法示例。
在下文中一共展示了Surface.Close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSurface
public static SdlDotNet.Graphics.Surface LoadSurface(string filePath, bool convert, bool transparent)
{
filePath = IO.Paths.CreateOSPath(filePath);
Surface returnSurf;
switch (System.IO.Path.GetExtension(filePath)) {
case ".pmugfx": {
if (IO.IO.FileExists(filePath)) {
using (MemoryStream stream = new MemoryStream(DecryptSurface(filePath)))
{
Bitmap bitmap = (Bitmap)Image.FromStream(stream);
returnSurf = new Surface(bitmap);
if (convert)
{
Surface returnSurf2 = returnSurf.Convert();
returnSurf2.Transparent = true;
returnSurf.Close();
return returnSurf2;
}
else
{
return returnSurf;
}
}
} else {
return null;
}
}
case ".gif":
case ".png":
default: {
if (IO.IO.FileExists(filePath)) {
using (FileStream stream = File.OpenRead(filePath))
{
if (transparent)
{
Bitmap bitmap = (Bitmap)Image.FromStream(stream);
Bitmap clone = new Bitmap(bitmap.Width, bitmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
using (Graphics gr = Graphics.FromImage(clone))
{
gr.DrawImage(bitmap, new Rectangle(0, 0, clone.Width, clone.Height));
}
returnSurf = new Surface(clone);
}
else
{
Bitmap bitmap = (Bitmap)Image.FromStream(stream);
returnSurf = new Surface(bitmap);
}
if (convert)
{
Surface returnSurf2 = returnSurf.Convert();
returnSurf2.Transparent = true;
returnSurf.Close();
return returnSurf2;
}
else
{
return returnSurf;
}
}
} else {
return null;
}
}
}
}
示例2: LoadPMUGfx
internal static Surface LoadPMUGfx(byte[] imageBytes, bool convert)
{
Surface returnSurf = new Surface(DecryptSurface(imageBytes));
if (convert) {
Surface returnSurf2 = returnSurf.Convert();
returnSurf2.Transparent = true;
returnSurf.Close();
return returnSurf2;
} else {
return returnSurf;
}
}
示例3: 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));
}
示例4: 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));
}
示例5: Redraw
private void Redraw()
{
try {
base.Buffer.Fill(mBackColor);
if (mBackground != null) {
mBackground.Close();
mBackground.Dispose();
}
mBackground = new SdlDotNet.Graphics.Surface(this.Size);
mBackground.TransparentColor = Color.Transparent;
mBackground.Transparent = true;
mBackground.Fill(mBackColor);
int lastY = 2;
// Draw each line
for (int i = mVisibleY; i < mVisibleY + mMaxY; i++) {
if (mLines.Count > i) {
SdlDotNet.Graphics.Surface lineSurf;
if (mPasswordChar == '\0') {
lineSurf = mLines[i].Render();
} else {
lineSurf = mLines[i].RenderPassword(mPasswordChar);
}
mBackground.Blit(lineSurf, new Point(2, lastY));
lineSurf.Close();
lastY += mFont.Height;
} else
break;
}
base.Buffer.Blit(mBackground);
mBackground.Close();
//if (mDoLineDraw) {
// Gfx.IPrimitive line = new Gfx.Primitives.Line(new Point((((mCursorLocX - mVisibleX) * (mLetterSize.Width))), (((((mCursorLocY) - mVisibleY) * mLetterSize.Height)) - 2)), new Point(((mCursorLocX - mVisibleX) * (mLetterSize.Width)), (((mCursorLocY) - mVisibleY) * mLetterSize.Height + mLetterSize.Height)));
// base.Buffer.Draw(line, Color.Blue);
//}
} catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
}