commit f57a7ad2fcfd361e75a29fe51f69f2a0770f9296 Author: Victor Date: Thu Nov 15 12:00:41 2018 +0200 Initial diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..2a67c3b --- /dev/null +++ b/build.xml @@ -0,0 +1,83 @@ + + + + + + Builds, tests, and runs the project . + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..01ff0ae --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Classpath to J2ME Ant extension library (libs.j2me_ant_ext.classpath property) is not set. For example: location of mobility/modules/org-netbeans-mobility-antext.jar file in the IDE installation directory. + Platform home (platform.home property) is not set. Value of this property should be ${platform.active.description} emulator home directory location. + Platform boot classpath (platform.bootclasspath property) is not set. Value of this property should be ${platform.active.description} emulator boot classpath containing all J2ME classes provided by emulator. + Must set src.dir + Must set build.dir + Must set dist.dir + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set preprocessed.dir + + + + + + + + + + + + + + + + + + Must set build.classes.dir + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must set obfuscated.classes.dir + + + + Must set obfuscated.classes.dir + Must set obfuscator.srcjar + Must set obfuscator.destjar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set preverify.classes.dir + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MicroEdition-Configuration: ${platform.configuration} + + MicroEdition-Configuration: ${platform.configuration} + + + + MicroEdition-Profile: ${platform.profile} + + MicroEdition-Profile: ${platform.profile} + + + + Must set dist.jad + + + + + + + + + + + + + + + + + + + + + + + + ${manifest.midlets}${evaluated.manifest.apipermissions}${evaluated.manifest.pushregistry}${manifest.others}${manifest.jad} + ${manifest.midlets}${evaluated.manifest.apipermissions}${evaluated.manifest.pushregistry}${manifest.others}${manifest.manifest} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Starting emulator with port number ${active.debug.port} + + + + + + + + + + + + Starting emulator with port number ${active.debug.port} + + + + + + + + + + + + + + + + + Must set dist.javadoc.dir + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${all.configurations} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Property deployment.${deployment.method}.scriptfile not set. The property should point to an Ant script providing ${deployment.method} deployment. + + + + + + + + Classpath to Ant Contrib library (libs.ant-contrib.classpath property) is not set. + + + + + + + + + Active project configuration: @{cfg} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Property build.root.dir is not set. By default its value should be \"build\". + Property dist.root.dir is not set. By default its value should be \"dist\". + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..07e84a6 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +build.xml.data.CRC32=d7bda4a9 +build.xml.script.CRC32=64f59723 +build.xml.stylesheet.CRC32=03eab09b +nbproject/build-impl.xml.data.CRC32=d7bda4a9 +nbproject/build-impl.xml.script.CRC32=d8c21329 +nbproject/build-impl.xml.stylesheet.CRC32=a4fc63f1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 0000000..5a85393 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,7 @@ +#Fri Feb 19 22:12:04 EET 2010 +netbeans.user=C:\\Users\\aNNiMON\\.netbeans\\6.9m1 +javadoc.preview=true +deployment.counter=23 +config.active= +deployment.number=0.0.22 +app-version.autoincrement=true diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 0000000..c1f155a --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,4 @@ + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..2ed6bb4 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,140 @@ +abilities=MMAPI=1.1,SATSAJCRMI=1.0,SATSACRYPTO=1.0,JSR82=1.1,NOKIAUI=1.0,JSR226=1.0,MIDP=2.1,JSR229=1.1.0,SATSAAPDU=1.0,CLDC=1.1,JSR177=1.0,JSR179=1.0.1,J2MEWS=1.0,VSCL=2.1,WMA=2.0,JSR172=1.0,SEMC_EXT_JP8=1.0,ColorScreen,OBEX=1.0,NokiaUI=1.0,JSR238=1.0,JSR239=1.0,JSR211=1.0,JSR234=1.0,ScreenWidth=240,lib/semc_ext_jp8.jar=1.0,MascotV3=1.0,JSR75=1.0,JSR184=1.1,SATSAPKI=1.0,ScreenHeight=321,ScreenColorDepth=8,JSR180=1.0.1,J2MEXMLRPC=1.0, +all.configurations=\ +application.args= +application.description= +application.description.detail= +application.name= +application.vendor=Vendor +build.classes.dir=${build.dir}/compiled +build.classes.excludes=**/*.java,**/*.form,**/*.class,**/.nbintdb,**/*.mvd,**/*.wsclient,**/*.vmd +build.dir=build/${config.active} +build.root.dir=build +debug.level=debug +deployment.copy.target=deploy +deployment.instance=default +deployment.jarurl=${dist.jar} +deployment.method=NONE +deployment.override.jarurl=false +dist.dir=dist/${config.active} +dist.jad=HSVScreenSaver.jad +dist.jar=HSVScreenSaver.jar +dist.javadoc.dir=${dist.dir}/doc +dist.root.dir=dist +extra.classpath= +filter.exclude.tests=false +filter.excludes= +filter.more.excludes=**/overview.html,**/package.html +filter.use.standard=true +jar.compress=true +javac.debug=true +javac.deprecation=false +javac.encoding=windows-1251 +javac.optimize=false +javac.source=1.3 +javac.target=1.3 +javadoc.author=false +javadoc.encoding= +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +libs.classpath= +main.class= +main.class.class=applet +manifest.apipermissions= +manifest.file=manifest.mf +manifest.jad= +manifest.manifest= +manifest.midlets=MIDlet-1: Main,/icon.png,Main\n +manifest.others=MIDlet-Vendor: aNNiMON\nSEMC-StandbyApplication: Y\nMIDlet-Name: HSVScreenSaver\nMIDlet-Version: 1.0\n +manifest.pushregistry= +name=HSVScreenSaver +no.dependencies=false +nokiaS80.application.icon= +nsicom.application.monitorhost= +nsicom.application.runremote= +nsicom.application.runverbose= +nsicom.remoteapp.location=\\My Documents\\NetBeans Applications +nsicom.remotevm.location=\\Windows\\creme\\bin\\CrEme.exe +obfuscated.classes.dir=${build.dir}/obfuscated +obfuscation.custom= +obfuscation.level=9 +obfuscator.destjar=${build.dir}/obfuscated.jar +obfuscator.srcjar=${build.dir}/before-obfuscation.jar +platform.active=Sony_Ericsson_SDK_2_5_0_4_for_the_Java_TM__ME_Platform_Emulator_ +platform.active.description=Sony Ericsson SDK 2.5.0.4 for the Java(TM) ME Platform(Emulator) +platform.apis=JSR234-1.0,SATSA-APDU-1.0,JSR211-1.0,JSR75-1.0,J2ME-WS-1.0,J2ME-XMLRPC-1.0,JSR82-1.1,SATSA-JCRMI-1.0,SATSA-CRYPTO-1.0,JSR239-1.0,JSR179-1.0.1,MascotV3-1.0,JSR184-1.1,JSR238-1.0,MMAPI-1.1,NokiaUI-1.0,JSR229-1.1.0,SATSA-PKI-1.0,JSR180-1.0.1,JSR226-1.0,JSR177-1.0,SEMC_EXT_JP8-1.0,VSCL-2.0,VSCL-2.1,WMA-2.0,lib/semc_ext_jp8.jar +platform.bootclasspath=${platform.home}/lib/mascotv3.jar:${platform.home}/lib/jsr226.jar:${platform.home}/lib/jsr256.jar:${platform.home}/lib/satsa-crypto.jar:${platform.home}/lib/jsr229.jar:${platform.home}/lib/jsr238.jar:${platform.home}/lib/j2me-xmlrpc.jar:${platform.home}/lib/jsr211.jar:${platform.home}/lib/vscl21.jar:${platform.home}/lib/satsa-jcrmi.jar:${platform.home}/lib/jsr082.jar:${platform.home}/lib/satsa-apdu.jar:${platform.home}/lib/jsr184.jar:${platform.home}/lib/nokiaext.jar:${platform.home}/lib/jsr239.jar:${platform.home}/lib/jsr75.jar:${platform.home}/lib/jsr179.jar:${platform.home}/lib/satsa-pki.jar:${platform.home}/lib/jsr180.jar:${platform.home}/lib/vscl.jar:${platform.home}/lib/mmapi.jar:${platform.home}/lib/j2me-ws.jar:${platform.home}/lib/wma20.jar:${platform.home}/lib/jsr234.jar:${platform.home}/lib/semc_ext_jp8.jar:${platform.home}/lib/cldcapi11.jar:${platform.home}/lib/midpapi20.jar +platform.configuration=CLDC-1.1 +platform.device=SonyEricsson_JP8_240x320_Emu +platform.fat.jar=true +platform.profile=MIDP-2.0 +platform.trigger=CLDC +platform.type=UEI-1.0.1 +preprocessed.dir=${build.dir}/preprocessed +preverify.classes.dir=${build.dir}/preverified +preverify.sources.dir=${build.dir}/preverifysrc +resources.dir=resources +ricoh.application.email= +ricoh.application.fax= +ricoh.application.icon= +ricoh.application.target-jar= +ricoh.application.telephone= +ricoh.application.uid=58974906 +ricoh.application.version= +ricoh.dalp.application-desc.auto-run=false +ricoh.dalp.application-desc.energy-save= +ricoh.dalp.application-desc.exec-auth= +ricoh.dalp.application-desc.visible=true +ricoh.dalp.argument= +ricoh.dalp.codebase= +ricoh.dalp.display-mode.color=true +ricoh.dalp.display-mode.is-4line-support=false +ricoh.dalp.display-mode.is-hvga-support=true +ricoh.dalp.display-mode.is-vga-support=false +ricoh.dalp.display-mode.is-wvga-support=false +ricoh.dalp.information.abbreviation= +ricoh.dalp.information.icon.basepath= +ricoh.dalp.information.icon.location= +ricoh.dalp.information.is-icon-used=true +ricoh.dalp.install.destination=hdd +ricoh.dalp.install.mode.auto=true +ricoh.dalp.install.work-dir=hdd +ricoh.dalp.is-managed=true +ricoh.dalp.resources.dsdk.version=2.0 +ricoh.dalp.resources.jar.basepath= +ricoh.dalp.resources.jar.version= +ricoh.dalp.version= +ricoh.icon.invert=false +ricoh.platform.target.version= +run.cmd.options= +run.jvmargs= +run.method=STANDARD +run.security.domain=trusted +run.use.security.domain=false +savaje.application.icon= +savaje.application.icon.focused= +savaje.application.icon.small= +savaje.application.uid=TBD +savaje.bundle.base= +savaje.bundle.debug=false +savaje.bundle.debug.port= +semc.application.caps= +semc.application.icon= +semc.application.icon.count= +semc.application.icon.splash= +semc.application.icon.splash.installonly=false +semc.application.uid=E5342786 +semc.certificate.path= +semc.private.key.password= +semc.private.key.path= +sign.alias= +sign.enabled=false +sign.keystore= +src.dir=src +use.emptyapis=true +use.preprocessor=true diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..3053036 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,10 @@ + + + org.netbeans.modules.kjava.j2meproject + + + HSVScreenSaver + 1.6 + + + diff --git a/src/1.png b/src/1.png new file mode 100644 index 0000000..42fdec7 Binary files /dev/null and b/src/1.png differ diff --git a/src/Canv.java b/src/Canv.java new file mode 100644 index 0000000..3dc26cd --- /dev/null +++ b/src/Canv.java @@ -0,0 +1,104 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +import com.nokia.mid.ui.DeviceControl; +import javax.microedition.lcdui.*; + +/** + * @author aNNiMON + */ +public class Canv extends Canvas implements Runnable { + + private int w,h,step; + private boolean stb, ltb, itb, light; + private long time; + private HSV hsv; + private Thread thr; + + public Canv() { + setFullScreenMode(true); + w = getWidth(); + h = getHeight(); + stb = false; + step = 2; + checkResolution(Main.midlet.img); + hsv = new HSV(); + thr = new Thread(this); + thr.start(); + } + + public void paint(Graphics g) { + g.setColor(0); + g.fillRect(0, 0, w, h); + g.drawImage(Main.midlet.img, w/2, h/2, 3); + if(stb) { + drawUI(g); + g.setColor(0xE8E8E8); + g.drawString("Step "+String.valueOf(step), w/2, h-2, 33); + if(System.currentTimeMillis()-time>=3000) stb=false; + repaint(); + } + if(ltb) { + drawUI(g); + g.setColor(0xE8E8E8); + g.drawString("Lights "+String.valueOf(light), w/2, h-2, 33); + if(System.currentTimeMillis()-time>=3000) ltb=false; + repaint(); + } + if(itb) { + drawUI(g); + g.setColor(0xE8E8E8); + g.drawString("Author: aNNiMON", w/2, h-2, 33); + if(System.currentTimeMillis()-time>=3000) itb=false; + repaint(); + } + } + + private void drawUI(Graphics g) { + Font fnt = Font.getFont(0, Font.STYLE_BOLD, Font.SIZE_MEDIUM); + int fh = fnt.getHeight()+4; + int[] ui = new int[(w-10)*fh]; + for(int i=0; i30) step=1; stb = true;} + if(ga==DOWN) {step--; if(step<1) step=30; stb = true;} + if(ga==FIRE) {light=!light; ltb = true;} + if(key==KEY_STAR) {itb = true;} + if(key==KEY_NUM0) Main.midlet.destroyApp(true); + time = System.currentTimeMillis(); + } + + protected void keyRepeated(int key) { + keyPressed(key); + } + + private void checkResolution(Image img) { + if(img.getWidth()>w && img.getHeight()>h) { + Image temp = Image.createImage(w, h); + Graphics g = temp.getGraphics(); + g.drawImage(img, w/2, h/2, 3); + Main.midlet.img=temp; + } + } + + public void run() { + while(true) { + hsv.hsb(step); + repaint(); + if(light) DeviceControl.setLights(0, 100); + try { + Thread.sleep(100); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/src/HSV.java b/src/HSV.java new file mode 100644 index 0000000..1f3935c --- /dev/null +++ b/src/HSV.java @@ -0,0 +1,93 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +import javax.microedition.lcdui.Image; + +/** + * + * @author aNNiMON + */ +public class HSV { + + private int[] pixel; + private int wdh, hgt; + + public HSV() { + + } + + public void hsb(int ch) { + Image img = Main.midlet.img; + wdh = img.getWidth(); + hgt = img.getHeight(); + pixel = new int[wdh * hgt]; + int[] lineRGB = new int[wdh]; + for (int y = 0; y < hgt; y++) { + img.getRGB(lineRGB, 0, wdh, 0, y, wdh, 1); + System.arraycopy(lineRGB, 0, pixel, y*wdh, lineRGB.length); + } + float[] hsb = new float[3]; + for (int io = 0; io < pixel.length; io++) { + int qa = (pixel[io] >> 24) & 0xff; + int qr = (pixel[io] >> 16) & 0xff; + int qg = (pixel[io] >> 8) & 0xff; + int qb = pixel[io] & 0xff; + hsb = RGBtoHSV(qr, qg, qb, hsb); + hsb[0] = hsb[0] + ch; + pixel[io] = (qa << 24) | HSVtoRGB(hsb[0], hsb[1], hsb[2]); + } + Main.midlet.img = Image.createRGBImage(pixel, wdh, hgt, false); + } + + private int HSVtoRGB(float h, float s, float v) { + float qr = 0, qg = 0, qb = 0; + int r = 0, g = 0, b = 0; + if(s==0.0 && h==-1.0) return ((int)v << 16) | ((int)v << 8) | (int)v; + int Hi = (int) ((h / 60) % 6); + float f = (float) (h / 60 - (float)Math.floor(h/60)); + float p = (float) ((float)v*(1.0f - (float)s)); + float q = (float) ((float)v*(1.0f - (float)f*(float)s)); + float t = (float) ((float)v*(1.0f - (s*(1.0-f)))); + switch(Hi) { + case 0: qr = v; qg = t; qb = p; break; + case 1: qr = q; qg = v; qb = p; break; + case 2: qr = p; qg = v; qb = t; break; + case 3: qr = p; qg = q; qb = v; break; + case 4: qr = t; qg = p; qb = v; break; + case 5: qr = v; qg = p; qb = q; break; + } + r = (int) (255 * qr); g = (int) (255 * qg); b = (int) (255 * qb); + return (r << 16) | (g << 8) | b; + } + + private float[] RGBtoHSV(int qr, int qg, int qb, float[] hsv) { + float h = 0, s, v; + if (hsv == null) { + hsv = new float[3]; + } + float r = (float) qr/255; float g = (float) qg/255; float b = (float) qb/255; + float max = (r > g) ? r : g; + if (b > max) max = b; + float min = (r < g) ? r : g; + if (b < min) min = b; + // hue + if(max==min) h=0; + if(max==r && g>=b) h = 60 * ((g-b)/(max-min)); + if(max==r && g_<", 0, 0, 20); + G.setColor(0x00FF00); + G.drawString("Закинь в меня -_-", 50, 50, 17); + G.setColor(0x0000FF); + G.drawString("картинку 1.png =)", 100, 100, 40); + } + } + } + } + dsp.setCurrent(new Canv()); + } + + public void pauseApp() { + } + + public void destroyApp(boolean un) { + notifyDestroyed(); + } +} diff --git a/src/icon.png b/src/icon.png new file mode 100644 index 0000000..661451b Binary files /dev/null and b/src/icon.png differ