How to open and modify png in C++ [closed] - c++

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
How to, display png (generally images beside .bmp) get it's depth, color(r,g,b) of a particular pixels(x,y) and how to change exactly one pixel then save the image. I could not find any simple example of that. Please show any sample
No 3rd party libraries, any please.

The PNG format is relatively simple, but not so simple as BMP. For one thing, it includes ZLIB compression. To encode/decode it you either need to use a PNG library like libpng plus a zlib library. If you don't want to use "third party" libraries (use only the standard libraries) you'd need to write quite a lot of code; you'll end rewriting the libpng/zlib libraries, almost; I doubt you'd really want to do that.
I myself wrote a PNG coder/decoder in Java/C# (PNGJ), but I relied on external ZLIB libraries (it's included in standard Java JRE)

Note that C++ isn't Java, or Python or somesuch. C++ internal libraries are mostly concerned with raw data handling, and leave more specific features to third parties. That is the very concept of C++ (and C, too).
Asking for a "purely internal" implementation of PNG (or "generally pictures beside .bmp") is, therefore, downright silly. You would need a different function for each specific picture format, usually including decompression, and since third-party libraries for that specific purpose are readily available, asking people to re-implement them is a bit... weird.

Related

C++ Game Sound Effects [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Is it possible to load in a wav file and play in during a game that's been written in C++ without the use of third party libraries?
I mean, is there a small function that can handle this?
Some third party libraries seem to use huge amounts of code to do it. I found the same thing when loading images. Some libraries use so much code when sometimes it's possible to do the same amount of work in a small function... I just wondered if it was the same for audio files?
If not, what are the best/most basic Audio libraries that you guys know of?
C++ by itself has no concept of multimedia. Unless you write your own multimedia code, then you have to use libraries or platform-specific APIs for working with multimedia content and output. For instance, on Windows, the simpliest option is the Win32 API PlaySound() function.
Let me answer your questions one at a time.
Is it possible to LOAD a wav file without using 3rd party lib.?
Yes, certainly it is. A quick search brings up: http://home.foni.net/~wkurz/dynaplot/applicationnotes/loadwav.htm
Is it possible to PLAY a wav file without using 3rd party lib.?
Again, yes it is possible. Provided you are willing to write drivers for all possible combinations of hardware and OSs you are targetting.
Allow me to suggest a solution: use some opensource lib. There are many excellent ones out there. I use following for my (non-gaming apps)
Loading wav: libsndfile
Playing wav: portaudio
hope that helps

Easy to use PNG lib? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Could someone recommend me a simple, easy to use PNG library either for c++ or .NET? All it needs to do is: load big PNG images (say 20000x20000), and tell me what color each pixel has.
Bitmap class in .NET can't load big images, throws an OutOfMemory exception.
I spent reasonable time on google looking through c++ libs, but all of them does much more than I need, and their usage is too complicated for me.
The defacto standard library for PNG files is LibPNG. It's not the best designed API in the world, but if you just work through the steps in one of their tutorials, it's pretty hard to mess up.
You'll probably find it easiest to wrap their API in a few simple functions (or class) of your own. Once you have that done, you should be good to go.
Try this:
http://nothings.org/stb_image.c
You can use it instead of zlib aswell.
If C# is an option, try PNGCS. It was done (by myself, in Java originally) for this scenario, it allows you to read and write line by line, no need to have all data in memory.
I have tested that it can read and write huge files (30000 x 30000 pixels, more than 2GB in disk), at least in Java
For C++:
Depending on the license you are able to use you may have a look at:
DeVIL: http://openil.sourceforge.net/(a bit outdated but a still good choice) (Linux, Win)
ImageMagick: http://www.imagemagick.org/script/index.php (well maintained, all platforms)
both support a variety of input and output formats.
EDIT: now also on Github: https://github.com/DentonW/DevIL

C++ Libraries to parsing [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm doing a software to generate animations for algorithms. These algorithms are written in an interpreted language, near to C (more or less a C-oriented pseudocode). Thus, my program must interprets algorithms written in these language. Also, this language will be incremented all the time to support more and more features. The key issue here is to search an library allowing increase the language easily and making easy integrate different parsers in the same program. The app is written in C++ licensed under GPL.
A object-oriented parser is my target solution indeed. I need help to choose a good library with this purposes. Also it's desirable the library is multiplataform and available in official repositories of commons distributions: Ubuntu, Suse and so on.
Actually, I know more or less well the next two libraries/tools:
Flex/Bison++: Both are Flex/Bison wrappers that allow generate C++ code instead of C code, and choose a name for your class. Problems: if you install Flex/Bison++, Flex/Bison are overwritten. I don't want to complicate users if they want compile my code. Moreover, CMake fails search the version number of the library. This can be solved manually, but isn't elegant.
Boost.Spirit: It doesn't have the previous problems and match with all desirable features I described above. But, I've read it isn't fine to parse big languages and to solve grammar ambiguities. Moreover, the compilation times are enormous. But, I love it can compose grammars in a constructive manner. This is very important to make the code/language/programm extensible.
What is your recommendation?

Should one use built in classes? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I've started programming C++ and I want to start programming useful stuff.
I know that for strings, one can use std::string or char-arrays. One can also use std::vectors as well, instead of arrays.
What should one do? Reinvent the wheel, or use the built in utilities?
The point of the question is to find out what people actually do. Do people use the STL a lot or do people use char[] instead of std::string?
Reinventing the wheel can be good as a training assignment, but If you want to write useful stuff - of course use the standard library ("the built in utilities").
The standard library (as well as boost, and other libraries) is validated and optimized, and it will let you write the useful stuff much easier, so you can focus on your logic instead of reinventing the wheel.
Always use standard libraries (STLs, Boost, etc) unless there is a reason for doing otherwise (e.g STL not available on platform). These libraries are time tested for both correctness and performance
If your goal is to program useful and stable software, use the standard libraries.
If your goal is to explore a specific topic, such as strings, then reinvent the string class and learn from your mistakes.
Usse the built in utilities. They are optimized and will ensure that your code is fully portable!
Note that you should use them skillfully: vectors can be rendered WAY faster if you reserve space before using them, etc.

What is the best library to manage a wiimote? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
There are many libraries that manage the wiimote but I am looking for the "best" one, or at least that has the following features:
open-source
portable (at least Win32 and Linux)
written and usable in c or c++
good coverage of wiimote devices
I rely on people that already used such library. Google is good source of information but it doesn't know which one is best library.
if you will use multiple wiimotes, don't use wiiuse library. i am working on a stereo system with two wiimotes using wiiuse library but wiiuse made me crazy( it gives delayed ir tracking data ) and i decided to change my library wiiuse from wiiyourself
Some friends of mine have had good luck with wiiuse. It's in C, for both Windows and Linux.
Have you seen this:
http://www.codeplex.com/WiimoteLib
http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx
It may not be exactly what you are asking for, but with Mono you'll have the cross platform part of it.
What about Johnny Chung Lee - it's .Net but it's open source and could converted.
I think this might be what your looking for:
http://wiiuse.sourceforge.net/
Open-sourced, multi-platform and written in C/C++. They are looking for a OSX developper though, so I'm guessing it doesn't support it yet.
Maybe https://github.com/MJL85/wiiuse will do? Seems to have a lot of features and supports Windows and Linux, AND it is c.