]> bicyclesonthemoon.info Git - ott/enhance/blobdiff - core.h
Online bluenh seems to work ok.
[ott/enhance] / core.h
diff --git a/core.h b/core.h
index 4dab0082b92a9eb9c2d1d3fd9b32b956b74d006f..999bf5ec9b30c0ed63b53b26ed1f008b0cded00d 100644 (file)
--- a/core.h
+++ b/core.h
@@ -1,7 +1,7 @@
  /*
 core.h
 The tool with multiple enhancements and manipulations of pictures
-15.11.2022
+03.12.2022
 
 Copyright (C) 2022  Balthasar SzczepaƄski
 
@@ -34,28 +34,32 @@ on Pentium III libdevil must be recompiled with
 
 #define FLAG_TYPE uint_fast32_t
 
-#define   MUST_HAVE_ALPHA   0x00001
-#define CANNOT_HAVE_ALPHA   0x00002
-#define   MUST_BE_GRAY      0x00004
-#define CANNOT_BE_GRAY      0x00008
-#define   MUST_BE_INDEXED   0x00010
-#define CANNOT_BE_INDEXED   0x00020
+#define   MUST_HAVE_ALPHA   0x000001
+#define CANNOT_HAVE_ALPHA   0x000002
+#define   MUST_BE_GRAY      0x000004
+#define CANNOT_BE_GRAY      0x000008
+#define   MUST_BE_INDEXED   0x000010
+#define CANNOT_BE_INDEXED   0x000020
 
-#define     OK_PALETTE_ONLY 0x00040
-#define    CAN_BE_MULTIPLE  0x00080
-#define    CAN_BE_OVER_8BIT 0x00100
+#define     OK_PALETTE_ONLY 0x000040
+#define    CAN_BE_MULTIPLE  0x000080
+#define    CAN_BE_OVER_8BIT 0x000100
 
-#define     IN_WINDOW       0x00200
+#define     IN_WINDOW       0x000200
 
-#define    HAS_ALPHA        0x00400
-#define     IS_GRAY         0x00800
-#define     IS_INDEXED      0x01000
-#define     IS_MULTIPLE     0x02000
-#define     IS_OVER_8BIT    0x04000
-#define     IS_PALETTE_ONLY 0x08000
+#define    HAS_ALPHA        0x000400
+#define     IS_GRAY         0x000800
+#define     IS_INDEXED      0x001000
+#define     IS_MULTIPLE     0x002000
+#define     IS_OVER_8BIT    0x004000
+#define     IS_PALETTE_ONLY 0x008000
 
-#define    NOT_WRITABLE     0x10000
-#define    NOT_READABLE     0x20000
+#define    NOT_WRITABLE     0x010000
+#define    NOT_READABLE     0x020000
+
+#define    EFF_ALPHA        0x040000
+#define    EFF_GRAY         0x080000
+#define    EFF_INDEXED      0x100000
 
 extern char NO_STR[];
 extern char INIT_FAILED[];
@@ -63,6 +67,11 @@ extern char LOAD_FAILED[];
 extern char SAVE_FAILED[];
 extern char CREATE_FAILED[];
 extern char CONVERT_FAILED[];
+extern char SIZE_MISMATCH[];
+extern char MULTIPLE_FORBIDDEN[];
+extern char INDEXED_REQUIRED[];
+extern char PALETTE_ONLY_REQUIRED[];
+extern char BAD_PALETTE_SIZE[];
 
 struct Picture {
        uint_fast8_t open;
@@ -117,6 +126,10 @@ struct IL_full_info {
 
 struct PixelInfo
 {
+       uint_fast16_t id;
+       ILuint handle;
+       ILuint frames;
+       
        ILint x0;
        ILint y0;
        ILint f0;
@@ -158,18 +171,27 @@ struct PixelInfo
        struct IL_full_info info;
 };
 
-typedef int (ACTION_F)(ILuint n, struct PixelInfo *info, void *data);
+struct ColorInfo
+{
+       ILuint red;
+       ILuint green;
+       ILuint blue;
+       ILuint value;
+       ILuint alpha;
+       ILuint index;
+};
 
 
+typedef int (ACTION_F)(ILuint n, struct PixelInfo *info, void *data);
 typedef int (SUBTOOL_F)(int argc, char **argv, int argi, char **err);
-       
-
-
 
 
 void finish (int const returnvalue, char const * const returntext);
 int init (void);
 ILuint get_handle (uint_fast16_t id);
+int get_data (uint_fast16_t id, void **data, ILuint frame);
+int get_palette (uint_fast16_t id, void *palette, ILuint frame);
+int set_palette (uint_fast16_t id, void *palette, ILuint size, ILenum type, ILuint frame);
 void create_picture (uint_fast16_t id);
 int create_pictures (uint_fast16_t n);
 void close_picture (uint_fast16_t id);
@@ -179,14 +201,23 @@ int reserve_pictures (uint_fast16_t n);
 void get_flags (struct IL_full_info *info, FLAG_TYPE *flags);
 int convert_picture (uint_fast16_t id, struct IL_full_info *info, FLAG_TYPE *flags);
 int load_picture (uint_fast16_t id, char *path, struct IL_full_info *info, FLAG_TYPE *flags);
+int load_picture_mem (uint_fast16_t id, const void *address, ILuint size, struct IL_full_info *info, FLAG_TYPE *flags);
 int save_picture (uint_fast16_t id, char *path, FLAG_TYPE flags);
 int build_picture (uint_fast16_t id, ILint width, ILint height, ILint frames, struct IL_full_info *info, FLAG_TYPE *flags);
-int build_picture_from_info (uint_fast16_t id, struct IL_full_info *info, FLAG_TYPE *flags);
+int build_picture_from_info (uint_fast16_t id, struct IL_full_info *reference_info, struct IL_full_info *info, FLAG_TYPE *flags);
 int get_info (uint_fast16_t id, struct IL_full_info *info, ILint frame);
 
 ILuint upscale_value (ILubyte x, ILint bytes);
 ILubyte downscale_value (ILuint x, ILint bytes);
 
+int perform_action_1picture_1pixel (
+       uint_fast16_t id,
+       ILint x, ILint y, ILint f,
+       ACTION_F *function,
+       FLAG_TYPE flags,
+       void *data
+);
+
 int perform_action_1picture (
        uint_fast16_t id,
        ILint x0, ILint y0, ILint f0,
@@ -206,5 +237,17 @@ int perform_action (
        void *data
 );
 
+int perform_action_palette_mix (
+       uint_fast16_t *id,
+       ACTION_F *function,
+       FLAG_TYPE *flags,
+       void *data
+);
+
+
 
-ACTION_F action;
\ No newline at end of file
+int copy_pixels (ILuint n, struct PixelInfo *p, void *data);
+ILuint copy_1p_alpha (ILint64 src, ILint64 dst, ILint64 alpha, ILint64 max);
+int fill_color (ILuint n, struct PixelInfo *p, void *data);
+int palette_mix_index (ILuint n, struct PixelInfo *p, void *data);
+ILuint tsqrt(ILuint s);