kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

image.c (1293B)


      1 #include <kit/image.h>
      2 #include <kit/object.h>
      3 
      4 #include "core/diag.h"
      5 #include "obj/image.h"
      6 
      7 KitStatus kit_image_emit(const KitContext* ctx, KitObjFile* obj,
      8                          const KitSlice* object_bytes,
      9                          const KitImageOptions* opts, KitWriter* out,
     10                          KitImageReport* report_out) {
     11   return obj_emit_image(ctx, obj, object_bytes, opts, out, report_out);
     12 }
     13 
     14 KitStatus kit_image_emit_bytes(const KitContext* ctx, KitSlice name,
     15                                const KitSlice* object_bytes,
     16                                const KitImageOptions* opts, KitWriter* out,
     17                                KitImageReport* report_out) {
     18   KitObjFile* obj = NULL;
     19   KitStatus st;
     20   if (!ctx || !object_bytes || !out) return KIT_INVALID;
     21   st = kit_obj_open(ctx, name, object_bytes, &obj);
     22   if (st != KIT_OK) {
     23     kit_ctx_diagf(ctx, "image: %.*s is not a recognized object or linked image",
     24                   KIT_SLICE_ARG(name));
     25     return st;
     26   }
     27   st = obj_emit_image(ctx, obj, object_bytes, opts, out, report_out);
     28   kit_obj_free(obj);
     29   return st;
     30 }
     31 
     32 bool kit_image_segment_selected(KitObjFmt fmt, const KitObjSegInfo* seg,
     33                                 const KitImageOptions* opts) {
     34   return obj_image_segment_selected(fmt, seg, opts);
     35 }