Compare commits

...

13 Commits
main ... dev

9 changed files with 226 additions and 129 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false"> <fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<fileset name="all" enabled="true" check-config-name="Ewol" local="false"> <fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
<file-match-pattern match-pattern="." include-pattern="true"/> <file-match-pattern match-pattern="." include-pattern="true"/>
</fileset> </fileset>
</fileset-config> </fileset-config>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-etk">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scenarium-logger">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="out/eclipse/classes"/>
</classpath>

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/__pycache__/
/bin/ /bin/
/Operator/ /Operator/
/DrawerProperties/ /DrawerProperties/

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>atriasoft-egami</name>
<comment></comment>
<projects>
<project>atriasoft-egami</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,64 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
import realog.debug as debug
import lutin.image as image
import os
import lutin.multiprocess as lutinMultiprocess
def get_type():
return "LIBRARY_DYNAMIC"
def get_desc():
return "Ewol Tool Kit"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "org"
def get_compagny_name():
return "atria-soft"
#def get_maintainer():
# return "authors.txt"
#def get_version():
# return "version.txt"
def configure(target, my_module):
my_module.add_src_file([
'src/module-info.java',
'src/org/atriasoft/egami/ImageByteMono.java',
'src/org/atriasoft/egami/ImageFloatMono.java',
'src/org/atriasoft/egami/ImageByte.java',
'src/org/atriasoft/egami/ImageFloatRGB.java',
'src/org/atriasoft/egami/ImageByteRGB.java',
'src/org/atriasoft/egami/internal/LOGGER.java',
'src/org/atriasoft/egami/ImageFloat.java',
'src/org/atriasoft/egami/Image.java',
'src/org/atriasoft/egami/ImageType.java',
'src/org/atriasoft/egami/Egami.java',
'src/org/atriasoft/egami/ImageByteRGBA.java',
'src/org/atriasoft/egami/ToolImage.java',
'src/org/atriasoft/egami/ImageFloatRGBA.java',
])
my_module.add_path('src/', type='java')
my_module.add_depend([
'org-atriasoft-etk'
])
#my_module.add_path([
# 'lib/spotbugs-annotations-4.2.2.jar'
# ],
# type='java',
# export=True
#);
my_module.add_flag('java', "RELEASE_15_PREVIEW");
return True

123
pom.xml Normal file
View File

@ -0,0 +1,123 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.atriasoft</groupId>
<artifactId>egami</artifactId>
<version>0.1.0</version>
<properties>
<maven.compiler.version>3.13.0</maven.compiler.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.dependency.version>3.1.1</maven.dependency.version>
</properties>
<repositories>
<repository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</repository>
<snapshotRepository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>etk</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.0-M2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.1.0-alpha1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test/src</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<!--<encoding>${project.build.sourceEncoding}</encoding>-->
</configuration>
</plugin>
<!-- Create the source bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- junit results -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!-- Java-doc generation for stand-alone site -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
</configuration>
</plugin>
</plugins>
</build>
<!-- Generate Java-docs As Part Of Project Reports -->
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>public</show>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -4,6 +4,7 @@
open module org.atriasoft.egami { open module org.atriasoft.egami {
exports org.atriasoft.egami; exports org.atriasoft.egami;
requires transitive org.atriasoft.etk; requires transitive org.atriasoft.etk;
requires transitive io.scenarium.logger; //requires transitive org.atriasoft.reggol;
} }

View File

