Drawing to a GDI+ Bitmap [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am trying to move everything from GDI to GDI+. As it stands I am drawing to a buffer DC (GDI). I am wanting to have it instead drawn to a HBITMAP and only have it drawn once. I have tried
things with pointers and Image, but could not find anything useful. There is no istream or file, and I am not using the flat api version (found a constructor for that.)
http://pastebin.com/bcw07Suq

Solved. Here is how you can create the bitmap and then proceed to draw.
Graphics g(hDC);
Bitmap foobar(100,100,PixelFormat32bppPARGB);
g.DrawImage(&foobar,100,100);
SolidBrush brush(Color::Blue);
g.FillRectangle(&brush, 0,0,10,10);

Related

(C++) How to use GetPixel() of x y on screen [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Could someone make some code that gets the pixel of an x y coord on screen and explain how the code works. I have read other examples but I dont know what all the functions and code do. Thanks.
HDC hdcScreen = GetDC(0);
COLORREF crPixel = GetPixel(hdcScreen, 10, 10);
ReleaseDC(0, hdcScreen);
Will store the displayed pixel at coordinates 10,10 into crPixel.
Is this what you were asking for?

When should SelectFont be Called? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I was fixing an issue to do with scaling and the solution was that we had to call SelectFont afer DrawText.
If SelectFont is called before DrawText the font isn't scaled correctly.
I cant see how that would make a difference, is there any reason?
SelectFont essentially selects a font in the Device Context you pass in. If you call DrawText before selecting a font, then a default font (System) will be used and not the font you want to select.
This means that the font you are using isn't scaling well as the results seem better with the default system font.

How to add 3D-Text to a video programmatically [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
I'm looking for a fast, efficient solution to add text to a video. I tried the CLI from ffmpeg but I think it only lets me add 2D-Text. I want to be able to create Text and /or images and Rotate / Skew them in "3D-Space".
Is this possible via CLI of some video processing tools or do I have to get into OpenCV etc.?
Thank you all for your help.
I will go with this:
Create a Textblock in ImageMagick and Distort it into the 3D Space (e.g. http://www.imagemagick.org/Usage/distorts/#perspective)
Export from ImageMagick to a ImageFormat with Alphachannel (e.g. PNG / TGA)
Overlay the image over the video using CLI from FFMPEG
(e.g. http://www.oodlestechnologies.com/blogs/PICTURE-IN-PICTURE-effect-using-FFMPEG)

How can I make zoomable square table in SFML? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How can I make zoomable square table like in the picture below?
At first, there is no tile in squares.
but when zoom in, tiles are slowly appearing inside squares.
And another question, can I have paint bucket tool and use to fill my tile then store information into array?
In SFML this can be done using a so-called sf::View. This allows you to have a world defined and have different and changing views on it, like in your example.
There is a very good introduction to Views in SFML here.

How can I make a banner in QT, like the news banner of CNN/FOX? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
as the title says, I want to add my main window a banner in the bottom of the window that shows text that runs from left to right, just like you can see in your TV when watching fox/CNN...
I'm using QT 4.5.2
Thanks a lot :)
You have many options. You could:
Create a custom widget and override QWidget::paintEvent()
Drawing your text to an image and then repainting that image as often as needed
Creating a QGraphicsScene and then moving an appropriate text item around.
QTimeline and/or QTimer will likely be useful in your implementation. The key idea is that you need to draw something at different positions at consistent intervals. If you redraw frequently enough, it will look like an animation.