2 * Image Library -- Image contexts
4 * (c) 2006 Pavel Charvat <pchar@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
14 #include "images/images.h"
15 #include "images/error.h"
20 image_context_init(struct image_context *ctx)
22 bzero(ctx, sizeof(*ctx));
23 bb_init(&ctx->msg_buf);
24 ctx->tracing_level = image_trace;
25 ctx->msg_callback = image_context_msg_default;
29 image_context_cleanup(struct image_context *ctx)
31 IMAGE_TRACE(ctx, 10, "Destroying image thread");
32 bb_done(&ctx->msg_buf);
36 image_context_msg_default(struct image_context *ctx)
38 msg(ctx->msg_code >> 24, "%s", ctx->msg);
42 image_context_msg_silent(struct image_context *ctx UNUSED)
47 image_context_msg(struct image_context *ctx, uns code, char *msg, ...)
51 image_context_vmsg(ctx, code, msg, args);
56 image_context_vmsg(struct image_context *ctx, uns code, char *msg, va_list args)
59 ctx->msg = bb_vprintf(&ctx->msg_buf, msg, args);
60 ctx->msg_callback(ctx);