@ -3,7 +3,7 @@ package org.atriasoft.egami;
public class ToolImage { public class ToolImage {
public static ImageByte convertImageByte(final ImageFloat input) { public static ImageByte convertImageByte(final ImageFloat input) {
if (input.hasAlpha()) { if (input.hasAlpha()) {
ImageByte out = new ImageByteRGBA(input.getHeight(), input.getWidth()); ImageByte out = new ImageByteRGBA(input.getWidth(), input.getHeight());
for (int xxx = 0; xxx < input.getWidth(); ++xxx) { for (int xxx = 0; xxx < input.getWidth(); ++xxx) {
for (int yyy = 0; yyy < input.getHeight(); ++yyy) { for (int yyy = 0; yyy < input.getHeight(); ++yyy) {
out.setRByte(xxx, yyy, input.getRByte(xxx, yyy)); out.setRByte(xxx, yyy, input.getRByte(xxx, yyy));
@ -14,7 +14,7 @@ public class ToolImage {
} }
return out; return out;
} }
ImageByte out = new ImageByteRGB(input.getHeight(), input.getWidth()); ImageByte out = new ImageByteRGB(input.getWidth(), input.getHeight());
for (int xxx = 0; xxx < input.getWidth(); ++xxx) { for (int xxx = 0; xxx < input.getWidth(); ++xxx) {
for (int yyy = 0; yyy < input.getHeight(); ++yyy) { for (int yyy = 0; yyy < input.getHeight(); ++yyy) {
out.setRByte(xxx, yyy, input.getRByte(xxx, yyy)); out.setRByte(xxx, yyy, input.getRByte(xxx, yyy));
@ -26,9 +26,9 @@ public class ToolImage {
return out; return out;
} }
public static ImageByte convertImageFloat(final ImageByte input) { public static ImageFloat convertImageFloat(final ImageByte input) {
if (input.hasAlpha()) { if (input.hasAlpha()) {
ImageByte out = new ImageByteRGBA(input.getHeight(), input.getWidth()); ImageFloat out = new ImageFloatRGBA(input.getWidth(), input.getHeight());
for (int xxx = 0; xxx < input.getWidth(); ++xxx) { for (int xxx = 0; xxx < input.getWidth(); ++xxx) {
for (int yyy = 0; yyy < input.getHeight(); ++yyy) { for (int yyy = 0; yyy < input.getHeight(); ++yyy) {
out.setRFloat(xxx, yyy, input.getRFloat(xxx, yyy)); out.setRFloat(xxx, yyy, input.getRFloat(xxx, yyy));
@ -39,7 +39,7 @@ public class ToolImage {
} }
return out; return out;
} }
ImageByte out = new ImageByteRGB(input.getHeight(), input.getWidth()); ImageFloat out = new ImageFloatRGB(input.getWidth(), input.getHeight());
for (int xxx = 0; xxx < input.getWidth(); ++xxx) { for (int xxx = 0; xxx < input.getWidth(); ++xxx) {
for (int yyy = 0; yyy < input.getHeight(); ++yyy) { for (int yyy = 0; yyy < input.getHeight(); ++yyy) {
out.setRFloat(xxx, yyy, input.getRFloat(xxx, yyy)); out.setRFloat(xxx, yyy, input.getRFloat(xxx, yyy));
@ -63,7 +63,7 @@ public class ToolImage {
} }
return out; return out;
} }
public static byte[] convertInByteBufferRGB(final Image data) { public static byte[] convertInByteBufferRGB(final Image data) {
byte[] out = new byte[data.getHeight() * data.getWidth() * 3]; byte[] out = new byte[data.getHeight() * data.getWidth() * 3];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) { for (int xxx = 0; xxx < data.getWidth(); ++xxx) {
@ -75,6 +75,19 @@ public class ToolImage {
} }
return out; return out;
} }
public static byte[] pngConvertInByteBufferRGB(final Image data) {
int nbChannel = 3;
final int rowByteSize = 1 + nbChannel*data.getWidth();
byte[] out = new byte[data.getHeight() * rowByteSize];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) {
for (int yyy = 0; yyy < data.getHeight(); ++yyy) {
out[yyy * rowByteSize + xxx * nbChannel + 1] = data.getRByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 2] = data.getGByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 3] = data.getBByte(xxx, yyy);
}
}
return out;
}
public static byte[] convertInByteBufferRGBA(final Image data) { public static byte[] convertInByteBufferRGBA(final Image data) {
byte[] out = new byte[data.getHeight() * data.getWidth() * 4]; byte[] out = new byte[data.getHeight() * data.getWidth() * 4];
@ -89,6 +102,21 @@ public class ToolImage {
return out; return out;
} }
public static byte[] pngConvertInByteBufferRGBA(final Image data) {
int nbChannel = 4;
final int rowByteSize = 1 + nbChannel*data.getWidth();
byte[] out = new byte[data.getHeight() * rowByteSize];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) {
for (int yyy = 0; yyy < data.getHeight(); ++yyy) {
out[yyy * rowByteSize + xxx * nbChannel + 1] = data.getRByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 2] = data.getGByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 3] = data.getBByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 4] = data.getAByte(xxx, yyy);
}
}
return out;
}
public static float[] convertInFloatBufferARGB(final Image data) { public static float[] convertInFloatBufferARGB(final Image data) {
float[] out = new float[data.getHeight() * data.getWidth() * 4]; float[] out = new float[data.getHeight() * data.getWidth() * 4];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) { for (int xxx = 0; xxx < data.getWidth(); ++xxx) {

View File

@ -1,68 +0,0 @@
package org.atriasoft.egami.internal;
import io.scenarium.logger.LogLevel;
import io.scenarium.logger.Logger;
public class Log {
private static final String LIB_NAME = "egami";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
public static void critical(final String data) {
if (Log.PRINT_CRITICAL) {
Logger.critical(Log.LIB_NAME_DRAW, data);
}
}
public static void debug(final String data) {
if (Log.PRINT_DEBUG) {
Logger.debug(Log.LIB_NAME_DRAW, data);
}
}
public static void error(final String data) {
if (Log.PRINT_ERROR) {
Logger.error(Log.LIB_NAME_DRAW, data);
}
}
public static void info(final String data) {
if (Log.PRINT_INFO) {
Logger.info(Log.LIB_NAME_DRAW, data);
}
}
public static void print(final String data) {
if (Log.PRINT_PRINT) {
Logger.print(Log.LIB_NAME_DRAW, data);
}
}
public static void todo(final String data) {
if (Log.PRINT_TODO) {
Logger.todo(Log.LIB_NAME_DRAW, data);
}
}
public static void verbose(final String data) {
if (Log.PRINT_VERBOSE) {
Logger.verbose(Log.LIB_NAME_DRAW, data);
}
}
public static void warning(final String data) {
if (Log.PRINT_WARNING) {
Logger.warning(Log.LIB_NAME_DRAW, data);
}
}
private Log() {}
}