# include "Ximage.h"

bDrawBuffer *bDrawIt () {

  int i, Nsection;
  bDrawBuffer *buffer;
  bDrawColor black;
  Graphic *graphic;
  Section *section;

  graphic = GetGraphic();

  black = KapaColorByName ("black");

  buffer = bDrawBufferCreate (graphic->dx, graphic->dy);
  bDrawSetBuffer (buffer);
  bDrawSetStyle (black, 0, 0);
  
  // reset the sizes for all sections
  Nsection = GetNumberOfSections ();
  for (i = 0; i < Nsection; i++) {
      section = GetSectionByNumber (i);
      bDrawGraph (section->graph);
      // bDrawImage (section->image);
  }

  return (buffer);
}

void bDrawGraph (KapaGraphWidget *graph) {
  if (graph == NULL) return;
  bDrawFrame (graph); 
  bDrawObjects (graph);
  bDrawLabels (graph);
  bDrawTextlines (graph);
}
