one.empty3.feature.ProxyValue3 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of empty3-library-3d Show documentation
Show all versions of empty3-library-3d Show documentation
3D rendering engine. Plus modelling. Expected glsl textures 3d and 2d rendering3D primitives, and a lot of scenes' samples to test.+ Game Jogl reworked, Calculator (numbers and vectors). Java code parser implementation starts (<=1.2)
The newest version!
/*
*
* * Copyright (c) 2024. Manuel Daniel Dahmen
* *
* *
* * Copyright 2024 Manuel Daniel Dahmen
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*
*/
package one.empty3.feature;
import one.empty3.io.ProcessFile;
import one.empty3.library.Point3D;
import javax.imageio.ImageIO;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ProxyValue3 extends ProcessFile {
public boolean process(File in, File out) {
if (!in.getName().endsWith(".jpg"))
return false;
PixM original = null;
try {
original = PixM.getPixM(ImageIO.read(in), maxRes);
} catch (Exception ex) {
ex.printStackTrace();
return false;
// assertTrue(false);
}
int p = 0;
PixM copy = original.copy();
for (int i = 0; i < original.columns; i++)
for (int j = 0; j < original.lines; j++)
if (copy.luminance(i, j) < 0.3) {
searchFromTo(original, copy, i, j, 0.1);
p++;
}
try {
ImageIO.write(copy.getImage(), "jpg", out);
} catch (Exception ex) {
ex.printStackTrace();
return false;
}
Logger.getAnonymousLogger().log(Level.INFO, "point " + p);
return true;
}
public void searchFromTo(
PixM original, PixM copy, int i, int j, double min) {
Point3D p = null;
int i2 = i, j2 = j;
/* for(int k=0; k -1; i3 += incr[(sq + 2)]) {
for (int j3 = incr[(sq + 1)]; j3 < incr[sq + 1] && pass > -1; j3 += incr[(sq + 3)]) {
pass++;
i2 = i + i3;
j2 = j + j3;
p = null;
if (original.luminance(i2, j2) >= min) {
copyPixel(original, i2,
j2,
copy, i, j);
return;
}
if (pass > 2 * l) pass = -1;
}
}
}
}
// Logger.getAnonymousLogger().log(Level.INFO, "error not found");
return;
}
public void copyPixel(PixM m1, int i, int j,
PixM m2, int i2, int j2) {
for (int c = 0; c < 3; c++) {
m1.setCompNo(c);
m2.setCompNo(c);
m2.set(i2, j2, m1.get(i, j));
}
}
}