QImage -> Autotrace



  • Guten Tag,

    Gerne möchte ich ein QImage ( aus QT 3 ) direkt in eine Vektorgraphik via Autotrace umwandeln.
    Dazu folgender Code:

    QImage image = (_is->getImage(_frame)).swapRGB();  // RGBA <-> BGRA
    
    	FILE * svgout = fopen("out.pdf", "w+");
    
    	at_fitting_opts_type * fitting_opts = at_fitting_opts_new();
    	at_bitmap_type * pixelImage;
    	at_splines_type * splines;
    	at_output_write_func wfunc = at_output_get_handler_by_suffix("pdf");
    
    	//set options
    //	fitting_opts->color_count = (unsigned int) 5;
    
    	int bitsPerPixel = image.depth();
    	int planes = bitsPerPixel / 8; // on each plane is one byte
    	pixelImage = at_bitmap_new(image.width(),image.height(),planes);
    	pixelImage->bitmap = image.bits();
    
    	splines = at_splines_new(pixelImage, fitting_opts, NULL,NULL);
    
    	at_splines_write(wfunc, svgout, "",NULL, splines, NULL, NULL);
    
    	fclose(svgout);
    

    So klappt das Ganze. Wenn ich aber Optionen setze, also z.B. die auskommentierte Zeile in den Code einbinde stürzt das Programm ab.

    Hat jemand ein Ahnung woran das liegen kann?
    Ich bin grundsätzlich neu in der Programmierung mit C++ / QT. Also vielleicht mache ich auch etwas Grundlegendes falsch.

    Vielen Dank für eure Hilfe.



  • Japp, tust du - du hast z.Bsp. im falschen Forum gepostet ^^



  • was steht den in der doku was color_count bedeutet?



  • in der doku steht:

    color-count <unsigned>: number of colors a color bitmap is reduced to, \
    it does not work on grayscale, allowed are 1..256; \
    default is 0, that means not color reduction is done.



  • Dieser Thread wurde von Moderator/in evilissimo aus dem Forum C++ in das Forum Andere GUIs - Qt, GTK+, wxWidgets verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.


Anmelden zum Antworten