Browse Source

Set orientation

Martijn Braam 1 year ago
parent
commit
4f5bfe4293
2 changed files with 30 additions and 1 deletions
  1. 18 0
      include/libdng.h
  2. 12 1
      src/libdng.c

+ 18 - 0
include/libdng.h

@@ -23,6 +23,15 @@ typedef struct {
 		uint8_t cfapattern[4];
 } libdng_info;
 
+#define LIBDNG_ORIENTATION_TOPLEFT 1
+#define LIBDNG_ORIENTATION_TOPRIGHT 2
+#define LIBDNG_ORIENTATION_BOTRIGHT 3
+#define LIBDNG_ORIENTATION_BOTLEFT 4
+#define LIBDNG_ORIENTATION_LEFTTOP 5
+#define LIBDNG_ORIENTATION_RIGHTTOP 6
+#define LIBDNG_ORIENTATION_RIGHTBOT 7
+#define LIBDNG_ORIENTATION_LEFTBOT 8
+
 EXPORT int
 libdng_init();
 
@@ -41,6 +50,15 @@ libdng_set_mode_from_pixfmt(libdng_info *dng, uint32_t pixfmt);
 EXPORT int
 libdng_set_make_model(libdng_info *dng, const char *make, const char *model);
 
+EXPORT int
+libdng_set_datetime(libdng_info *dng, struct tm time);
+
+EXPORT int
+libdng_set_datetime_now(libdng_info *dng);
+
+EXPORT int
+libdng_set_orientation(libdng_info *dng, uint16_t orientation);
+
 EXPORT int
 libdng_write(libdng_info *dng, const char *path, unsigned int width, unsigned int height, const uint8_t *data,
 	size_t length);

+ 12 - 1
src/libdng.c

@@ -124,7 +124,18 @@ libdng_set_datetime_now(libdng_info *dng)
 }
 
 int
-libdng_write(libdng_info *dng, const char *path, unsigned int width, unsigned int height, const uint8_t *data, size_t length)
+libdng_set_orientation(libdng_info *dng, uint16_t orientation)
+{
+	if (dng == NULL)
+		return 0;
+
+	dng->orientation = orientation;
+	return 1;
+}
+
+int
+libdng_write(libdng_info *dng, const char *path, unsigned int width, unsigned int height, const uint8_t *data,
+	size_t length)
 {
 	TIFF *tif = TIFFOpen(path, "w");
 	if (!tif) {