Qt GIF creation: Colours swapped when using gif-h library - c++

Apparently, I am trying to use gif-h library for gif creation with qt 4.7 for a C++ project. After embedding the library to the project, I can generate GIF through my qt GUI app, however, the colours on the final/actual GIF are swapped. What I mean is that:
below red frame
becomes below blue frame
and same goes for other way round (i.e. blue frame becomes red frame).
Just like above, below orange frame
becomes below sky blue frame
and same goes for other way round (i.e. sky blue frame becomes orange frame).
Could someone familiar with the library or graphics or gif creation in code guide me?
I am happy to provide more information about image capturing and such, as and when needed.
Thank you in advance.

Ok, I have managed to resolve the problem by using QImage::rgbSwapped() function. Thank you to #Pablo Yaggi particularly for the hint.
I will have to remove the code snippet from the question due to security reasons.

Related

full screen and zoom in Koolplot

I'm trying to graph some things in C++ and Koolplot seems like a very simple and suitable library to do so with. I'm stuck, however, on finding some documentation about it that allows me to fullscreen the application (or resize it like you can do so on lots of applications, chrome, word, discord...). As well as this, I can't find or see how i can allow the user to drag the graph around with the mouse as well as zooming into a point of a scatterplot or function. If anyone has any ideas about these things i'd appreciate it, thanks.
The short reply is: cannot do.
Koolplot uses for drawings of the charts a modernized version of the venerable BGI driver. It was invented once upon a time, when personal computers were still running on some DOS version. Those times the graphics were full screen, hence of fixed size. This particularity was kept in the modernized WinBGIm library.
Zooming or panning properly a chart present on the screen require access from the drawing/painting routines of Koolplot to the data to be shown. This is not the case. If you look once again in the source code, you will note that in the implementation efforts were made to keep separated data to be plot from the actual drawing on the screen.
In conclusion, to do what you want, you will have to modify WinBGIm such that it manages correctly a drawing surface of variable dimensions and modify koolplot such that data to be shown is owned by (or aggregated with) Plotstream class.

9-patch for emulating card with full bleed look in the GDK?

I'm emulating the Card object due to its limitations in CardScrollView, and need a full bleed image with the text at the bottom. It looks like the standard Card has some 9-patch drawable or something doing the opacity shading in the background. Has anyone found it or made one for this purpose?
I had similar issue and ended up drawing transparent .png which fades at the bottom.
Some time later, I've looked into GlassHome.apk, which you can find on the github.
I found there these 3 images in drawable-hdpi folder.
Hope, they'll be useful to you:
overlay_large.png
overlay_medium.png
overlay_small.png

How to load a bmp without background

So, I was trying to make game in allegro but I'm currently stuck with this damn blank background which is making me very mad, as I know PNG images have transparency in the background already, but I can't load pngs, i have already download devpaks, installed libraries and stilll nothing good happened, if the best option for me is to use PNG so please tell me how to load then and use then correctly.
If the best option is still to use BMP and there is a algorithm, function or a little code which will make the blank background go away please tell me.
For those who didn't understand what I want there is a better explanation:
http://3.bp.blogspot.com/-r9BaUuMLirc/ThjzRHOMBKI/AAAAAAAAAJI/kUilPnIPJLg/s400/bola_azul.png
its currently in .png, but I transformed to .bmp in paint, so it makes me a blank background and in allegro it shows the whole picture, i want to have only the ball.
As you've commented, with Allegro 4, the color 0xFF00FF is treated as transparent when used with masked_blit() or draw_sprite().
To load PNGs in Allegro 4, you'll want to use loadpng with libpng. You can use the 8-bit alpha channel by enabling the alpha blender with set_alpha_blender().
If you're just starting out, you should be using Allegro 5, which has a modern API and native support for PNG files.

Cocos2D for Android textures disappear

Some times textures disappear from sprites. I have a sprite that appears with white color and it should have a texture on it and a label that should have a text in it an it appears with black color. The labels are subclasses of sprite so this problem is related to Sprites. Could some one tell me what is the problem ? Did some one meet this bug to in Cococs2D on Android ? Thank's !
I had such a problem when I was doing navigation from "outside" of cocos2d i.e. i relied on Android's native back button's callback to change scenes. Apparently this callback doesn't work on the same thread as cocos and causes this problem (maybe something with WeakReferences in the TextureCache). Hope it helps :)
Are you using pvr? When I tried using pvr I was getting what sounds like the same issues. I switched to png and it fixed the problem for me.

How to control a button using motion in opencv?

I want to control a button using hand motions. For example, in a video frame I create a circle-shaped button. Then when I move my hand to that circle I want to play an mp3 file, and when I move my hand to another circle the mp3 song stops playing. How can I do this?
i am working in windows7 OS and i use microsoft visual studio 2008 for work...
You have infinite options to do that. Probably the easiest is trying to do background segmentation and then check if there's anything which is not background that overlaps with the button area. It would work with any part of your body, not only your hands, but that might not be an issue.
Another option would be to try to detect and track your hands based on skin color. For this you need to obtain an histogram of the skin color and then use it with the camshift tracker. A nice way to obtain the skin color on runtime would be running a face detector (haarcascade) and getting the color from the detected region.
I'm sure there are hundreds of additional ways to do it.
Also, if you can get your hands on a Kinect camera it could help a lot. Check OpenNI and the MS Kinect SDK to see what it enables you to do.
The first thing you will have to do is create a haar cascade xml file and train it on human hands.