rds1983 / stbsharp Goto Github PK
View Code? Open in Web Editor NEWC# port of the famous C framework
C# port of the famous C framework
Hello
Trying to test stb_truetype for unicode text output:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
_spriteBatch.Draw(_image, new Vector2(0, 0));
_spriteBatch.Draw(_fontTexture, new Vector2(_image.Width + 10, 0));
DrawTTFString(_spriteBatch, "E: The quick brown fox jumps over the lazy dog, I: An ḃfuil do ċroí ag bualaḋ ó ḟaitíos",
new Vector2(0, _image.Height + 30), Color.White);
DrawTTFString(_spriteBatch, "G: Üben quält finſteren Jagdſchloß höfliche Bäcker größeren, N: Blåbærsyltetøy",
new Vector2(0, _image.Height + 60), Color.White);
DrawTTFString(_spriteBatch, "D: Høj bly gom vandt fræk sexquiz på wc, S: bäckasiner söka",
new Vector2(0, _image.Height + 90), Color.White);
DrawTTFString(_spriteBatch, "I: Sævör grét áðan því úlpan var ónýt, P: Pchnąć w tę łódź jeża lub osiem skrzyń fig",
new Vector2(0, _image.Height + 120), Color.White);
DrawTTFString(_spriteBatch, "C: Příliš žluťoučký kůň úpěl ďábelské kódy, R: В чащах юга жил-был цитрус? Да, но фальшивый экземпляр! ёъ.",
new Vector2(0, _image.Height + 160), Color.White);
DrawTTFString(_spriteBatch, "S: kilómetros y frío, añoraba, P: vôo à noite, F: Les naïfs ægithales hâtifs pondant à Noël où",
new Vector2(0, _image.Height + 190), Color.White);
DrawTTFString(_spriteBatch, "J: いろはにほへど",
new Vector2(0, _image.Height + 220), Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
But see this:
https://i.imgur.com/Kc3cmNu.png
Tried different fonts, no result.
Can you please tell me what I do wrong, or is it a restriction of StbSharp?
Was looking through the StbImageWrite.Generated.cs
files, and noticed this...
if (256 <= 143)
{
// Removed for brevity
}
else if (256 <= 255)
{
// Removed for brevity
}
else if (256 <= 279)
{
// Removed for brevity
}
I am going to assume this portion did not generate correctly, as 256
is never going to be less than 143
or 255
, and always be less than 279
.
Hey,
Im currently working with OpenTK and trying to use StbSharp to load a texture(in dot net core 2) i have tried using
private byte[] LoadTexture(string filename, out int width, out int height)
{
ImageReader loader = new ImageReader();
using (Stream stream = File.Open(filename, FileMode.Open))
{
byte[] buffer = File.ReadAllBytes(filename);
Image image = Stb.LoadFromMemory(buffer, Stb.STBI_rgb_alpha);
width = image.Width;
height = image.Height;
return image.Data;
}
}
and using the returning bytes directly with opentk which doesnt seem
Does anyone have any advice?
你好,我目前正在使用Unity3d,并试图使用StbSharp加载一个纹理,加载后的纹理是FilpY的效果
UnityEngine.Texture2D texture2D = new UnityEngine.Texture2D(Image.Width, Image.Height);
texture2D.SetPixels32(ToColors(Image.Data));
texture2D.Apply();
有什么解决方法吗?
Hello.
Just downloaded master.
Trying to run Tests exe file and getting:
https://i.imgur.com/CsVQYvR.png
What I do wrong? Put some images to TestImages, just in case - https://i.imgur.com/WC6Jtwf.png
Something wrong with them? Should I upload them here?
StbSharp.MonoGame.WindowsDX.Test.exe works fine though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.