From 308177604bbf28979bd85f3a1d8f8349d20e5fae Mon Sep 17 00:00:00 2001 From: b Date: Sat, 5 Nov 2022 18:19:25 +0000 Subject: [PATCH] more towards general action --- core.c | 146 +++++++++++++++++++++++++++++++++--------------- core.h | 25 ++++++++- enhance | Bin 29160 -> 0 bytes info.c | 5 +- nofading.c | 25 ++++++++- testimg/4x4.png | Bin 0 -> 120 bytes 6 files changed, 149 insertions(+), 52 deletions(-) delete mode 100755 enhance create mode 100644 testimg/4x4.png diff --git a/core.c b/core.c index 93d9714..9b9f1ce 100644 --- a/core.c +++ b/core.c @@ -1,7 +1,7 @@ /* core.c The tool with multiple enhancements and manipulations of pictures -01.11.2022 +05.11.2022 Copyright (C) 2014, 2015, 2022 Balthasar Szczepański @@ -36,6 +36,9 @@ on Pentium III libdevil must be recompiled with uint_fast16_t n_pictures = 0; struct Picture * picture; +char LOAD_FAILED[] = "Failed to load picture.\n"; +char CREATE_FAILED[] = "Failed to create picture(s).\n"; + void init (void) { ilInit(); @@ -414,19 +417,20 @@ void get_info (uint_fast16_t id, struct IL_full_info *info) int action_1picture ( uint_fast16_t id, ILint x0, ILint y0, ILint width, ILint height, - void *function, + ACTION_F *function, FLAG_TYPE flags, - void *data + void *f_data ) { ILint x, y, z; ILint frames; - IL_full_info *info; - ILuint r, g, b, a, y, i; + struct IL_full_info info; + ILuint r, g, b, a, v, i; ILint line_bytes, line_start, frame_bytes; ILint frame_offset, line_offset, pixel_offset; - ILint r_offset, g_offset, b_offset, a_offset, y_offset, i_offset; + ILint r_offset, g_offset, b_offset, a_offset, v_offset, i_offset; void *data; + int re; flags &= ~(IS_GRAY|IS_INDEXED|IS_MULTIPLE|IS_OVER_8BIT|IS_PALETTE_ONLY); @@ -440,31 +444,30 @@ int action_1picture ( switch (info.image_format) { case IL_COLOUR_INDEX: - info_flag |= IS_INDEXED; + flags |= IS_INDEXED; switch (info.palette_type) { case IL_PAL_BGR32: case IL_PAL_RGB32: - info_flag |= IS_OVER_8BIT; + flags |= IS_OVER_8BIT; break; case IL_PAL_BGRA32: case IL_PAL_RGBA32: - info_flag |= HAS_ALPHA; + flags |= HAS_ALPHA; break; case IL_PAL_BGR24: case IL_PAL_RGB24: default: break; } - } case IL_LUMINANCE_ALPHA: - info_flag |= HAS_ALPHA; + flags |= HAS_ALPHA; case IL_LUMINANCE: - info_flag |= IS_GRAY; + flags |= IS_GRAY; break; case IL_BGRA: case IL_RGBA: - info_flag |= HAS_ALPHA; + flags |= HAS_ALPHA; case IL_BGR: case IL_RGB: default: @@ -476,11 +479,11 @@ int action_1picture ( case IL_UNSIGNED_BYTE: break; default: - info_flag |= IS_OVER_8BIT; + flags |= IS_OVER_8BIT; } frames = info.num_images; if (frames > 1) - info_flag |= IS_MULTIPLE; + flags |= IS_MULTIPLE; else if (frames < 1) frames = 1; @@ -495,7 +498,7 @@ int action_1picture ( height = info.image_height; } - line_bytes = info.bytes_per_pixel * info.image_width; + line_bytes = info.image_bytes_per_pixel * info.image_width; frame_bytes = line_bytes * info.image_height; if (info.origin_mode == IL_ORIGIN_UPPER_LEFT) @@ -516,7 +519,7 @@ int action_1picture ( g_offset = -1; b_offset = -1; a_offset = -1; - y_offset = -1; + v_offset = -1; i_offset = -1; switch (info.image_type) { @@ -541,7 +544,7 @@ int action_1picture ( case IL_LUMINANCE_ALPHA: a_offset = 4; case IL_LUMINANCE: - y_offset = 0; + v_offset = 0; break; case IL_COLOUR_INDEX: i_offset = 0; @@ -570,7 +573,7 @@ int action_1picture ( case IL_LUMINANCE_ALPHA: a_offset = 2; case IL_LUMINANCE: - y_offset = 0; + v_offset = 0; break; case IL_COLOUR_INDEX: i_offset = 0; @@ -599,7 +602,7 @@ int action_1picture ( case IL_LUMINANCE_ALPHA: a_offset = 1; case IL_LUMINANCE: - y_offset = 0; + v_offset = 0; break; case IL_COLOUR_INDEX: i_offset = 0; @@ -619,29 +622,27 @@ int action_1picture ( for ( y=y0, line_offset=frame_offset+line_start+(y0*line_bytes); y < y0 + height; - ++y, line_offset += line_bytes; + ++y, line_offset += line_bytes ){ if ((y>=0)&&(y=0)&&(x rgb + } + if ((flags & IS_GRAY) && (flags & CANNOT_BE_GRAY)) + { + r = v; + g = v; + b = v; + } + else if (!(flags & IS_GRAY) && (flags & MUST_BE_GRAY)) + { + y = (r+g+b)/3; + } + + re = function(x,y,z,&r,&g,&b,&a,&v,&i,flags,f_data); + if (re) + return re; //!!!!!!!! } } } @@ -675,8 +717,20 @@ int action_1picture ( } } -void action( +} +int action( ILint x, ILint y, ILint z, - ILuint *r, ILuint *g, ILuint *b, ILuint *a, ILuint *y, ILuint *i, + ILuint *r, ILuint *g, ILuint *b, ILuint *a, ILuint *v, ILuint *i, FLAG_TYPE flags, - void *data \ No newline at end of file + void *data +) +{ + printf( + "%04lu %04lu %04lu: %03lu %03lu %03lu %03lu %03lu %03lu\n", + (unsigned long)x, (unsigned long)y, (unsigned long)z, + (unsigned long)(*r), (unsigned long)(*g), (unsigned long)(*b), + (unsigned long)(*a), (unsigned long)(*v), (unsigned long)(*i) + ); + return 0; +} + diff --git a/core.h b/core.h index e8fed75..93a62b3 100644 --- a/core.h +++ b/core.h @@ -1,7 +1,7 @@ /* core.h The tool with multiple enhancements and manipulations of pictures -01.11.2022 +05.11.2022 Copyright (C) 2022 Balthasar Szczepański @@ -54,6 +54,8 @@ on Pentium III libdevil must be recompiled with #define IS_OVER_8BIT 0x4000 #define IS_PALETTE_ONLY 0x8000 +extern char LOAD_FAILED[]; +extern char CREATE_FAILED[]; struct Picture { uint_fast8_t open; @@ -88,6 +90,15 @@ struct IL_full_info { ILint version_num; }; +typedef int (ACTION_F)( + ILint x, ILint y, ILint z, + ILuint *r, ILuint *g, ILuint *b, ILuint *a, ILuint *v, ILuint *i, + FLAG_TYPE flags, void *data +); + + + + void finish (int const returnvalue, char const * const returntext); void init (void); @@ -100,3 +111,15 @@ int reserve_pictures (uint_fast16_t n); int convert_picture (uint_fast16_t id, FLAG_TYPE flags); int load_picture (uint_fast16_t id, char *path, FLAG_TYPE flags); void get_info (uint_fast16_t id, struct IL_full_info *info); + +int action_1picture ( + uint_fast16_t id, + ILint x0, ILint y0, ILint width, ILint height, + ACTION_F *function, + FLAG_TYPE flags, + void *f_data +); + + + +ACTION_F action; \ No newline at end of file diff --git a/enhance b/enhance deleted file mode 100755 index e4c44cd831eb429847e0f628e7483a142c07791a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29160 zcmeHwdw5jGdH3w@IlE_dM-oC8j29#>wm=ua1|xwbAp`<}Fc$}G?A1zIX&0}wvb4g0 z9Gm(c$8{if9h~qau0t+go-}b%oH`{o{!+*FlR7QL&ezm+YT2BR1 zb+pE5`aJ3L^bZe=W`6U&^Ugc(%$b=pXU^H%SF|*_TrQ!VN6ZmK|6&QT5Mf^oe+*$R z6anD}tyIh)y>IVyA+!gppf_yqMaaC`2athY(>e3qX=(Yub^#n;(uZ z_}=XHJ14gqKYEaISPo^8hmQQL7ail5!V^=c&xt^_Xl%HTX*1x<;2T!_>Rs{ug~t#7 z_KUYZ^U7yR{^jN^Q@5P_(ym)J)jkaJ$J~COO7e(w8QELK(pgr4SgN8D=i=`VWla4c zzA**=O$y$Vg8w`PKbnI7F$F)9g1?c1!zp;ofhQsUt^-qFZ%TdGH?$)?Glkx&i3mwg zq~Nz4nB_G&F!{?;Vcuc82@I-O+(WxPQ~y<*|5gcvGl778b!^ zcTc=GIFJbSCxSu6dQrw`Y(=lk5sfv5W8p-&xhK>e9uU!3b8j?(V0pZEN4P&BlK~r| zy`4I4lh%h~Ahg6oNy5r-Z&J+4aH6?45$+E6i||fJ>=s`EmJZ|c6hsU=jA6VXPT1idJABv<`w&jf z5@ILA$wJ)95R=AT45tclA46Oi4=|i2L-Lx_KvpLcC+`dHT39Jnt=I_-k)v4S!+SI`zz3 zEpuSR=fChq?#~~1qh;hLZ|QiWBVOx>FLcD`I^t!H_*6$c-x1Gn#0^LM{JHUR&p6`m zI^u6S;;%a5FFWEdI^xec;y-c34>{uBb;J)k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Gk$;W+EdaiwRxlE_O37+qMGtT{0dafB+E@e?Sy4~>Hjv*i4Bd2deT+1ULm$!Gq zldl1u`?2)TB2GTu9&5e_5T|^Q<$W9P-LO1OI$iF)NYQ-yUGjyxlAw`~{)-Mi?n6qS z+&>tv2k+~&Jl-GB+skrL#`(T#^Rd3X@1p;;R?5NmO~u!D2g1G6m8U%1DoLla`~ZmM zQXcPP={1dvI(`^&?mn~4<^5^pIE_iN4{c07-VgJ4>_+S~ z1X33DeHEVi$#Qw0hEA{-SUX+r>qyXiykFQ0zRzkVgt{KTL!5FckM}8=)faEycR{B- z_BlH8%~nzQmo)kh;UTL}CgRUR@GZ~)A$jO<_#+u7?grl;Mr^0~@>BSJ2fo{B&=kHv z3SU<}zP+d`30^I)B8Bg%6+-;8qho2lB`JJ+apChVNA0xel{TNY%fV~#{ZTfg?I=%s z_9^Xt{TUbuoo_l4cui1V4m__(M=@emScsSO#S0o`(M^JP@|9qK*r17^>FEClcANch diff --git a/info.c b/info.c index 3c3060c..023c35d 100644 --- a/info.c +++ b/info.c @@ -1,7 +1,7 @@ /* info.c Get information -01.11.2022 +05.11.2022 Copyright (C) 2022 Balthasar Szczepański @@ -34,7 +34,6 @@ on Pentium III libdevil must be recompiled with #include "info.h" char INFO_MISSING_ARGS[] = "Missing parameters.\ninfo inPix\n"; -char INFO_LOAD_FAILED[] = "Failed to load picture.\n"; void print_info_uint (char *name, long unsigned value) { @@ -176,7 +175,7 @@ int info (int argc, char **argv, char **err) r = create_pictures(1); if (r) { - *err = INFO_LOAD_FAILED; + *err = CREATE_FAILED; return r; } diff --git a/nofading.c b/nofading.c index 2079ce6..ab64505 100644 --- a/nofading.c +++ b/nofading.c @@ -1,7 +1,7 @@ /* nofading.c The tool to remove fading from an image -01.11.2022 +05.11.2022 Copyright (C) 2015, 2022 Balthasar Szczepański @@ -43,6 +43,7 @@ int nofading (int argc, char **argv, char **err) uint_fast16_t frame_l = 0; uint_fast16_t frame_r = 0; uint_fast8_t palette_only = 0; + int r; if (argc<2) { @@ -87,7 +88,27 @@ int nofading (int argc, char **argv, char **err) if ((frame_t==0) && (frame_b==0) && (frame_l==0) && (frame_r==0)) palette_only = OK_PALETTE_ONLY; - create_pictures(2); + r = create_pictures(1); + if (r) + { + *err = CREATE_FAILED; + return r; + } + + r = load_picture(0, argv[0], 0); + if (r) + { + *err = LOAD_FAILED; + return r; + } + + r = action_1picture ( + 0, + 0,0,0,0, + &action, + 0, + NULL + ); return 0; } diff --git a/testimg/4x4.png b/testimg/4x4.png new file mode 100644 index 0000000000000000000000000000000000000000..08c5812c57f5bcef3cbfefd8ac7fec29c91699ba GIT binary patch literal 120 zcmeAS@N?(olHy`uVBq!ia0vp^EFjFm1SHiab7}%9drud~5RU7NCJd+lGXnYl|Nqal z(Ba5!XUey2i|lhb`_a!sc`vht;iCtq&%~L_&R+X~>94GN_{^3|-(vy;15Mn;ULGq6 R(g12@@O1TaS?83{1OOz&B_aR- literal 0 HcmV?d00001 -- 2.30.2