/* * libcucul Unicode canvas library * Copyright (c) 2002-2006 Sam Hocevar * All Rights Reserved * * This library is free software; you can redistribute it and/or * modify it under the terms of the Do What The Fuck You Want To * Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */ /** \file export.c * \version \$Id: export_irc.c 384 2006-03-13 18:07:35Z sam $ * \author Sam Hocevar * \author Jean-Yves Lamoureux * \brief Export function * * This file contains export functions for SVG (Scalable Vector Graphics files */ #include "config.h" #if !defined(__KERNEL__) # include # include # include #endif #include "cucul.h" #include "cucul_internals.h" static char const *svg_header = "\n" "\n" " \n" " \n"); cur += sprintf(cur, "\n"); cur += sprintf(cur, "\n"); /* Background */ for(y=0; y<(int)(qq->height);y++) { uint8_t *lineattr = qq->attr + y * qq->width; for(x = 0; x < (int)qq->width; x++) { cur += sprintf(cur, "\n", lineattr[x], x*6, y*10); } } /* Text */ for(y=0; y<(int)(qq->height);y++) { uint8_t *lineattr = qq->attr + y * qq->width; uint32_t *linechar = qq->chars + y * qq->width; for(x = 0; x < (int)qq->width; x++) { cur += sprintf(cur, "%c\n", lineattr[x], x*6, (y*10)+10, linechar[x]); } } cur += sprintf(cur, "\n"); cur += sprintf(cur, "\n"); /* Crop to really used size */ ex->size = strlen(ex->buffer) + 1; ex->buffer = realloc(ex->buffer, ex->size); }