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 log(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, ...)
52 ctx->msg = bb_vprintf(&ctx->msg_buf, msg, args);
54 ctx->msg_callback(ctx);
58 image_context_vmsg(struct image_context *ctx, uns code, char *msg, va_list args)
61 ctx->msg = bb_vprintf(&ctx->msg_buf, msg, args);
62 ctx->msg_callback(ctx);