/* jpeg-read.h
 * This file is part of Amsam photo cropping program
 * Copyright 2021, 2023, 2024, 2025, 2026 Nandakumar Edamana
 * Distributed under GNU General Public License, version 3
 */ 

#ifndef N96_DRAW_jpeg_read_h
#define N96_DRAW_jpeg_read_h

typedef struct ProxyDocument ProxyDocument;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "doc.h"
#include "jpeg.h"
#include "jpeglib.h"
#include <errno.h>
extern _Bool jpeg_log_enabled;
struct ProxyDocument {
	RawJpegDocument *rawdoc;
	ImageDocument *prevdoc;
};
void proxy_document_construct(ProxyDocument *this, ImageDocument *prevdoc);
void proxy_document_destruct(ProxyDocument *this);
ImageDocument * image_document_from_raw_jpeg_document(RawJpegDocument *jpegdoc, const char *path);
ImageDocument * image_document_from_raw_jpeg_document_low(RawJpegDocument *jpegdoc, int outw, int outh, double scl, int offxin, int offyin);
ProxyDocument * read_proxy_document_from_jpeg_fp(FILE *fp, const char *path);
RawJpegDocument * read_raw_jpeg_document_from_fp(FILE *fp, const char *path);
ProxyDocument * read_proxy_document_from_jpeg(const char *path);
void logjpeg(const char *path, const char *fmt, ...);
void perrorjpeg(const char *path, FILE *fp, const char *fmt, ...);

#endif /* N96_DRAW_jpeg_read_h */
