I've been looking for the correct way to do this for a while. The method outlined here works somewhat (using the fix in the comments) but the colors are actually converted incorrectly. I've been wondering if a method using WinCodec would be better, as well.
Actually, that method is perfect for this. The problem was the source format of my texture.
Related
I'm looking for a simpler way (if there is one) of finding out what RGB is used by the brush that Windows uses to erase a window background.
The problem I'm trying to solve in the most elegant way is as follows:
When registering the class, I specify a brush this way:
hbrBackground := GetSysColorBrush(COLOR_WINDOW);
when processing the WM_PAINT, I'm using ExtTextOut specifying ETO_OPAQUE and the rectangle (so it clears it.)
Currently, I am using:
SetBkColor(dc, GetSysColor(COLOR_WINDOW));
That has an obvious downside, if the brush used when registering the class changes then, the programmer has to remember or be aware that the same change must be made in the SetBkColor instruction found in WM_PAINT. That's not good.
One way of solving the problem is to use GetClassLongPtr to get the background brush then, use GetObject on the brush to get its LOGBRUSH which contains the brush's RGB which can be passed to SetBkColor.
My question is: is using GetClassLongPtr followed by GetObject the simplest way of getting the RGB value I need to pass to SetBkColor ? I'm hoping there is a simpler (more straightforward) way than that.
Thank you very much for your help.
PS: I'm looking for a straight API solution in C/C++ or Delphi. No .net or any other framework solution.
I need to know the size of the output of a Direct2D Effect. Say, for example, to render the effect to a bitmap for later use. For example, of the built-in Gaussian blur effect.
ID2D1Effect does not have a GetSize() member. It does have GetOutput(), but the resulting ID2D1Image does not have a GetSize() member either. Or anything even remotely related.
An effect could have an unlimited output, adapted to the rendertarget, but I expect not. When you write custom effects, the internal transform graph has, somewhere, functions like MapInputRectsToOutputRect(). Is it accessible from the app for built-in effects?
Did I miss anything? Is it at all possible?
ID2D1DeviceContext::GetImageLocalBounds method probably is what you are looking for.
I am adding some images to Android's system gallery with CameraRoll.addBitmapData. This all works just fine, however the quality of the added images is... how to put it... disastrous! Absolutely unusable. Considering the method doesn't accept any parameters, I am not quite sure what can be done about it. Is there any other way how to achieve this or this case is lost? Thanks!
https://github.com/abhisek-mishra/ScreenShot
Use the native extension above. If you need hel to use it, just ask for it. I´ll see what i can do for u if is the case.
When I use the following,
imshow(imread('image1.jpg'));
imshow(imread('image2.jpg'));
imshow(imread('image3.jpg'));
imshow(imread('image4.jpg'));
imshow(imread('image5.jpg'));
imshow(imread('image6.jpg'));
I got only image named image6.jpg in the output figure.
There is also an option figure,imshow(...); to view all the images each in new window.
But writing figure in each line where I need to view the image is a repeated and tedious process. Is there any other solution to get the same output as with figure,imshow(..);
without using figure function.
I mainly put on this question because while programming a lot somewhere we forget to use the figure function and so the image that we need to view wont be visible. It would have been overwritten by other image. So provide me some solution.
I ask this only for simplicity in writing the code. So if there is any solution, please mention.
Thanks in advance.
I'm not sure, but I don't think that there's a workaround to that. MATLAB basically changes the current figure handle to that of a new image when you use imshow. One thing you can do however is to make a copy of imshow in your local directory and edit it accordingly to make your own UDF.
What I would recommend however (so as to preserve functionality across systems) is that you open your code is an editor and replace all imshows with figure, imshow. This should be easy enough and it'll be easy to revert back as well.
As the title says, how can I verify if my framebuffers got rendered properly?
Is the best way to use glReadPixels and save the content to an image? If so, is there a simple open source library for doing this?
You can use gDebugger, it's best for the task. Allows to see buffers, textures, calls, states and lots of other useful information.