Rotate text - Managed DirectX (C#) - c#

I am currently developing a little application with a highly-dynamic GUI which needs a lot of refreshing and drawing. To archive this, I am using managed DirectX.
I successfully painted a little string in a specific font to specific coordinates, but I have no idea on how I could rotate the drawn text...
Any ideas?
Thanks!

Okay, I found no native method to archive my goal.
So I painted the Font on a bitmap, created a texture and used sprites to draw my font texture.

Related

C# Unity drawing to Texture2D

I need to render shapes to a Texture2D (lines, rect, roundrect, filled and line polygons). I can't find a proper solution for this. I found one very basic library for drawing but that only can draw line and fill rect. I rather not want to write my own rendering library in 2021 or hacking SkiaSharp in unity.
It would be nice to find any c# graphics library what is just rendering to an rgb array, but I can't find any so far.
What would be the best solution for this?

How to make Unity Game fit any resolution when resizing the window?

I couldn't find an option to send a picture to better explain what's happening. Here's a Unity Link that has the photos to explain the issue.
I've tried Camera.main.orthographicsize = 4.0f, a solid number to stay on but the Orthographic Size of the camera keeps changing it's size after resizing the window when I'm in free aspect Unity editor mode and even when I export the Unity game with 1920x1080(16:9) resolution. I want it to stay the same size when resizing the window so that the game can always fit inside the screen in any resolution when resizing the window. The default blue background of the camera displays when I stretch the window's width far enough which I don't want to happen.
This Youtube video has the results I'm looking for but the code unfortunately is not working on Unity 2019. The code provided from this video does entirely different things for me and doesn't solve my issue.
From what I understood is that the screen has to has a fixed resolution.
This link will demonstrate the solution. https://docs.unity3d.com/Manual/GameView.html
It does that by changing the
Game View Aspect from free to a fixed resolution.
Unless this is not what you are looking for then I sugest another solution:
Make a black background image that fits the screen size.
Then change the scale of the objects in the scene relative to the camera.
This link will make the scaling solution, Make object visual size constant despite the distance

Words in transparent PNG have jagged edges

I've built an app which uses transparent PNGs to display an overlay for users to tap using WPF and C#. However, there are weird jagged edges around the words. Would this be more of a C#/WPF limitation or a Photoshop issue?
Screen resolution is 720p. App runs on win7pro.
Screenshot:
Definitely a problem with the image itself. I see the same fringing when viewing the image against a black background on my phone. Make sure you compose the text over a transparent background (i.e., don't remove the background with a magic wand tool) and save with a full alpha channel (32-bit PNG).

Rectifiy image of DVD cover

I'm trying to get the cover image of a DVD as a rectangular image from a photo. Now as the cover on the photo is usually a bit skewed I need to rectify it programmatically.
I've already removed most of the surroundings using the Laplacian of Gauss filter, but now I need to find the borders of the cover and somehow fill the whole frame with the coverimage.
I thought of using the Hough-Transformation, but this seems to be pretty brute-force for linking edges. I want to run this on a Windows RT Device (Surface), so a low-level idea for C# would be great. Any ideas?
You should look into OpenCV and the image segmentation parts. After that you can perform a skew / shear transformation on the 2D image.

SharpDX render 2D polygon to offscreen bitmap

I'm wondering what is the best way to render a polygon to WPF-compatable BitmapSource using DirectX (preferably SharpDX)?
I have to render tens of thousands of polygons like this offscreen to BitmapSource then include in a WPF applicatoin and need the fastest possible way to do it. The rendering must be performed off-screen for later showing in a WPF Image OR exporting to file.
(not actual size. Polygon size ranges from 16x16 to 24x24 pixels)
Any suggestions welcome!
WPF has its own ability to render shapes and does so using DirectX as DirectX is the underlying technology behind WPF. Here is a link to some some sample code for using SharpDX in WPF.
http://directx4wpf.codeplex.com/

Categories