あなたは、CまたはC++グラフィックスライブラリを選択する必要があります。 QtとSDLの2つの選択肢があります。
============================================== ===========================
にあなたが望むすべての画像を描画する場合には、別の選択肢がlibGDである(前述と一緒にQtおよびSDL)。私は後でこれを達成するためにOpenImageIOを使用
https://cs.marlboro.edu/code/c/GD_example/GD_example.c
include <stdio.h>
#include <gd.h>
// Dimensions of image in pixels
#define IMAGE_WIDTH 300
#define IMAGE_HEIGHT 300
// The data to display is in a DATA_SIZE x DATA_SIZE array,
// which will have its (left,top)=(x,y) corner at
// (DATA_TOP, DATA_LEFT) pixels in from the (0,0)=(left,top) pixel.
#define DATA_SIZE 8
#define DATA_LEFT 30
#define DATA_TOP 30
// Position of some blue lines drawn in the image.
#define BORDER 10
#define LEFT BORDER
#define RIGHT IMAGE_WIDTH - BORDER
#define TOP BORDER
#define BOTTOM IMAGE_HEIGHT - BORDER
// See the bottom of this code for a discussion of some output possibilities.
char* filename = "GD_example.png";
// Some values that'll go into the image as shades of gray.
// Range is 0 to 255 (i.e. 8 bits, which is the standard range of intensity).
// To do this sort of thing with floating point data or other data,
// you'd first scale your numbers to be in this 0 to 255 range.
int data[DATA_SIZE][DATA_SIZE] ={
{ 2, 10, 10, 10, 10, 10, 10, 2},
{ 10, 20, 30, 40, 40, 30, 20, 10},
{ 10, 30, 100, 100, 100, 100, 30, 10},
{ 10, 40, 100, 200, 200, 100, 40, 10},
{ 10, 30, 100, 200, 200, 100, 30, 10},
{ 10, 20, 100, 100, 100, 100, 20, 10},
{ 10, 10, 20, 30, 40, 30, 10, 10},
{ 2, 10, 10, 10, 10, 10, 10, 2}
};
int main(){
FILE* outfile; // defined in stdio
gdImagePtr image; // a GD image object
int white, blue, gray[255]; // some GD colors
int i, x, y; // array subscripts
printf("=== GD example ===\n");
printf("Creating %i by %i image.\n", IMAGE_WIDTH, IMAGE_HEIGHT);
image = gdImageCreate(IMAGE_WIDTH, IMAGE_HEIGHT);
// Or image = gdImageCreateTrueColor(IMAGE_WIDTH, IMAGE_HEIGHT);
// followed by colors like white=gdTrueColor(255,255,255) that don't
// need to refer to any one image's color table.
white = gdImageColorAllocate(image, 255,255,255); // 1st is background
blue = gdImageColorAllocate(image, 0,0,255); // (red,green,blue)
for (i=0; i<255; i++){
gray[i] = gdImageColorAllocate(image, i,i,i);
}
printf("Drawing some blue lines.\n");
gdImageLine(image, LEFT,TOP, RIGHT,TOP, blue); // draw lines in image
gdImageLine(image, RIGHT,TOP, RIGHT,BOTTOM, blue); // +-----------------+
gdImageLine(image, RIGHT,BOTTOM, LEFT,BOTTOM, blue); // |0,0 WIDTH,0|
gdImageLine(image, LEFT,BOTTOM, LEFT,TOP, blue); // |0,HEIGHT |
// +-----------------+
printf("Filling in some gray pixels.\n");
for (x=0; x<DATA_SIZE; x++){ // fill some grayscale
for (y=0; y<DATA_SIZE; y++){ // colors from data.
gdImageSetPixel(image, x+DATA_LEFT, y+DATA_TOP, gray[data[x][y]]);
}
}
// Finally, write the image out to a file.
printf("Creating output file '%s'.\n", filename);
outfile = fopen(filename, "wb");
gdImagePng(image, outfile);
fclose(outfile);
}
おそらく 'cairo'は価値があります:http://zetcode.com/gfx/cairo/ – Galik