Create a bmp of a string using a TTF file using C? - c

I have a new project assigned to me today. I need to load a TTF file and then write the specified string to a bitmap using that font. However, I do not have much information about the TTF structure. Is there any library specifically for this job?

I suggest you have a look at the SDL_ttf project. SDL is also a good start to build a small gfx app.
Here is also a useful tutorial aboud using SDL_ttf in OpenGL and rendering text as textures.

Related

Native PNG library on MacOSX (mavericks)

I need to build an application which can read PNG files. On MacOSX mavericks the libpng is not available anymore (see).
Is there any other way to read PNG file on MacOSX (Cocoa / Carbon Framework...). I'd rather stay with the native framework than download and compile a local libpng. I also need to read TIFF and JPEG files, so ideally the native framework would also allow me to read those ? I am using C programming.
I would expect that to be handled by the (aptly named) Image I/O framework. This page has example code on how to set up an "image source" and load an image from it. I don't think you need to care at the application level whether the image is PNG or not, the framework abstracts that out.

Graphics in C programming

How can I draw just a pixel in C programming?
I feel if I know this, I can build a whole lot of codes for drawing many objects line, circle etc.
I am using fedora 17 (linux) on intel chip.
Am I being too hopeful?
You can start with OpenGL.
Read this wiki page
install your suitable graphics driver from Here
Start programming
Do you want to draw pixel on a screen, or text file, or a picture format file (jpg, bmp)? If it's screen you would be better off using a library which allows you draw graphics such as SDL. If it's a text file, well there is not much to explain except to open a file and write to it. If it's picture format output there are other libraries out there that would create picture files for you. doing a quick search I found this: http://freeimage.sourceforge.net/
There's not a standard for graphics programming in C, it completely depends on what environment you are running in. If you're targeting Linux, then that usually means X11. Read up on Xlib, or a widgit library like Qt or Gtk.

Simple 2D graphics C library for windows with the following requirements?

I have come across a project where it is required to draw some 2D graphics on a form under Windows and to be able to perform the following tasks:
read image formats jpg, GIF, png, with transparency
monitor mouse and keyboard input to this form
draw simple 2D shapes, eg. line, ellipse, rectangle, pixel set/clear, polygons, ...
draw text with true font types and sizes and measure text sizes for different strings
written in C and can be integrated into Visual Studio 2008 C project
I've tried OpenCV but it lacks the transperency, font types, and GIF decoding and other things
I need your help please, It would be good if the library is easy to learn and use
thanks all
Sounds like a perfect job for SDL
And why not use the GDI built into Windows?
Traditional GDI documentation - http://msdn.microsoft.com/en-us/library/dd145203%28v=VS.85%29.aspx
Newer GDI+ documentation - http://msdn.microsoft.com/en-us/library/ms533798%28VS.85%29.aspx
Some more info added:
I guess I don't understand your requirements. Is cross platform support required? If yes, then use C and some of the cross platform libraries people have mentioned. If this is Windows only, then why not use the APIs that come with Windows?
Since your already using Visual Studio and you want ease of learning and development, why don't you use C# and the.NET libraries? In 2010, that is really the easiest way to build Windows only programs. Windows Forms will likely do everything you need. If you really must write in C and you are Windows only, then use GDI+ (or GDI if you need to support older versions of Windows). If you want to learn classic Windows C programming, go to the source - http://www.charlespetzold.com/pw5/.
As daddz said, you can use SDL for inputs, and image reading. In order to render your 2D primitives, OpenGL will do the work (be sure to create an OpenGL compatible window while calling SDL_CreateWindow). Concerning font rendering, it is not directly implemented in SDL but a couple of libraries can be used (see Survey Of OpenGL Font Technology).

How to generate thumbnail for some pages of a PDF file?

I want a C library for generating image snapshots of PDF files. Then I would use this to generate the thumbnail of the first page. Is there a library for this?
You could probably use one of the general-purpose PDF libraries:
Ghostscript - C, available under the GPL
Poppler - C++, available under the GPL
Adobe PDF Library SDK - expensive
Google reveals quite a few PDF-to-image converters which you may be able to incorporate if one of the above options doesn't work.
Check out Poppler --- a PDF rendering library based on the xpdf-3.0 code base. It comes with a tool to create images from PDF pages as well.

automate video capture

I have a bunch of short videos from my digital cam. i know how to convert them to a better codec with ffmpeg but i would also like to make a preview image for the video. Not a thumbnail that window does, something like media player classic which takes about 5-30 shots of the video. I was hoping MPC would be able to do it through cmd line but it doesnt.
What (command line) util can i use to do this or what lib (preferably c/c++) can i use to generate the images?
You could use a programmable automation tool, such as wintask, to do this using your exisiting manual apps.

Resources