Font...
This commit is contained in:
parent
ff85180750
commit
01998d78dc
2 changed files with 7 additions and 2 deletions
|
|
@ -31,6 +31,7 @@ namespace SM.Base.Drawing.Text
|
||||||
_lib ??= new Library();
|
_lib ??= new Library();
|
||||||
|
|
||||||
_fontFace = new Face(_lib, path);
|
_fontFace = new Face(_lib, path);
|
||||||
|
UnpackAlignment = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegenerateTexture()
|
public void RegenerateTexture()
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ namespace SM.Base.Textures
|
||||||
private int? _height;
|
private int? _height;
|
||||||
private int? _width;
|
private int? _width;
|
||||||
|
|
||||||
|
public int UnpackAlignment = 4;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decides if the bitmap will automatically dispose itself.
|
/// Decides if the bitmap will automatically dispose itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -100,7 +102,7 @@ namespace SM.Base.Textures
|
||||||
{
|
{
|
||||||
base.Compile();
|
base.Compile();
|
||||||
|
|
||||||
_id = GenerateTexture(Map, Filter, WrapMode, AutoDispose);
|
_id = GenerateTexture(Map, Filter, WrapMode, AutoDispose, UnpackAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
@ -120,11 +122,13 @@ namespace SM.Base.Textures
|
||||||
/// <param name="dispose">Auto dispose of the bitmap? Default: false</param>
|
/// <param name="dispose">Auto dispose of the bitmap? Default: false</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int GenerateTexture(Bitmap map, TextureMinFilter filter, TextureWrapMode wrapMode,
|
public static int GenerateTexture(Bitmap map, TextureMinFilter filter, TextureWrapMode wrapMode,
|
||||||
bool dispose = false)
|
bool dispose = false, int unpackAlignment = 4)
|
||||||
{
|
{
|
||||||
var id = GL.GenTexture();
|
var id = GL.GenTexture();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, id);
|
GL.BindTexture(TextureTarget.Texture2D, id);
|
||||||
|
|
||||||
|
GL.PixelStore(PixelStoreParameter.UnpackAlignment, unpackAlignment);
|
||||||
|
|
||||||
var data = map.LockBits(new Rectangle(0, 0, map.Width, map.Height), ImageLockMode.ReadOnly,
|
var data = map.LockBits(new Rectangle(0, 0, map.Width, map.Height), ImageLockMode.ReadOnly,
|
||||||
map.PixelFormat);
|
map.PixelFormat);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue