Compare commits
No commits in common. "56941f12153efb30e8177ae11bc15d286e63680e" and "9ca6acd176646cf8eed97ce0219319e593330a03" have entirely different histories.
56941f1215
...
9ca6acd176
48
Lib/essais.c
48
Lib/essais.c
@ -17,50 +17,6 @@
|
|||||||
#include "../tthimage.h"
|
#include "../tthimage.h"
|
||||||
#include "essais.h"
|
#include "essais.h"
|
||||||
|
|
||||||
/* ============================== */
|
|
||||||
int essai_draw_paint_rect(char *outga)
|
|
||||||
{
|
|
||||||
Image_Desc *img;
|
|
||||||
Image_Rect rect;
|
|
||||||
int foo, x, y;
|
|
||||||
|
|
||||||
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outga);
|
|
||||||
|
|
||||||
rect.x = 8; rect.y = 8;
|
|
||||||
rect.w = 6; rect.h = 6;
|
|
||||||
|
|
||||||
if (NULL==(img=Image_alloc(64, 32, 3))) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (x=0; x<img->width; x+=2) {
|
|
||||||
for (y=0; y<img->height; y+=2) {
|
|
||||||
Image_plotRGB(img, x, y, 200, 200, 200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foo = Image_draw_rect(img, &rect, 192, 128, 64);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, "%s: err %d draw rect\n", __func__, foo);
|
|
||||||
return foo;
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.x = 24;
|
|
||||||
foo = Image_paint_rect(img, &rect, 64, 128, 192);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, "%s: err %d paint rect\n", __func__, foo);
|
|
||||||
return foo;
|
|
||||||
}
|
|
||||||
|
|
||||||
foo = Image_TGA_save(outga, img, 0);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, "%s: err %d save '%s'\n", __func__, foo, outga);
|
|
||||||
return foo;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OLL_KORRECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* nouveau vacances de fevrier 2010 */
|
/* nouveau vacances de fevrier 2010 */
|
||||||
int Essayer_les_alphas(char *fname, int k)
|
int Essayer_les_alphas(char *fname, int k)
|
||||||
@ -990,9 +946,9 @@ return 0;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* 2023-09-30 this function need more work
|
|
||||||
*/
|
*/
|
||||||
int Test_copie_de_rectangles(char *nomsource)
|
int
|
||||||
|
Test_copie_de_rectangles(char *nomsource)
|
||||||
{
|
{
|
||||||
Image_Desc *source, *image, *finale;
|
Image_Desc *source, *image, *finale;
|
||||||
int foo, w, h, x, y;
|
int foo, w, h, x, y;
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* FALSECOLORS.C
|
|
||||||
*
|
|
||||||
* new: Wed Oct 4 07:32:36 UTC 2023
|
|
||||||
*
|
|
||||||
* see also calcluts.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "../tthimage.h"
|
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
|
||||||
/*::------------------------------------------------------------------::*/
|
|
||||||
int Image_gen_fc_lut(float maxval, int nbslots, RGB_map *plut)
|
|
||||||
{
|
|
||||||
int idx, ilut;
|
|
||||||
float fval;
|
|
||||||
|
|
||||||
fprintf(stderr, ">>> %s ( %f %d %p )\n", __func__, maxval, nbslots, plut);
|
|
||||||
|
|
||||||
/* RAZ de les luts */
|
|
||||||
memset(plut, 0, sizeof(RGB_map));
|
|
||||||
|
|
||||||
for (idx=0; idx<nbslots; idx++) {
|
|
||||||
fval = (float)idx / (float)nbslots;
|
|
||||||
ilut = (int)(fval*256.0);
|
|
||||||
fprintf(stderr, " %3d %8.6f %3d\n", idx, fval, ilut);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FULL_NUCKED;
|
|
||||||
}
|
|
||||||
/*::------------------------------------------------------------------::*/
|
|
||||||
/*::------------------------------------------------------------------::*/
|
|
78
Lib/foo.c
78
Lib/foo.c
@ -7,20 +7,6 @@
|
|||||||
#include "../tthimage.h"
|
#include "../tthimage.h"
|
||||||
|
|
||||||
/* ============================== */
|
/* ============================== */
|
||||||
|
|
||||||
int essai_false_colors(void)
|
|
||||||
{
|
|
||||||
int foo;
|
|
||||||
RGB_map luts;
|
|
||||||
|
|
||||||
foo = Image_gen_fc_lut(27e3, 33, &luts);
|
|
||||||
fprintf(stderr, "retour gen_fc_lut = %d\n", foo);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================== */
|
|
||||||
|
|
||||||
int essai_show_t16x24( char *text)
|
int essai_show_t16x24( char *text)
|
||||||
{
|
{
|
||||||
if (NULL != text)
|
if (NULL != text)
|
||||||
@ -42,25 +28,69 @@ foo = Image_plot_V_gradient("foo.tga", 900, 200);
|
|||||||
fprintf(stderr, "plot v gradient -> %d\n", foo);
|
fprintf(stderr, "plot v gradient -> %d\n", foo);
|
||||||
}
|
}
|
||||||
/* ============================== */
|
/* ============================== */
|
||||||
|
int essai_draw_paint_rect(char *outga)
|
||||||
|
{
|
||||||
|
Image_Desc *img;
|
||||||
|
Image_Rect rect;
|
||||||
|
int foo, x, y;
|
||||||
|
|
||||||
|
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outga);
|
||||||
|
|
||||||
|
rect.x = 8; rect.y = 8;
|
||||||
|
rect.w = 6; rect.h = 6;
|
||||||
|
|
||||||
|
if (NULL==(img=Image_alloc(64, 32, 3))) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (x=0; x<img->width; x+=2) {
|
||||||
|
for (y=0; y<img->height; y+=2) {
|
||||||
|
Image_plotRGB(img, x, y, 200, 200, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foo = Image_draw_rect(img, &rect, 192, 128, 64);
|
||||||
|
if (foo) {
|
||||||
|
fprintf(stderr, "%s: err %d draw rect\n", __func__, foo);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.x = 24;
|
||||||
|
foo = Image_paint_rect(img, &rect, 64, 128, 192);
|
||||||
|
if (foo) {
|
||||||
|
fprintf(stderr, "%s: err %d paint rect\n", __func__, foo);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
foo = Image_TGA_save(outga, img, 0);
|
||||||
|
if (foo) {
|
||||||
|
fprintf(stderr, "%s: err %d save '%s'\n", __func__, foo, outga);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OLL_KORRECT;
|
||||||
|
}
|
||||||
|
/* ============================== */
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "*** %s is running\n", argv[0]);
|
fprintf(stderr, "*** %s is running\n", argv[0]);
|
||||||
|
|
||||||
if (argc > 1) {
|
essai_gradients();
|
||||||
fprintf(stderr, "argument: %s\n", argv[1]);
|
|
||||||
Image_print_version(0);
|
#if 0
|
||||||
Image_print_sizeof_structs("foo");
|
Image_print_version(2);
|
||||||
}
|
Image_print_sizeof_structs("foo");
|
||||||
else {
|
|
||||||
essai_false_colors();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
foo = essai_show_t16x24(NULL);
|
foo = essai_show_t16x24(NULL);
|
||||||
fprintf(stderr, "essai show t16x24 --> %d\n", foo);
|
fprintf(stderr, "essai show t16x24 --> %d\n", foo);
|
||||||
*/
|
|
||||||
|
foo = essai_draw_paint_rect("foo.tga");
|
||||||
|
fprintf(stderr, "essai draw rect --> %d\n", foo);
|
||||||
|
|
||||||
|
Image_egalise_cos01(NULL, NULL, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
23
Lib/op2x2.c
23
Lib/op2x2.c
@ -184,7 +184,7 @@ int dy[4] = { 0, 0, 1, 1 };
|
|||||||
for (y=0; y<src->height-1; y+=2) {
|
for (y=0; y<src->height-1; y+=2) {
|
||||||
for (x=0; x<src->width-1; x+=2) {
|
for (x=0; x<src->width-1; x+=2) {
|
||||||
for (foo=0; foo<4; foo++) {
|
for (foo=0; foo<4; foo++) {
|
||||||
bar = (foo+rot)%4; /* XXX ? */
|
bar = (foo+rot)%4;
|
||||||
r = (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
r = (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
||||||
g = (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
g = (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
||||||
b = (src->Bpix[y+dy[foo]])[x+dx[foo]];
|
b = (src->Bpix[y+dy[foo]])[x+dx[foo]];
|
||||||
@ -198,4 +198,25 @@ for (y=0; y<src->height-1; y+=2) {
|
|||||||
return FUNC_IS_BETA;
|
return FUNC_IS_BETA;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
int Image_2x2_shiftUL(Image_Desc *src, Image_Desc *dst)
|
||||||
|
{
|
||||||
|
int foo;
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "this func (%s) is a kluge\n", __func__);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
|
fprintf(stderr, "%s: err compare %d\n", __func__, foo);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1er septembre 2008: je n'ai pas la moindre idee de ce que j'ai
|
||||||
|
* voulu faire ici :) */
|
||||||
|
|
||||||
|
/* 26 novembre 2009: j'arrive pas a me rappeler du pourquoi de
|
||||||
|
* ce que doit faire cette fonction */
|
||||||
|
|
||||||
|
return FULL_NUCKED;
|
||||||
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
@ -450,9 +450,13 @@ int set_new_seed(int k)
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
long seed;
|
long seed;
|
||||||
|
|
||||||
|
#if DEBUG_MESSAGE
|
||||||
|
if (k) fprintf(stderr, "%s: k %d\n", __func__, k);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (NULL==(ptr=getenv("FIXED_SEED"))) {
|
if (NULL==(ptr=getenv("FIXED_SEED"))) {
|
||||||
/* no fixed seed in context, doing semi-random */
|
/* no fixed seed in context, doing semi-random */
|
||||||
srand(getpid() + k);
|
srand(getpid());
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "no FIXED_SEED, first rand is number : %d\n", rand());
|
fprintf(stderr, "no FIXED_SEED, first rand is number : %d\n", rand());
|
||||||
#endif
|
#endif
|
||||||
@ -460,6 +464,10 @@ if (NULL==(ptr=getenv("FIXED_SEED"))) {
|
|||||||
else {
|
else {
|
||||||
/* try to parse the env var */
|
/* try to parse the env var */
|
||||||
seed = strtol(ptr, NULL, 0);
|
seed = strtol(ptr, NULL, 0);
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, "%s : strtol(%s) -> %ld\n",
|
||||||
|
__func__, ptr, seed);
|
||||||
|
#endif
|
||||||
srand(seed);
|
srand(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ fprintf(stderr, "* tga_applymap v 0.0.14 [%s] (dwtfywl) Krabulator 1910\n",
|
|||||||
fprintf(stderr, " compiled %s at %s\n", __DATE__, __TIME__);
|
fprintf(stderr, " compiled %s at %s\n", __DATE__, __TIME__);
|
||||||
|
|
||||||
fprintf(stderr, "Usage:\n\ttga_applymap M src.tga color.map dst.tga\n");
|
fprintf(stderr, "Usage:\n\ttga_applymap M src.tga color.map dst.tga\n");
|
||||||
fprintf(stderr, " M is 1 (color mode) or 2 (gray mode)\n");
|
fprintf(stderr, " M is 1 or 2\n");
|
||||||
if (flag) Image_print_version(0);
|
if (flag) Image_print_version(0);
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user