From c94e8f43f4b2cc609d56ca6860337d658fbf4b8d Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 14 Nov 2018 23:01:22 +0200 Subject: [PATCH] Initial --- build.xml | 83 ++ nbproject/build-impl.xml | 1247 ++++++++++++++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/private/private.properties | 8 + nbproject/private/private.xml | 4 + nbproject/project.properties | 143 +++ nbproject/project.xml | 10 + src/AccelUtil.java | 110 +++ src/Canv.java | 300 +++++++ src/Main.java | 49 + src/figure.mbac | Bin 0 -> 1537 bytes src/logo.mdat | Bin 0 -> 3407 bytes src/mc.java | 187 ++++ 13 files changed, 2149 insertions(+) create mode 100644 build.xml create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/private/private.properties create mode 100644 nbproject/private/private.xml create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/AccelUtil.java create mode 100644 src/Canv.java create mode 100644 src/Main.java create mode 100644 src/figure.mbac create mode 100644 src/logo.mdat create mode 100644 src/mc.java diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..ea9910e --- /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..5aee582 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..cc9b239 --- /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=5a91fce0 +build.xml.script.CRC32=5c40033b +build.xml.stylesheet.CRC32=9c6a911d +nbproject/build-impl.xml.data.CRC32=5a91fce0 +nbproject/build-impl.xml.script.CRC32=93ea4cdb +nbproject/build-impl.xml.stylesheet.CRC32=e46c2d22 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 0000000..56bcf2c --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,8 @@ +#Sun, 08 Jan 2012 13:36:46 +0200 +#Sun Nov 29 18:25:33 EET 2009 +netbeans.user=C\:\\Users\\aNNiMON\\.netbeans\\7.1 +javadoc.preview=true +config.active= +deployment.counter=31 +app-version.autoincrement=true +deployment.number=0.0.30 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..0cdc92c --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,143 @@ +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 +debugger.timeout= +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=Mobi3DSpaceLocation.jad +dist.jar=Mobi3DSpaceLocation.jar +dist.javadoc.dir=${dist.dir}/doc +dist.root.dir=dist +extra.classpath= +file.reference.builtin.ks=${netbeans.user}/config/j2me/builtin.ks +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=UTF-8 +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.is.liblet=false +manifest.jad= +manifest.manifest= +manifest.midlets=MIDlet-1: MSL,,Main\n +manifest.others=MIDlet-Vendor: aNNiMON\nMIDlet-Name: Mobi3DSpaceLocation\nMIDlet-Version: 1.0\n +manifest.pushregistry= +name=Mobi3DSpaceLocation +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=@E:\\SETUPS\\Disk\\Programming\\Java\\annimon.pro +obfuscation.level=1 +obfuscator.destjar=${build.dir}/obfuscated.jar +obfuscator.srcjar=${build.dir}/before-obfuscation.jar +platform.active=Sony_Ericsson_SDK_2_5_0_6_for_the_Java_TM__ME_Platform_Emulator_ +platform.active.description=Sony Ericsson SDK 2.5.0.6 for the Java(TM) ME Platform(Emulator) +platform.apis=JSR234-1.0,J2ME-WS-1.0,JSR239-1.0,MascotV3-1.0,JSR238-1.0,MMAPI-1.1,JSR256-1.1,NokiaUI-1.0,JSR226-1.0,JSR75-1.0,JSR184-1.1,WMA-2.0,JSR211-1.0,JSR82-1.1 +platform.bootclasspath=${platform.home}/lib/mascotv3.jar:${platform.home}/lib/jsr226.jar:${platform.home}/lib/jsr256.jar:${platform.home}/lib/jsr238.jar:${platform.home}/lib/jsr211.jar:${platform.home}/lib/jsr082.jar:${platform.home}/lib/jsr184.jar:${platform.home}/lib/nokiaext.jar:${platform.home}/lib/jsr239.jar:${platform.home}/lib/jsr75.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/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=13736874 +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=E9003756 +semc.certificate.path= +semc.private.key.password= +semc.private.key.path= +sign.alias=minimal +sign.enabled=false +sign.keystore=${file.reference.builtin.ks} +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..72207e1 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,10 @@ + + + org.netbeans.modules.kjava.j2meproject + + + Mobi3DSpaceLocation + 1.6 + + + diff --git a/src/AccelUtil.java b/src/AccelUtil.java new file mode 100644 index 0000000..b63e5b1 --- /dev/null +++ b/src/AccelUtil.java @@ -0,0 +1,110 @@ + + +/* + * aNNiMON 2011 + * For more info visit http://annimon.com/ + */ + +import java.io.IOException; +import javax.microedition.io.Connector; +import javax.microedition.sensor.*; + +/** + * + * @author aNNiMON + */ +public abstract class AccelUtil implements DataListener { + + private int[] channels; + private String[] channelNames; + private SensorConnection sensor; + private String URL; //URL для коннекта + private int numChannels; //количество каналов + private int dataType; //тип приёма данных + private double + minValue,//минимальное значение + maxValue; //максимальное значение + + public AccelUtil() { + getInfo(); + } + + private void getInfo() { + //Получаем список ВСЕХ сенсоров + SensorInfo[] info = SensorManager.findSensors(null, null); + if (info==null || info.length==0) return; //ничего не нашли, выходим + //Сканируем найденные сенсоры + for(int i=0; i=0) value = (int) (doublevalue * 1024 / maxValue); + else value = (int) (doublevalue * (-1024) / minValue); + + return value; + } +} diff --git a/src/Canv.java b/src/Canv.java new file mode 100644 index 0000000..48e12a4 --- /dev/null +++ b/src/Canv.java @@ -0,0 +1,300 @@ +import javax.microedition.lcdui.*; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author aNNiMON + */ +public class Canv extends Canvas implements Runnable { + + private int w,h; + + //Для визуалок + private int tcr; + private boolean exit;//выход - старт эффекта + private boolean right; + + // Глобальные Данные + private boolean run, record, standby; //режим проигрывания, записи макроса и ожидания + private int stx, sty, stz; + + private int vx, vy, vz; + private int lx, ly, lz; + private boolean lok = false; + private boolean st4 = false; + + private boolean lite = false; + private AccelUtil au; + private Image I, img; + private Graphics G; + private Thread thr; + private static final Font smallFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL); + + public Canv() { + setFullScreenMode(true); + tcr = 0; + standby = true; right = true; + exit = run = record = false; + thr = new Thread(this); + w = getWidth(); + h = getHeight(); + I = Image.createImage(w, h); + // Позиция просмотра + vx = 0; + vy = 100; + vz = 0; + G = I.getGraphics(); + au = new AccelUtil() { + + public void setPositions(int x, int y, int z) { + int sc = st4 ? 2 : 1; + x *= sc; + y *= sc; + z *= sc; + if(standby) { + stx=-z; + sty=y/2; + stz=x; + //mc.setViewLook(x, y, z); + mc.setRotationMDL(stx, sty, stz); + repaint(); + } + } + + }; + thr.start(); + } + + protected void paint(Graphics g) { + if(exit) { + g.setColor(0x00); + g.fillRect(-(w/2)+tcr-img.getWidth()/2, h/2-img.getHeight()/2, img.getWidth(), img.getHeight()); + g.drawImage(img, -(w/2)+tcr, h/2, 3); + g.drawImage(I, tcr, 0, 20); + } + else { + g.drawImage(I, 0, 0, 20); + drawCanvas(G); + } + } + + private void drawCanvas(Graphics g) { + int fh = smallFont.getHeight()+2; + g.setColor(0x00); + g.fillRect(0, 0, w, fh); + g.setColor(0xFFFFFF); + g.fillRect(0, fh, w, h-fh); + mc.setViewUp(vx, vy, vz); + mc.setViewPos(lx, ly, lz); + //mc.setLightPos(lx, ly, lz); + mc.drawModel(g); + g.setColor(0x006688); + g.drawString(""+stx+" "+sty+" "+stz, 5, 30, 20); + g.drawString(""+st4+" "+vx+" "+vy+" "+vz, 5, 60, 20); + g.drawString(""+lok+" "+lx+" "+ly+" "+lz, 5, 90, 20); + drawTitle(g, "Mobi3DSpaceLocation", tcr); + } + + public void keyPressed(int key) { + if(!lok) switch(key) { + + case KEY_NUM4: vx-=100; break; + case KEY_NUM6: vx+=100; break; + + case KEY_NUM2: vy-=100; break; + case KEY_NUM8: vy+=100; break; + + case KEY_NUM1: vz-=100; break; + case KEY_NUM3: vz+=100; break; + + case KEY_STAR: lok=!lok; break; + case KEY_NUM5: st4=!st4; break; + } else switch(key) { + + case KEY_NUM4: lx-=100; break; + case KEY_NUM6: lx+=100; break; + + case KEY_NUM2: ly-=100; break; + case KEY_NUM8: ly+=100; break; + + case KEY_NUM1: lz-=100; break; + case KEY_NUM3: lz+=100; break; + + case KEY_NUM5: st4=!st4; break; + case KEY_STAR: lok=!lok; break; + } + } + + public void keyRepeated(int key) { + keyPressed(key); + } + + public void run() { + initModel(); + while(true) { + if(exit) { + if(tcr>w-3) { + Main.midlet.destroyApp(true); + } + tcr = changeBar(tcr, w); + try { + Thread.sleep(20); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + repaint(); + } + } + } + + private void exitApp() { + tcr = 0; + img = load("/logo.mdat", 3407); + exit = true; + } + + private Image load(String str, int ii) { + try { + byte[] abyte0 = new byte[ii]; + java.io.DataInputStream dis = new java.io.DataInputStream(getClass().getResourceAsStream(str)); + dis.read(abyte0, 0, ii); + dis.close(); + int j; + if (ii < 100) { + j = 10 + ii % 10; + } else if (ii < 200) { + j = 50 + ii % 20; + } else if (ii < 300) { + j = 80 + ii % 20; + } else { + j = 100 + ii % 50; + } + for (int k = 0; k < j; k++) { + byte byte0 = abyte0[k]; + abyte0[k] = abyte0[ii - k - 1]; + abyte0[ii - k - 1] = byte0; + } + byte[] start = new byte[] {(byte) 0x89, (byte) 0x50, (byte) 0x4E, (byte) 0x47, + (byte) 0x0D, (byte) 0x0A, (byte) 0x1A, (byte) 0x0A, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0D, + (byte) 0x49, (byte) 0x48, (byte) 0x44, (byte) 0x52}; + byte[] end = new byte[] {(byte) 0x49, (byte) 0x45, (byte) 0x4E, (byte) 0x44, + (byte) 0xAE, (byte) 0x42, (byte) 0x60, (byte) 0x82}; + byte[] png = new byte[start.length+abyte0.length+end.length]; + int y = start.length; + System.arraycopy(start, 0, png, 0, y); + System.arraycopy(abyte0, 0, png, y, abyte0.length); + y+=abyte0.length; + System.arraycopy(end, 0, png, y, end.length); + start=null; + end=null; + abyte0=null; + //save(png); + return Image.createImage(png, 0, png.length); + } catch (Exception in) { + in.printStackTrace(); + return null; + } + } + + private void drawTitle(Graphics g, String text, int t) { + int fh = smallFont.getHeight()+2; + g.setColor(0x00AADD); + g.setFont(smallFont); + g.drawString(text, w/2, 1, 17); + drawRect(g, 0xFF242424, 0x87282828, 0, 0, w, fh/2); + drawRect(g, 0x87151515, 0xFF181818, 0, fh/2, w, fh/2); + drawRect(g, 0xA7151515, 0x77181818, 0, 0, t, fh); + } + + private int changeBar(int t, int w) { + if (right) t++; + else t--; + if(t>=w || t<=0) right=!right; + return t; + } + + /** + * Ортисовка непрозрачного градиента + * @param g контекст графики + * @param color1 верхний цвет градиента + * @param color2 нижний цвет градиента + * @param x1 X + * @param y1 Y + * @param w ширина + * @param h высота + */ + private void drawRect(Graphics g, int color1, int color2, int x1, int y1, int w, int h) { + // Если цвета одинаковы, то градиент нам не нужен + if(color1 == color2) { + g.setColor(color1); + g.fillRect(x1, y1, w, h); + } else { + drawVGradient(g, color1, color2, x1, y1, w, h); + } + } + + /** + * Отрисовка вертикального градиента + * @param graphics контекст графики + * @param rgb1 верхний цвет градиента + * @param rgb2 нижний цвет градиента + * @param xn X + * @param yn Y + * @param wdh ширина + * @param hgt высота + */ + private void drawVGradient(Graphics graphics, int rgb1, int rgb2, int xn, int yn, int wdh, int hgt) { + if (lite) { + graphics.setColor(rgb1); + graphics.fillRect(xn, yn, wdh, hgt); + return; + } + // Первый цвет + int r1 = acolor(rgb1, 'r'); + int g1 = acolor(rgb1, 'g'); + int b1 = acolor(rgb1, 'b'); + // Разница между вторым и первым цветом + int deltaR = acolor(rgb2, 'r') - r1; + int deltaG = acolor(rgb2, 'g') - g1; + int deltaB = acolor(rgb2, 'b') - b1; + try { + wdh += xn; + hgt += yn; + final int deltaHeight = hgt - yn - 1; + for (int i = yn; i < hgt; i++) { + int r = r1 + ((i - hgt + 1) * deltaR) / deltaHeight + deltaR; + int g = g1 + ((i - hgt + 1) * deltaG) / deltaHeight + deltaG; + int b = b1 + ((i - hgt + 1) * deltaB) / deltaHeight + deltaB; + graphics.setColor(r, g, b); + graphics.drawLine(xn, i, wdh - 1, i); + } + } catch (Exception ex) { + } + } + + /** + * Получить цвет нужного канала в пикселе + * @param argb пиксель + * @param c символьный параметр - название канала (a, r, g, b) + * @return + */ + private static int acolor(int argb, char c) { + if(c=='r') return ((argb >> 16) & 0xff); + else if(c=='g') return ((argb >> 8) & 0xff); + else if(c=='b') return (argb & 0xff); + else if(c=='a') return ((argb >> 24) & 0xff); + else return argb; + } + + private void initModel() { + mc.init(); + mc.setFLCenter(w/2, h/2); + mc.setScaleMDL(1024, 1024, 1024); + mc.setRotationMDL(0, 0, 0); + } +} diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..be28813 --- /dev/null +++ b/src/Main.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +import com.nokia.mid.ui.DeviceControl; +import java.io.*; +import javax.microedition.lcdui.*; +import javax.microedition.midlet.*; + +/** + * @author aNNiMON + */ +public class Main extends MIDlet implements CommandListener { + + public static Main midlet; + public Display dsp; + + public Main() { + midlet = this; + dsp = Display.getDisplay(this); + } + + public void startApp() { + String sensorVersion = System.getProperty("microedition.sensor.version"); + if (sensorVersion == null) { + Alert al = new Alert("Error", "Could not find any sensors", null, AlertType.ERROR); + al.setTimeout(Alert.FOREVER); + al.addCommand(Alert.DISMISS_COMMAND); + al.setCommandListener(this); + dsp.setCurrent(al); + } else { + dsp.setCurrent(new Canv()); + } + } + + public void pauseApp() { + } + + public void destroyApp(boolean un) { + notifyDestroyed(); + } + + public void commandAction(Command c, Displayable d) { + if (c.equals(Alert.DISMISS_COMMAND)) { + notifyDestroyed(); + } + } +} diff --git a/src/figure.mbac b/src/figure.mbac new file mode 100644 index 0000000000000000000000000000000000000000..dbf48209938afbe694e387962f6245aa988443b4 GIT binary patch literal 1537 zcmb`HZ%h+s9LK-UbJy#&wnt@kljTMkbJ`gt7EFSO!a@jiTN2Trr^u5VPzq zX`j3A_xJt$`hC&z5*sL$NEG6-LxrDz6Uf%-O8=`tgnYgt#5+@?$Sa!I1CLJI6jj^5 zMVd$!e@B`>H4XIN>D(PM#|DXIGY3<9+>^Ez336MphSsaTTPS`vxXVgoK~?8zvgRHe zP4y|s@%=g`l5v7`+H}yTMNSSCHlEfz;VUD2w{Xbx6oCbk>D|0zqmtd39Jio6t@S;V zk>aPFCqurJ*ey$kIcV3s;RkOhmdzG@(%nMSX?M779a|Ob~VD> zae}s=iy|V-jS#bOI%mm6Mr_^yqmBh%G7#AlhvX`Z6T2QvtJ4VS32RJzq|IW?3b3M{ zCwX@6e^V7zRmH!6`c6kI7OStX_pCcS2iN}jk>XN32DYql2?9r4F06R%1qnl!Z-6Z? zSPBCn1~jm30bpsKe*svQOLN1J53H8auxk4Tf={;XssZ!qxv#)b+uv8wP*Pn%aXuV9 z1@_j8H&?>Yj;+^_xH|fi1UGTm2rFA%x&}t}R}~dVT)R8$Mfs`^*4S9pN0l3i@#68y zN+bq;|9KvcwtR8W!FJZv?x4oY-J83SxPEVBA%^;I4mjAphP{o{$nDwMgT&w;w-&)o zor;sS9XNE58u^jx2og8$|Kdk^$=Xtlb$xyO8_8IBruH5ZH~;+gZ5(awIHa-OQ)f;~ zKq>`~sK>f8PV>bp>kXMaJx)Dy70#$##>{gYXVG$I(e_Qzlu7ar)++Ff;CyM#5&faK MqlMca<+ON>vyllQVZwl zeH~rF#8*iND>y*r*k%9#4A4nLK~#9!?OTbK;~)+kBd`q?CY=BOsawK!-$|U=PUh`< z>$$rpAcRy^68O)b|3Cl5bJ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