diff -ruN javie-0.3.6-src/ch.kuramo.javie.api/META-INF/MANIFEST.MF javie-0.3.7-src/ch.kuramo.javie.api/META-INF/MANIFEST.MF --- javie-0.3.6-src/ch.kuramo.javie.api/META-INF/MANIFEST.MF 2010-03-19 22:41:22.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.api/META-INF/MANIFEST.MF 2010-03-25 01:38:17.000000000 +0900 @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Javie API Bundle-SymbolicName: ch.kuramo.javie.api;singleton:=true -Bundle-Version: 0.3.6.qualifier +Bundle-Version: 0.3.7.qualifier Bundle-Vendor: rakusan Export-Package: ch.kuramo.javie.api, ch.kuramo.javie.api.annotations, diff -ruN javie-0.3.6-src/ch.kuramo.javie.app/META-INF/MANIFEST.MF javie-0.3.7-src/ch.kuramo.javie.app/META-INF/MANIFEST.MF --- javie-0.3.6-src/ch.kuramo.javie.app/META-INF/MANIFEST.MF 2010-03-19 22:41:22.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.app/META-INF/MANIFEST.MF 2010-03-25 01:38:17.000000000 +0900 @@ -2,15 +2,15 @@ Bundle-ManifestVersion: 2 Bundle-Name: Javie Application Plug-in Bundle-SymbolicName: ch.kuramo.javie.app; singleton:=true -Bundle-Version: 0.3.6.qualifier +Bundle-Version: 0.3.7.qualifier Bundle-Activator: ch.kuramo.javie.app.Activator Bundle-Vendor: rakusan Require-Bundle: org.eclipse.ui, org.eclipse.ui.console, org.eclipse.core.runtime, - ch.kuramo.javie.api;bundle-version="0.3.6", - ch.kuramo.javie.core;bundle-version="0.3.6", - ch.kuramo.javie.effects;bundle-version="0.3.6", + ch.kuramo.javie.api;bundle-version="0.3.7", + ch.kuramo.javie.core;bundle-version="0.3.7", + ch.kuramo.javie.effects;bundle-version="0.3.7", com.google.code.guice;bundle-version="2.0.0", javassist;bundle-version="3.11.0", org.scannotation;bundle-version="1.0.2", diff -ruN javie-0.3.6-src/ch.kuramo.javie.app/README.txt javie-0.3.7-src/ch.kuramo.javie.app/README.txt --- javie-0.3.6-src/ch.kuramo.javie.app/README.txt 2010-03-19 23:19:37.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.app/README.txt 2010-03-25 01:39:35.000000000 +0900 @@ -1,5 +1,5 @@ ====================================================================== -Javie 0.3.6 +Javie 0.3.7 ====================================================================== ------------ @@ -89,6 +89,11 @@ バージョン履歴 -------------- +2010-03-25 ver 0.3.7 + ・更新マネージャを使用して更新できる最初のバージョン + ・グローエフェクトを追加 + ・放射状ワイプエフェクトを追加(いくつか不備があるため暫定版です) + 2010-03-25 ver 0.3.6  ・更新マネージャの組み込み  ・Windows版をGMA X4500に対応(一部機能制限あり) diff -ruN javie-0.3.6-src/ch.kuramo.javie.app/app.product javie-0.3.7-src/ch.kuramo.javie.app/app.product --- javie-0.3.6-src/ch.kuramo.javie.app/app.product 2010-03-19 22:47:53.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.app/app.product 2010-03-25 01:39:35.000000000 +0900 @@ -1,11 +1,11 @@ - + - Javie 0.3.6 + Javie 0.3.7 Copyright (c) 2009,2010 Yoshikazu Kuramochi All rights reserved. @@ -77,7 +77,7 @@ - + diff -ruN javie-0.3.6-src/ch.kuramo.javie.app/plugin.xml javie-0.3.7-src/ch.kuramo.javie.app/plugin.xml --- javie-0.3.6-src/ch.kuramo.javie.app/plugin.xml 2010-03-19 22:47:53.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.app/plugin.xml 2010-03-25 01:39:35.000000000 +0900 @@ -13,7 +13,7 @@ + value="Javie 0.3.7 Copyright (c) 2009,2010 Yoshikazu Kuramochi All rights reserved. This product include third party software: Eclipse RCP: http://www.eclipse.org/ FreeType2: http://www.freetype.org/ FTGL: http://sourceforge.net/projects/ftgl/ Guice: http://code.google.com/p/google-guice/ Vecmath: https://vecmath.dev.java.net/ Javassist: http://www.csg.is.titech.ac.jp/~chiba/javassist/ JOGL: http://kenai.com/projects/jogl/ JSONIC: http://jsonic.sourceforge.jp/ JNA: https://jna.dev.java.net/ Scannotation: http://sourceforge.net/projects/scannotation/ SLF4J: http://www.slf4j.org/ Rhino: http://www.mozilla.org/rhino/ Tritonus: http://www.tritonus.org/"> diff -ruN javie-0.3.6-src/ch.kuramo.javie.app.feature/feature.xml javie-0.3.7-src/ch.kuramo.javie.app.feature/feature.xml --- javie-0.3.6-src/ch.kuramo.javie.app.feature/feature.xml 2010-03-20 21:32:42.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.app.feature/feature.xml 2010-03-25 01:39:35.000000000 +0900 @@ -1,8 +1,8 @@ - - - + + + diff -ruN javie-0.3.6-src/ch.kuramo.javie.core/META-INF/MANIFEST.MF javie-0.3.7-src/ch.kuramo.javie.core/META-INF/MANIFEST.MF --- javie-0.3.6-src/ch.kuramo.javie.core/META-INF/MANIFEST.MF 2010-03-19 22:41:22.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.core/META-INF/MANIFEST.MF 2010-03-25 01:38:17.000000000 +0900 @@ -2,14 +2,14 @@ Bundle-ManifestVersion: 2 Bundle-Name: Javie Core Plug-in Bundle-SymbolicName: ch.kuramo.javie.core;singleton:=true -Bundle-Version: 0.3.6.qualifier +Bundle-Version: 0.3.7.qualifier Bundle-Vendor: rakusan Export-Package: ch.kuramo.javie.core, ch.kuramo.javie.core.misc, ch.kuramo.javie.core.output, ch.kuramo.javie.core.services Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: ch.kuramo.javie.api;bundle-version="0.3.6", +Require-Bundle: ch.kuramo.javie.api;bundle-version="0.3.7", com.google.code.guice;bundle-version="2.0.0", javassist;bundle-version="3.11.0", org.scannotation;bundle-version="1.0.2", diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/META-INF/MANIFEST.MF javie-0.3.7-src/ch.kuramo.javie.effects/META-INF/MANIFEST.MF --- javie-0.3.6-src/ch.kuramo.javie.effects/META-INF/MANIFEST.MF 2010-03-19 22:41:22.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/META-INF/MANIFEST.MF 2010-03-25 01:38:17.000000000 +0900 @@ -2,8 +2,8 @@ Bundle-ManifestVersion: 2 Bundle-Name: Javie Effects Bundle-SymbolicName: ch.kuramo.javie.effects;singleton:=true -Bundle-Version: 0.3.6.qualifier +Bundle-Version: 0.3.7.qualifier Bundle-Vendor: rakusan Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: ch.kuramo.javie.api;bundle-version="0.3.6" +Require-Bundle: ch.kuramo.javie.api;bundle-version="0.3.7" Eclipse-BuddyPolicy: global diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/colorCorrection/Tritone.java javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/colorCorrection/Tritone.java --- javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/colorCorrection/Tritone.java 2010-03-12 09:35:35.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/colorCorrection/Tritone.java 2010-03-24 23:41:36.000000000 +0900 @@ -60,7 +60,7 @@ "void main(void)", "{", " vec4 src = texture2DRect(texture, gl_TexCoord[0].st);", - " float y = dot(src.rgb/src.a, yvec);", // src.a == 0.0 縺ョ蝣エ蜷医〒繧よョ九j縺ョ險育ョ励↓蠖ア髻ソ縺ッ縺ェ縺縲 + " float y = (src.a != 0.0) ? dot(src.rgb/src.a, yvec) : 0.0;", " vec3 rgb;", " if (y > 0.5) {", " float y2 = (y-0.5)*2.0;", diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/Glow.java javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/Glow.java --- javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/Glow.java 1970-01-01 09:00:00.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/Glow.java 2010-03-24 10:32:35.000000000 +0900 @@ -0,0 +1,980 @@ +/* + * Copyright (c) 2010 Yoshikazu Kuramochi + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.kuramo.javie.effects.stylize; + +import javax.media.opengl.GL2; +import javax.media.opengl.glu.GLU; + +import ch.kuramo.javie.api.Color; +import ch.kuramo.javie.api.IAnimatableBoolean; +import ch.kuramo.javie.api.IAnimatableColor; +import ch.kuramo.javie.api.IAnimatableDouble; +import ch.kuramo.javie.api.IAnimatableEnum; +import ch.kuramo.javie.api.IShaderProgram; +import ch.kuramo.javie.api.IVideoBuffer; +import ch.kuramo.javie.api.VideoBounds; +import ch.kuramo.javie.api.annotations.Effect; +import ch.kuramo.javie.api.annotations.GLProgram; +import ch.kuramo.javie.api.annotations.GLShader; +import ch.kuramo.javie.api.annotations.Property; +import ch.kuramo.javie.api.annotations.GLShader.ShaderType; +import ch.kuramo.javie.api.services.IShaderRegistry; +import ch.kuramo.javie.api.services.IVideoEffectContext; +import ch.kuramo.javie.effects.VideoEffectUtil; +import ch.kuramo.javie.effects.blurSharpen.BlurUtil; + +import com.google.inject.Inject; + +@Effect(id="ch.kuramo.javie.Glow", category=Effect.STYLIZE) +public class Glow { + +// public enum GlowBase { ALPHA, COLOR } + + public enum GlowComposite { ON_TOP, BEHIND, NONE } + + public enum GlowDimensions { BOTH, HORIZONTAL, VERTICAL } + + public enum GlowOperation { + NONE, + NORMAL, + DISSOLVE, + //DANCING_DISSOLVE, + + DARKEN, + MULTIPLY, + COLOR_BURN, + LINEAR_BURN, // AE縺ォ縺ッ辟。縺 + DARKER_COLOR, // AE縺ォ縺ッ辟。縺 + + ADD, + LIGHTEN, + SCREEN, + COLOR_DODGE, + LINEAR_DODGE, // AE縺ォ縺ッ辟。縺 + LIGHTER_COLOR, // AE縺ォ縺ッ辟。縺 + + OVERLAY, + SOFT_LIGHT, + HARD_LIGHT, + LINEAR_LIGHT, // AE縺ォ縺ッ辟。縺 + VIVID_LIGHT, // AE縺ォ縺ッ辟。縺 + PIN_LIGHT, // AE縺ォ縺ッ辟。縺 + HARD_MIX, // AE縺ォ縺ッ辟。縺 + + DIFFERENCE, + EXCLUSION, + + HUE, + SATURATION, + COLOR, + LUMINOSITY, + + STENCIL_ALPHA, + STENCIL_LUMA, + SILHOUETTE_ALPHA, + SILHOUETTE_LUMA; + } + + public enum GlowColors { ORIGINAL_COLORS, A_AND_B_COLORS } + + public enum GlowLooping { SAWTOOTH_AB, SAWTOOTH_BA, TRIANGLE_ABA, TRIANGLE_BAB } + + +// @Property("COLOR") +// private IAnimatableEnum base; + + @Property(value="60", min="0", max="100") + private IAnimatableDouble threshold; + + @Property(value="10", min="0", max="500") + private IAnimatableDouble radius; + + @Property(value="1", min="0", max="255") + private IAnimatableDouble intensity; + + @Property("NONE") + private IAnimatableEnum composite; + + @Property("ADD") + private IAnimatableEnum operation; + + @Property + private IAnimatableEnum colors; + + @Property("TRIANGLE_ABA") + private IAnimatableEnum colorLooping; + + @Property(value="1", min="1", max="127") + private IAnimatableDouble colorLoops; + + @Property + private IAnimatableDouble colorPhase; + + @Property(value="50", min="0", max="100") + private IAnimatableDouble abMidpoint; + + @Property("1,1,1") + private IAnimatableColor colorA; + + @Property("0,0,0") + private IAnimatableColor colorB; + + @Property + private IAnimatableEnum dimensions; + + @Property("true") + private IAnimatableBoolean fast; + + + private final IVideoEffectContext context; + + private final IShaderRegistry shaders; + + private final IShaderProgram oColorsThresholdProgram; + + private final IShaderProgram abColorsThresholdProgram; + + private final IShaderProgram sawtoothProgram; + + private final IShaderProgram triangleProgram; + + private final IShaderProgram oColorsIntensityProgram; + + private final IShaderProgram abColorsIntensityProgram; + + @Inject + public Glow(IVideoEffectContext context, IShaderRegistry shaders) { + this.context = context; + this.shaders = shaders; + oColorsThresholdProgram = shaders.getProgram(Glow.class, "OCOLORS_THRESHOLD"); + abColorsThresholdProgram = shaders.getProgram(Glow.class, "ABCOLORS_THRESHOLD"); + sawtoothProgram = shaders.getProgram(Glow.class, "SAWTOOTH"); + triangleProgram = shaders.getProgram(Glow.class, "TRIANGLE"); + oColorsIntensityProgram = shaders.getProgram(Glow.class, "OCOLORS_INTENSITY"); + abColorsIntensityProgram = shaders.getProgram(Glow.class, "ABCOLORS_INTENSITY"); + } + + public VideoBounds getVideoBounds() { + // GaussianBlur縺ィ縺サ縺シ蜷後§縲 + + double radius = context.value(this.radius); + if (radius == 0) { + return null; + } + + GlowDimensions dimensions = context.value(this.dimensions); + boolean horz = (dimensions != GlowDimensions.VERTICAL); + boolean vert = (dimensions != GlowDimensions.HORIZONTAL); + + // blur縺50繧医j螟ァ縺阪>蝣エ蜷医ッfast繝励Ο繝代ユ繧」縺ョ蛟、縺ォ縺九°繧上i縺夐ォ倬溘Δ繝シ繝 + boolean fast = (radius > 50) || context.value(this.fast); + + // 繝ャ繝ウ繝繝ェ繝ウ繧ー隗」蜒丞コヲ縺ォ蜷医o縺帙※blur縺ョ蛟、繧貞、画鋤 + radius = context.getRenderResolution().scale(radius); + + + VideoBounds bounds = context.getPreviousBounds(); + + int sampleRatio = 1; + if (fast) { + for (int factor : BlurUtil.getDownSampleFactors(radius)) { + int hFactor = horz ? factor : 1; + int vFactor = vert ? factor : 1; + bounds = new VideoBounds(bounds.x/hFactor, bounds.y/vFactor, + (bounds.width+hFactor-1)/hFactor, (bounds.height+vFactor-1)/vFactor); + sampleRatio *= factor; + } + radius /= sampleRatio; + } + + int ceiledRadius = (int) Math.ceil(radius); + + + bounds = VideoEffectUtil.expandBounds(bounds, ceiledRadius, horz, vert); + + int hRatio = horz ? sampleRatio : 1; + int vRatio = vert ? sampleRatio : 1; + return new VideoBounds(bounds.x*hRatio, bounds.y*vRatio, + bounds.width*hRatio, bounds.height*vRatio); + } + + public IVideoBuffer doVideoEffect() { + GlowColors colors = context.value(this.colors); + + IVideoBuffer input = null; + IVideoBuffer buf1 = null; + IVideoBuffer buf2 = null; + IVideoBuffer buf3 = null; + IVideoBuffer buf4 = null; + IVideoBuffer buf5 = null; + try { + input = context.doPreviousEffect(); + buf1 = threshold(input, colors); + + buf2 = blur(buf1); + if (buf2 == buf1) buf1 = null; + + if (colors == GlowColors.A_AND_B_COLORS) { + buf3 = abColors(buf2); + } else { + buf3 = buf2; + buf2 = null; + } + + buf4 = intensity(buf3, colors); + if (buf4 == buf3) buf3 = null; + + buf5 = composite(buf4, input); + if (buf5 == buf4) buf4 = null; + + IVideoBuffer result = buf5; + buf5 = null; + return result; + + } finally { + if (input != null) input.dispose(); + if (buf1 != null) buf1.dispose(); + if (buf2 != null) buf2.dispose(); + if (buf3 != null) buf3.dispose(); + if (buf4 != null) buf4.dispose(); + if (buf5 != null) buf5.dispose(); + } + } + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram + public static final String[] OCOLORS_THRESHOLD = { + "uniform sampler2DRect texture;", + "uniform float upper;", + "uniform float lower;", + "", + "const vec3 vec3_000 = vec3(0.0);", + "const vec3 vec3_111 = vec3(1.0);", + "", + "void main(void)", + "{", + " vec4 color = texture2DRect(texture, gl_TexCoord[0].st);", + " float a = color.a;", + " vec3 rgb = (a != 0.0) ? color.rgb/a : vec3(0.0);", + "", + " rgb = clamp((rgb - lower) / (upper - lower), vec3_000, vec3_111);", + "", + " gl_FragColor = vec4(rgb*a, a);", + "}" + }; + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram + public static final String[] ABCOLORS_THRESHOLD = { + "uniform sampler2DRect texture;", + "uniform float upper;", + "uniform float lower;", + "", + "const vec3 lumaVec = vec3(0.299, 0.587, 0.114);", + "", + "void main(void)", + "{", + " vec4 color = texture2DRect(texture, gl_TexCoord[0].st);", + "", + " float luma = dot(color.rgb, lumaVec);", + " luma = clamp((luma - lower) / (upper - lower), 0.0, 1.0);", + "", + " gl_FragColor = vec4(luma);", + "}" + }; + + private IVideoBuffer threshold(IVideoBuffer input, GlowColors colors) { + IShaderProgram program = (colors == GlowColors.ORIGINAL_COLORS) + ? oColorsThresholdProgram : abColorsThresholdProgram; + + double threshold = context.value(this.threshold) / 100; + double upper = Math.min(threshold + 0.0625, 1); + double lower = Math.max(threshold - 0.0625, 0); + + GL2 gl = context.getGL().getGL2(); + GLU glu = context.getGLU(); + + VideoBounds bounds = input.getBounds(); + int w = bounds.width; + int h = bounds.height; + + VideoEffectUtil.ortho2D(gl, glu, w, h); + + IVideoBuffer buffer = null; + try { + buffer = context.createVideoBuffer(bounds); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, buffer.getTexture(), 0); + gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, input.getTexture()); + + synchronized (program) { + gl.glUseProgram(program.getProgram()); + gl.glUniform1i(program.getUniformLocation("texture"), 0); + gl.glUniform1f(program.getUniformLocation("upper"), (float)upper); + gl.glUniform1f(program.getUniformLocation("lower"), (float)lower); + + gl.glBegin(GL2.GL_QUADS); + gl.glTexCoord2f(0, 0); + gl.glVertex2f(0, 0); + gl.glTexCoord2f(w, 0); + gl.glVertex2f(w, 0); + gl.glTexCoord2f(w, h); + gl.glVertex2f(w, h); + gl.glTexCoord2f(0, h); + gl.glVertex2f(0, h); + gl.glEnd(); + + gl.glFinish(); + gl.glUseProgram(0); + } + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, 0); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, 0, 0); + + IVideoBuffer result = buffer; + buffer = null; + return result; + + } finally { + if (buffer != null) buffer.dispose(); + } + } + + private IVideoBuffer blur(IVideoBuffer input) { + double radius = context.value(this.radius); + if (radius == 0) { + return input; + } + + GlowDimensions dimensions = context.value(this.dimensions); + boolean horz = (dimensions != GlowDimensions.VERTICAL); + boolean vert = (dimensions != GlowDimensions.HORIZONTAL); + + boolean fast = (radius > 50) || context.value(this.fast); + + radius = context.getRenderResolution().scale(radius); + + GL2 gl = context.getGL().getGL2(); + GLU glu = context.getGLU(); + + return blur(input, radius, false, horz, vert, fast, gl, glu); + } + + private IVideoBuffer blur( + IVideoBuffer input, double blur, boolean repeatEdgePixels, + boolean horz, boolean vert, boolean fast, GL2 gl, GLU glu) { + + // TODO 莉・荳九ッ GaussianBlur 縺九i荳ク縲繧ウ繝斐壹@縺溘b縺ョ縲よ紛逅縺吶k縲 + + VideoBounds inputBounds = input.getBounds(); + + int sampleRatio = 1; + if (fast) { + VideoBounds bounds = inputBounds; + for (int factor : BlurUtil.getDownSampleFactors(blur)) { + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(input, gl); + } + + int hFactor = horz ? factor : 1; + int vFactor = vert ? factor : 1; + bounds = new VideoBounds(bounds.x/hFactor, bounds.y/vFactor, + (bounds.width+hFactor-1)/hFactor, (bounds.height+vFactor-1)/vFactor); + + IVideoBuffer buf = context.createVideoBuffer(bounds); + BlurUtil.doDownSample(input, buf, hFactor, vFactor, gl, glu, shaders); + input.dispose(); + input = buf; + + sampleRatio *= factor; + } + blur /= sampleRatio; + } + + int radius = (int) Math.ceil(blur); + + + // 讓呎コ門¥蟾ョ縺ョ2.5蛟阪ョ菴咲スョ縺後⊂縺九@縺ョ遶ッ縺ィ縺ェ繧九h縺縺ォ縺吶kシ医%繧後〒縺縺縺溘>AE縺ィ蜷後§縺ォ縺ェ繧具シ + double sigma = blur / 2.5; + double sigmaSquare = sigma * sigma; + + float[] kernel = new float[radius*2+1]; + float sum = 0; + for (int i = 1; i <= radius; ++i) { + sum += 2 * (kernel[radius-i] = (float) Math.exp(-i * i / (2 * sigmaSquare))); + } + kernel[radius] = 1 / (++sum); + for (int i = 1; i <= radius; ++i) { + kernel[radius+i] = (kernel[radius-i] /= sum); + } + + + IVideoBuffer buf1 = null, buf2 = null, buf3 = null; + try { + if (horz) { + VideoBounds bounds = input.getBounds(); + + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(input, gl); + } else { + bounds = VideoEffectUtil.expandBounds(bounds, radius, true, false); + } + + buf1 = context.createVideoBuffer(bounds); + VideoEffectUtil.convolution1D(input, buf1, true, radius, kernel, gl, glu, shaders); + } else { + buf1 = input; + input = null; + } + + if (vert) { + VideoBounds bounds = buf1.getBounds(); + + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(buf1, gl); + } else { + bounds = VideoEffectUtil.expandBounds(bounds, radius, false, true); + } + + buf2 = context.createVideoBuffer(bounds); + VideoEffectUtil.convolution1D(buf1, buf2, false, radius, kernel, gl, glu, shaders); + } else { + buf2 = buf1; + buf1 = null; + } + + if (sampleRatio != 1) { + int hRatio = horz ? sampleRatio : 1; + int vRatio = vert ? sampleRatio : 1; + VideoBounds bounds; + + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(buf2, gl); + bounds = inputBounds; + } else { + bounds = buf2.getBounds(); + bounds = new VideoBounds(bounds.x*hRatio, bounds.y*vRatio, bounds.width*hRatio, bounds.height*vRatio); + } + + buf3 = context.createVideoBuffer(bounds); + BlurUtil.doUpSample(buf2, buf3, hRatio, vRatio, gl, glu); + } else { + buf3 = buf2; + buf2 = null; + } + + return buf3; + + } finally { + if (input != null) { + input.dispose(); + } + if (buf1 != null) { + buf1.dispose(); + } + if (buf2 != null) { + buf2.dispose(); + } + } + } + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram + public static final String[] SAWTOOTH = { + "uniform sampler2DRect texture;", + "uniform float loops;", + "uniform float phase;", + "uniform float midpoint;", + "uniform vec3 colorA;", + "uniform vec3 colorM;", + "uniform vec3 colorB;", + "", + "void main(void)", + "{", + " vec4 color = texture2DRect(texture, gl_TexCoord[0].st);", + " float a = color.a;", + " float t = phase + a * loops;", + "", + " if (t > 1.0) {", + " t -= floor(t);", + " }", + "", + " vec3 rgb;", + " if (t > midpoint) {", + " t = (t-midpoint)/(1.0-midpoint);", + " rgb = colorA*t + colorM*(1.0-t);", + " } else {", + " t = t/midpoint;", + " rgb = colorB*(1.0-t) + colorM*t;", + " }", + "", + " gl_FragColor = vec4(rgb, 1.0)*a;", + "}" + }; + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram + public static final String[] TRIANGLE = { + "uniform sampler2DRect texture;", + "uniform float loops;", + "uniform float phase;", + "uniform float midpoint;", + "uniform vec3 colorA;", + "uniform vec3 colorM;", + "uniform vec3 colorB;", + "", + "void main(void)", + "{", + " vec4 color = texture2DRect(texture, gl_TexCoord[0].st);", + " float a = color.a;", + " float t = phase + a * loops;", + "", + " t = 1.0 - 2.0 * abs(t - floor(t) - 0.5);", // SAWTOOTH縺ィ縺ッ縺薙ョシ題。後′逡ー縺ェ繧九□縺代 + "", + " vec3 rgb;", + " if (t > midpoint) {", + " t = (t-midpoint)/(1.0-midpoint);", + " rgb = colorA*t + colorM*(1.0-t);", + " } else {", + " t = t/midpoint;", + " rgb = colorB*(1.0-t) + colorM*t;", + " }", + "", + " gl_FragColor = vec4(rgb, 1.0)*a;", + "}" + }; + + private IVideoBuffer abColors(IVideoBuffer input) { + GlowLooping looping = context.value(colorLooping); + double loops = context.value(colorLoops); + double phase = context.value(colorPhase) / 360; + double midpoint = 1 - context.value(abMidpoint) / 100; + + Color colorA; + Color colorB; + if (looping == GlowLooping.SAWTOOTH_AB || looping == GlowLooping.TRIANGLE_ABA) { + colorA = context.value(this.colorA); + colorB = context.value(this.colorB); + } else { + colorA = context.value(this.colorB); + colorB = context.value(this.colorA); + } + Color colorM = new Color((colorA.r+colorB.r)/2, (colorA.g+colorB.g)/2, (colorA.b+colorB.b)/2); + + IShaderProgram program = (looping == GlowLooping.SAWTOOTH_AB || looping == GlowLooping.SAWTOOTH_BA) + ? sawtoothProgram : triangleProgram; + + GL2 gl = context.getGL().getGL2(); + GLU glu = context.getGLU(); + + VideoBounds bounds = input.getBounds(); + int w = bounds.width; + int h = bounds.height; + + VideoEffectUtil.ortho2D(gl, glu, w, h); + + IVideoBuffer buffer = null; + try { + buffer = context.createVideoBuffer(bounds); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, buffer.getTexture(), 0); + gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, input.getTexture()); + + synchronized (program) { + gl.glUseProgram(program.getProgram()); + gl.glUniform1i(program.getUniformLocation("texture"), 0); + gl.glUniform1f(program.getUniformLocation("loops"), (float)loops); + gl.glUniform1f(program.getUniformLocation("phase"), (float)phase); + gl.glUniform1f(program.getUniformLocation("midpoint"), (float)midpoint); + gl.glUniform3f(program.getUniformLocation("colorA"), (float)colorA.r, (float)colorA.g, (float)colorA.b); + gl.glUniform3f(program.getUniformLocation("colorM"), (float)colorM.r, (float)colorM.g, (float)colorM.b); + gl.glUniform3f(program.getUniformLocation("colorB"), (float)colorB.r, (float)colorB.g, (float)colorB.b); + + gl.glBegin(GL2.GL_QUADS); + gl.glTexCoord2f(0, 0); + gl.glVertex2f(0, 0); + gl.glTexCoord2f(w, 0); + gl.glVertex2f(w, 0); + gl.glTexCoord2f(w, h); + gl.glVertex2f(w, h); + gl.glTexCoord2f(0, h); + gl.glVertex2f(0, h); + gl.glEnd(); + + gl.glFinish(); + gl.glUseProgram(0); + } + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, 0); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, 0, 0); + + IVideoBuffer result = buffer; + buffer = null; + return result; + + } finally { + if (buffer != null) buffer.dispose(); + } + } + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram + public static final String[] OCOLORS_INTENSITY = { + "uniform sampler2DRect texture;", + "uniform float intensity;", + "", + "void main(void)", + "{", + " vec4 color = texture2DRect(texture, gl_TexCoord[0].st);", + " gl_FragColor = vec4(color.rgb*intensity, color.a);", +// " gl_FragColor = vec4(min(color.rgb*intensity, color.a), color.a);", // TODO 8bit/16bit謨エ謨ー繧ウ繝ウ繝昴ッ縺薙▲縺。縺ォ縺励◆譁ケ縺後>縺九bシ + "}" + }; + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram + public static final String[] ABCOLORS_INTENSITY = { + "uniform sampler2DRect texture;", + "uniform float intensity;", + "", + "void main(void)", + "{", + " vec4 color = texture2DRect(texture, gl_TexCoord[0].st);", + " gl_FragColor = vec4(color.rgb*intensity, min(color.a*intensity, 1.0));", // min縺ッ豬ョ蜍募ー乗焚繧ウ繝ウ繝晉畑縲よ紛謨ー繧ウ繝ウ繝昴〒縺ッ蜍晄焔縺ォ繧ッ繝ェ繝繝励&繧後k縲 + "}" + }; + + private IVideoBuffer intensity(IVideoBuffer input, GlowColors colors) { + double intensity = context.value(this.intensity); + if (intensity == 1) { + return input; + } + + IShaderProgram program = (colors == GlowColors.ORIGINAL_COLORS) + ? oColorsIntensityProgram : abColorsIntensityProgram; + + GL2 gl = context.getGL().getGL2(); + GLU glu = context.getGLU(); + + VideoBounds bounds = input.getBounds(); + int w = bounds.width; + int h = bounds.height; + + VideoEffectUtil.ortho2D(gl, glu, w, h); + + IVideoBuffer buffer = null; + try { + buffer = context.createVideoBuffer(bounds); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, buffer.getTexture(), 0); + gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, input.getTexture()); + + synchronized (program) { + gl.glUseProgram(program.getProgram()); + gl.glUniform1i(program.getUniformLocation("texture"), 0); + gl.glUniform1f(program.getUniformLocation("intensity"), (float)intensity); + + gl.glBegin(GL2.GL_QUADS); + gl.glTexCoord2f(0, 0); + gl.glVertex2f(0, 0); + gl.glTexCoord2f(w, 0); + gl.glVertex2f(w, 0); + gl.glTexCoord2f(w, h); + gl.glVertex2f(w, h); + gl.glTexCoord2f(0, h); + gl.glVertex2f(0, h); + gl.glEnd(); + + gl.glFinish(); + gl.glUseProgram(0); + } + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, 0); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, 0, 0); + + IVideoBuffer result = buffer; + buffer = null; + return result; + + } finally { + if (buffer != null) buffer.dispose(); + } + } + + private IVideoBuffer composite(IVideoBuffer glow, IVideoBuffer orig) { + GlowComposite composite = context.value(this.composite); + GlowOperation operation = context.value(this.operation); + + if (composite == GlowComposite.NONE && operation == GlowOperation.NONE) { + return glow; + } + + GL2 gl = context.getGL().getGL2(); + GLU glu = context.getGLU(); + + //縲後お繝繧ク繝斐け繧サ繝ォ繧堤ケー繧願ソ斐☆縲肴ゥ溯ス繧剃サ倥¢繧句エ蜷医 + // orig縺ッsetClampToEdge縺輔l縺ヲ縺繧九°繧ゅ@繧後↑縺縺ョ縺ァsetClampToBorder縺励※縺翫¥蠢隕√′縺ゅk縲 + //VideoEffectUtil.setClampToBorder(orig, gl); + + VideoBounds glowBounds = glow.getBounds(); + VideoBounds origBounds = orig.getBounds(); + int w = glowBounds.width; + int h = glowBounds.height; + float ox = (float)(glowBounds.x-origBounds.x); + float oy = (float)(glowBounds.y-origBounds.y); + + VideoEffectUtil.ortho2D(gl, glu, w, h); + + IVideoBuffer buffer = null; + try { + buffer = context.createVideoBuffer(glowBounds); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, buffer.getTexture(), 0); + gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); + + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, glow.getTexture()); + gl.glActiveTexture(GL2.GL_TEXTURE1); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, orig.getTexture()); + + IShaderProgram program = shaders.getProgram(Glow.class, operation.name()); + synchronized (program) { + gl.glUseProgram(program.getProgram()); + gl.glUniform1i(program.getUniformLocation("texGlow"), 0); + gl.glUniform1i(program.getUniformLocation("texOrig"), 1); + gl.glUniform1i(program.getUniformLocation("composite"), composite.ordinal()); + + gl.glBegin(GL2.GL_QUADS); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE0, 0, 0); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE1, ox, oy); + gl.glVertex2f(0, 0); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE0, w, 0); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE1, ox+w, oy); + gl.glVertex2f(w, 0); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE0, w, h); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE1, ox+w, oy+h); + gl.glVertex2f(w, h); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE0, 0, h); + gl.glMultiTexCoord2f(GL2.GL_TEXTURE1, ox, oy+h); + gl.glVertex2f(0, h); + gl.glEnd(); + + gl.glFinish(); + gl.glUseProgram(0); + } + + gl.glActiveTexture(GL2.GL_TEXTURE1); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, 0); + gl.glActiveTexture(GL2.GL_TEXTURE0); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, 0); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, 0, 0); + + IVideoBuffer result = buffer; + buffer = null; + return result; + + } finally { + if (buffer != null) buffer.dispose(); + } + } + + private static final String[] createCompositeSource(String name) { + boolean none = name.equals("none"); + boolean noneOrNormal = none || name.equals("normal"); + + return new String[] { + "uniform sampler2DRect texGlow;", + "uniform sampler2DRect texOrig;", + "uniform int composite;", + "", + "vec4 blend_normal(vec4 pDst, vec4 pSrc, float intensity);", + noneOrNormal ? "" + : String.format("vec4 blend_%s(vec4 pDst, vec4 pSrc, float intensity);", name), + "", + "void main(void)", + "{", + " vec4 glow = texture2DRect(texGlow, gl_TexCoord[0].st);", + " vec4 orig = texture2DRect(texOrig, gl_TexCoord[1].st);", + none ? "" + : String.format(" glow = blend_%s(glow, orig, 1.0);", name), + "", + " gl_FragColor = (composite == 0) ? blend_normal(glow, orig, 1.0) :", + " (composite == 1) ? blend_normal(orig, glow, 1.0) : glow;", + "}" + }; + } + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] NONE = createCompositeSource("none"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] NORMAL = createCompositeSource("normal"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] DISSOLVE = createCompositeSource("dissolve"); + +// @GLShader(ShaderType.FRAGMENT_SHADER) +// @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") +// public static final String[] DANCING_DISSOLVE = createCompositeSource("dancing_dissolve"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] DARKEN = createCompositeSource("darken"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] MULTIPLY = createCompositeSource("multiply"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] COLOR_BURN = createCompositeSource("color_burn"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] LINEAR_BURN = createCompositeSource("linear_burn"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] DARKER_COLOR = createCompositeSource("darker_color"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] ADD = createCompositeSource("add"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] LIGHTEN = createCompositeSource("lighten"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] SCREEN = createCompositeSource("screen"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] COLOR_DODGE = createCompositeSource("color_dodge"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] LINEAR_DODGE = createCompositeSource("linear_dodge"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] LIGHTER_COLOR = createCompositeSource("lighter_color"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] OVERLAY = createCompositeSource("overlay"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] SOFT_LIGHT = createCompositeSource("soft_light"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] HARD_LIGHT = createCompositeSource("hard_light"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] LINEAR_LIGHT = createCompositeSource("linear_light"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] VIVID_LIGHT = createCompositeSource("vivid_light"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] PIN_LIGHT = createCompositeSource("pin_light"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] HARD_MIX = createCompositeSource("hard_mix"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] DIFFERENCE = createCompositeSource("difference"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] EXCLUSION = createCompositeSource("exclusion"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] HUE = createCompositeSource("hue"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] SATURATION = createCompositeSource("saturation"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] COLOR = createCompositeSource("color"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] LUMINOSITY = createCompositeSource("luminosity"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] STENCIL_ALPHA = createCompositeSource("stencil_alpha"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] STENCIL_LUMA = createCompositeSource("stencil_luma"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] SILHOUETTE_ALPHA = createCompositeSource("silhouette_alpha"); + + @GLShader(ShaderType.FRAGMENT_SHADER) + @GLProgram(attach="ch.kuramo.javie.core.shaders.BlendModeShaders.blend_functions") + public static final String[] SILHOUETTE_LUMA = createCompositeSource("silhouette_luma"); + +} diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/messages_ja.properties javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/messages_ja.properties --- javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/messages_ja.properties 2009-12-26 23:37:34.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/stylize/messages_ja.properties 2010-03-24 00:23:54.000000000 +0900 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Yoshikazu Kuramochi +# Copyright (c) 2009,2010 Yoshikazu Kuramochi # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -25,3 +25,81 @@ Mosaic.horizontalBlocks.label=\u6c34\u5e73\u30d6\u30ed\u30c3\u30af Mosaic.verticalBlocks.label=\u5782\u76f4\u30d6\u30ed\u30c3\u30af Mosaic.sharpColors.label=\u30b7\u30e3\u30fc\u30d7\u30ab\u30e9\u30fc + +Glow.label=\u30b0\u30ed\u30fc +#Glow.base.label=\u30b0\u30ed\u30fc\u57fa\u6e96 +Glow.threshold.label=\u30b0\u30ed\u30fc\u3057\u304d\u3044\u5024 +Glow.threshold.increment=0.1 +Glow.threshold.unit=% +Glow.radius.label=\u30b0\u30ed\u30fc\u534a\u5f84 +Glow.intensity.label=\u30b0\u30ed\u30fc\u5f37\u5ea6 +Glow.intensity.increment=0.01 +Glow.intensity.displayPrecision=2 +Glow.composite.label=\u5143\u3092\u5408\u6210 +Glow.operation.label=\u30b0\u30ed\u30fc\u64cd\u4f5c +Glow.colors.label=\u30b0\u30ed\u30fc\u30ab\u30e9\u30fc +Glow.colorLooping.label=\u30ab\u30e9\u30fc\u30eb\u30fc\u30d4\u30f3\u30b0 +Glow.colorLoops.label=\u30ab\u30e9\u30fc\u30eb\u30fc\u30d7 +Glow.colorLoops.increment=0.01 +Glow.colorLoops.displayPrecision=2 +Glow.colorPhase.label=\u30ab\u30e9\u30fc\u30d5\u30a7\u30fc\u30ba +Glow.abMidpoint.label=A & B \u4e2d\u9593\u70b9 +Glow.abMidpoint.increment=0.1 +Glow.colorA.label=\u30ab\u30e9\u30fcA +Glow.colorB.label=\u30ab\u30e9\u30fcB +Glow.dimensions.label=\u30b0\u30ed\u30fc\u306e\u65b9\u5411 +Glow.fast.label=\u9ad8\u901f + +#GlowBase.ALPHA=\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb +#GlowBase.COLOR=\u30ab\u30e9\u30fc\u30c1\u30e3\u30f3\u30cd\u30eb +GlowComposite.ON_TOP=\u4e0a +GlowComposite.BEHIND=\u5f8c\u308d +GlowComposite.NONE=\u306a\u3057 +GlowColors.ORIGINAL_COLORS=\u5143\u306e\u30ab\u30e9\u30fc +GlowColors.A_AND_B_COLORS=A & B \u30ab\u30e9\u30fc +GlowLooping.SAWTOOTH_AB=\u306e\u3053\u304e\u308a\u6ce2 A>B +GlowLooping.SAWTOOTH_BA=\u306e\u3053\u304e\u308a\u6ce2 B>A +GlowLooping.TRIANGLE_ABA=\u4e09\u89d2\u5f62 A>B>A +GlowLooping.TRIANGLE_BAB=\u4e09\u89d2\u5f62 B>A>B +GlowDimensions.BOTH=\u6c34\u5e73\u304a\u3088\u3073\u5782\u76f4 +GlowDimensions.HORIZONTAL=\u6c34\u5e73 +GlowDimensions.VERTICAL=\u5782\u76f4 + +GlowOperation.NONE=\u306a\u3057 +GlowOperation.NORMAL=\u901a\u5e38 +GlowOperation.DISSOLVE=\u30c7\u30a3\u30b6\u5408\u6210 +#GlowOperation.DANCING_DISSOLVE=\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30c7\u30a3\u30b6\u5408\u6210 + +GlowOperation.DARKEN=\u6bd4\u8f03(\u6697) +GlowOperation.MULTIPLY=\u4e57\u7b97 +GlowOperation.COLOR_BURN=\u713c\u304d\u8fbc\u307f\u30ab\u30e9\u30fc +GlowOperation.LINEAR_BURN=\u713c\u304d\u8fbc\u307f\u30ea\u30cb\u30a2 +GlowOperation.DARKER_COLOR=\u30ab\u30e9\u30fc\u6bd4\u8f03(\u6697) + +GlowOperation.ADD=\u52a0\u7b97 +GlowOperation.LIGHTEN=\u6bd4\u8f03(\u660e) +GlowOperation.SCREEN=\u30b9\u30af\u30ea\u30fc\u30f3 +GlowOperation.COLOR_DODGE=\u8986\u3044\u713c\u304d\u30ab\u30e9\u30fc +GlowOperation.LINEAR_DODGE=\u8986\u3044\u713c\u304d\u30ea\u30cb\u30a2 +GlowOperation.LIGHTER_COLOR=\u30ab\u30e9\u30fc\u6bd4\u8f03(\u660e) + +GlowOperation.OVERLAY=\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4 +GlowOperation.SOFT_LIGHT=\u30bd\u30d5\u30c8\u30e9\u30a4\u30c8 +GlowOperation.HARD_LIGHT=\u30cf\u30fc\u30c9\u30e9\u30a4\u30c8 +GlowOperation.LINEAR_LIGHT=\u30ea\u30cb\u30a2\u30e9\u30a4\u30c8 +GlowOperation.VIVID_LIGHT=\u30d3\u30d3\u30c3\u30c9\u30e9\u30a4\u30c8 +GlowOperation.PIN_LIGHT=\u30d4\u30f3\u30e9\u30a4\u30c8 +GlowOperation.HARD_MIX=\u30cf\u30fc\u30c9\u30df\u30c3\u30af\u30b9 + +GlowOperation.DIFFERENCE=\u5dee +GlowOperation.EXCLUSION=\u9664\u5916 + +GlowOperation.HUE=\u8272\u76f8 +GlowOperation.SATURATION=\u5f69\u5ea6 +GlowOperation.COLOR=\u30ab\u30e9\u30fc +GlowOperation.LUMINOSITY=\u8f1d\u5ea6 + +GlowOperation.STENCIL_ALPHA=\u30b9\u30c6\u30f3\u30b7\u30eb\u30a2\u30eb\u30d5\u30a1 +GlowOperation.STENCIL_LUMA=\u30b9\u30c6\u30f3\u30b7\u30eb\u30eb\u30df\u30ca\u30f3\u30b9 +GlowOperation.SILHOUETTE_ALPHA=\u30b7\u30eb\u30a8\u30c3\u30c8\u30a2\u30eb\u30d5\u30a1 +GlowOperation.SILHOUETTE_LUMA=\u30b7\u30eb\u30a8\u30c3\u30c8\u30eb\u30df\u30ca\u30f3\u30b9 diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/LinearWipe.java javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/LinearWipe.java --- javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/LinearWipe.java 2010-03-12 09:35:35.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/LinearWipe.java 2010-03-22 14:07:42.000000000 +0900 @@ -110,7 +110,6 @@ GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, input.getTexture(), 0); gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); - gl.glActiveTexture(GL2.GL_TEXTURE0); gl.glBindTexture(GL2.GL_TEXTURE_1D, wipeTex[0]); gl.glTexParameteri(GL2.GL_TEXTURE_1D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR); gl.glTexParameteri(GL2.GL_TEXTURE_1D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR); diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/RadialWipe.java javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/RadialWipe.java --- javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/RadialWipe.java 1970-01-01 09:00:00.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/RadialWipe.java 2010-03-24 21:30:09.000000000 +0900 @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2010 Yoshikazu Kuramochi + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.kuramo.javie.effects.transition; + +import java.util.ArrayList; +import java.util.List; + +import javax.media.opengl.GL2; +import javax.media.opengl.glu.GLU; + +import ch.kuramo.javie.api.IAnimatableDouble; +import ch.kuramo.javie.api.IAnimatableEnum; +import ch.kuramo.javie.api.IAnimatableVec2d; +import ch.kuramo.javie.api.IVideoBuffer; +import ch.kuramo.javie.api.RenderResolution; +import ch.kuramo.javie.api.Vec2d; +import ch.kuramo.javie.api.VideoBounds; +import ch.kuramo.javie.api.annotations.Effect; +import ch.kuramo.javie.api.annotations.Property; +import ch.kuramo.javie.api.services.IShaderRegistry; +import ch.kuramo.javie.api.services.IVideoEffectContext; +import ch.kuramo.javie.effects.VideoEffectUtil; +import ch.kuramo.javie.effects.blurSharpen.BlurUtil; + +import com.google.inject.Inject; + +@Effect(id="ch.kuramo.javie.RadialWipe", category=Effect.TRANSITION) +public class RadialWipe { + + public enum TypeOfRadialWipe { CLOCKWISE, COUNTERCLOCKWISE, BOTH } + + + private final IVideoEffectContext context; + + private final IShaderRegistry shaders; + + @Property(min="0", max="100") + private IAnimatableDouble transitionCompletion; + + @Property("0") + private IAnimatableDouble startAngle; + + @Property + private IAnimatableVec2d wipeCenter; + + @Property + private IAnimatableEnum typeOfWipe; + + @Property(min="0", max="500") + private IAnimatableDouble feather; + + + @Inject + public RadialWipe(IVideoEffectContext context, IShaderRegistry shaders) { + this.context = context; + this.shaders = shaders; + } + + public IVideoBuffer doVideoEffect() { + double completion = context.value(transitionCompletion)/100; + if (completion == 0) { + return null; + } else if (completion == 1) { + // TODO context.doPreviousEffect()繧偵@縺ェ縺上※繧7ideoBounds繧貞叙蠕励〒縺阪k譁ケ豕輔′蠢隕√ + // context.getPreviousBounds()繧偵%縺薙〒蜻シ縺カ縺ィIllegalStateException縺檎匱逕溘☆繧九 + IVideoBuffer vb = context.doPreviousEffect(); + VideoEffectUtil.clearTexture(vb, context.getGL().getGL2()); + return vb; + } + + double startAngle = context.value(this.startAngle); + Vec2d wipeCenter = context.value(this.wipeCenter); + TypeOfRadialWipe typeOfWipe = context.value(this.typeOfWipe); + double feather = context.value(this.feather); + + RenderResolution resolution = context.getRenderResolution(); + wipeCenter = resolution.scale(wipeCenter); + feather = resolution.scale(feather); + + + // 譎りィ亥屓繧奇シ丞濠譎りィ亥屓繧翫←縺。繧峨ョ蝣エ蜷医〒繧 startAngle < endAngle 縺ィ縺ェ繧九h縺縺ォ縺吶k縲 + double endAngle; + switch (typeOfWipe) { + case COUNTERCLOCKWISE: + startAngle -= 360*completion; + break; + case BOTH: + startAngle -= 180*completion; + break; + } + if (startAngle < 0) startAngle += 360; + endAngle = startAngle + 360*completion; + + + IVideoBuffer inputBuffer = null; + IVideoBuffer wipeBuffer = null; + try { + inputBuffer = context.doPreviousEffect(); + VideoBounds inputBounds = inputBuffer.getBounds(); + + int wipeBoundsExpand = (int)Math.ceil(feather); + VideoBounds wipeBounds = VideoEffectUtil.expandBounds(inputBounds, wipeBoundsExpand, true, true); + wipeCenter = new Vec2d(wipeCenter.x - wipeBounds.x, wipeCenter.y - wipeBounds.y); + + + // 繝ッ繧、繝励ョ繝槭せ繧ッ繧剃ス懈舌☆繧九◆繧√ョ鬆らせ繧堤畑諢上☆繧九 + double wipeRadius = wipeRadius(wipeBounds, wipeCenter); + List vertices = new ArrayList(); + vertices.add(Vec2d.ZERO); + + double startRad = Math.toRadians(startAngle); + vertices.add(new Vec2d(wipeRadius*Math.sin(startRad), -wipeRadius*Math.cos(startRad))); + + for (int angle = ((int)Math.ceil(startAngle)+45)/90*90+45; angle < endAngle; angle += 90) { + double rad = Math.toRadians(angle); + vertices.add(new Vec2d(wipeRadius*Math.sin(rad), -wipeRadius*Math.cos(rad))); + } + + double endRad = Math.toRadians(endAngle); + vertices.add(new Vec2d(wipeRadius*Math.sin(endRad), -wipeRadius*Math.cos(endRad))); + + + // 繝ッ繧、繝励ョ繝槭せ繧ッ繧剃ス懈舌@縲∝縺ョ逕サ蜒上→繝悶Ξ繝ウ繝峨☆繧九 + GL2 gl = context.getGL().getGL2(); + GLU glu = context.getGLU(); + + wipeBuffer = createWipeBuffer(gl, glu, wipeBounds, wipeCenter, vertices, feather); + + int w = inputBounds.width; + int h = inputBounds.height; + + VideoEffectUtil.ortho2D(gl, glu, w, h); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, inputBuffer.getTexture(), 0); + gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); + + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, wipeBuffer.getTexture()); + gl.glEnable(GL2.GL_TEXTURE_RECTANGLE); + + gl.glEnable(GL2.GL_BLEND); + gl.glBlendFuncSeparate(GL2.GL_ZERO, GL2.GL_SRC_ALPHA, GL2.GL_ZERO, GL2.GL_SRC_ALPHA); + + gl.glBegin(GL2.GL_QUADS); + gl.glColor4f(1, 1, 1, 1); + gl.glTexCoord2f(wipeBoundsExpand, wipeBoundsExpand); + gl.glVertex2f(0, 0); + gl.glTexCoord2f(wipeBoundsExpand+w, wipeBoundsExpand); + gl.glVertex2f(w, 0); + gl.glTexCoord2f(wipeBoundsExpand+w, wipeBoundsExpand+h); + gl.glVertex2f(w, h); + gl.glTexCoord2f(wipeBoundsExpand, wipeBoundsExpand+h); + gl.glVertex2f(0, h); + gl.glEnd(); + + gl.glDisable(GL2.GL_BLEND); + gl.glDisable(GL2.GL_TEXTURE_RECTANGLE); + gl.glBindTexture(GL2.GL_TEXTURE_RECTANGLE, 0); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, 0, 0); + + IVideoBuffer result = inputBuffer; + inputBuffer = null; + return result; + + } finally { + if (wipeBuffer != null) wipeBuffer.dispose(); + if (inputBuffer != null) inputBuffer.dispose(); + } + } + + private double squareOfDistance(double x0, double y0, double x1, double y1) { + double dx = x1 - x0; + double dy = y1 - y0; + return dx*dx + dy*dy; + } + + private double wipeRadius(VideoBounds bounds, Vec2d wipeCenter) { + double left = bounds.x; + double top = bounds.y; + double right = left + bounds.width; + double bottom = top + bounds.height; + + double sq0 = squareOfDistance(wipeCenter.x, wipeCenter.y, left, top); + double sq1 = squareOfDistance(wipeCenter.x, wipeCenter.y, right, top); + double sq2 = squareOfDistance(wipeCenter.x, wipeCenter.y, left, bottom); + double sq3 = squareOfDistance(wipeCenter.x, wipeCenter.y, right, bottom); + + double sq = Math.max(Math.max(Math.max(sq0, sq1), sq2), sq3); + return Math.sqrt(sq) * Math.sqrt(2); + } + + private IVideoBuffer createWipeBuffer( + GL2 gl, GLU glu, VideoBounds wipeBounds, Vec2d wipeCenter, List vertices, double feather) { + + // TODO 繧「繝ォ繝輔ぃ繝√Ε繝ウ繝阪Ν縺縺代r謖√▲縺溘ユ繧ッ繧ケ繝√Ε縺後≠繧後ー濶ッ縺縲 + // 縺励°縺励(nternalFormat繧 GL_ALPHA* 縺ォ縺吶k縺ィ繝輔Ξ繝シ繝繝舌ャ繝輔ぃ縺悟虚菴懊@縺ェ縺シ (繧ィ繝ゥ繝シ1286縺ィ縺ェ繧) + + IVideoBuffer wipeBuffer = context.createVideoBuffer(wipeBounds); + try { + VideoEffectUtil.ortho2D(gl, glu, wipeBounds.width, wipeBounds.height); + + gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glTranslatef((float)wipeCenter.x, (float)wipeCenter.y, 0); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, wipeBuffer.getTexture(), 0); + gl.glDrawBuffer(GL2.GL_COLOR_ATTACHMENT0); + + gl.glClearColor(1, 1, 1, 1); + gl.glClear(GL2.GL_COLOR_BUFFER_BIT); + + gl.glBegin(GL2.GL_POLYGON); + gl.glColor4f(0, 0, 0, 0); + for (Vec2d v : vertices) { + gl.glVertex2f((float)v.x, (float)v.y); + } + gl.glEnd(); + + gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, + GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_RECTANGLE, 0, 0); + + if (feather == 0) { + IVideoBuffer result = wipeBuffer; + wipeBuffer = null; + return result; + } else { + return blur(wipeBuffer, feather, gl, glu); + } + + } finally { + if (wipeBuffer != null) wipeBuffer.dispose(); + } + } + + private IVideoBuffer blur(IVideoBuffer input, double blur, GL2 gl, GLU glu) { + return blur(input, blur, true, true, true, true, gl, glu); + } + + private IVideoBuffer blur( + IVideoBuffer input, double blur, boolean repeatEdgePixels, + boolean horz, boolean vert, boolean fast, GL2 gl, GLU glu) { + + // TODO 莉・荳九ッ GaussianBlur 縺九i荳ク縲繧ウ繝斐壹@縺溘b縺ョ縲よ紛逅縺吶k縲 + // TODO 縺シ縺九☆縺ョ縺ッ繧「繝ォ繝輔ぃ繝√Ε繝ウ繝阪Ν縺縺代〒繧医>縲 + // TODO 縺シ縺九☆縺ョ縺ッ蠅逡檎キ壻サ倩ソ代□縺代〒繧医>縲 + + VideoBounds inputBounds = input.getBounds(); + + int sampleRatio = 1; + if (fast) { + VideoBounds bounds = inputBounds; + for (int factor : BlurUtil.getDownSampleFactors(blur)) { + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(input, gl); + } + + int hFactor = horz ? factor : 1; + int vFactor = vert ? factor : 1; + bounds = new VideoBounds(bounds.x/hFactor, bounds.y/vFactor, + (bounds.width+hFactor-1)/hFactor, (bounds.height+vFactor-1)/vFactor); + + IVideoBuffer buf = context.createVideoBuffer(bounds); + BlurUtil.doDownSample(input, buf, hFactor, vFactor, gl, glu, shaders); + input.dispose(); + input = buf; + + sampleRatio *= factor; + } + blur /= sampleRatio; + } + + int radius = (int) Math.ceil(blur); + + + // 讓呎コ門¥蟾ョ縺ョ2.5蛟阪ョ菴咲スョ縺後⊂縺九@縺ョ遶ッ縺ィ縺ェ繧九h縺縺ォ縺吶kシ医%繧後〒縺縺縺溘>AE縺ィ蜷後§縺ォ縺ェ繧具シ + double sigma = blur / 2.5; + double sigmaSquare = sigma * sigma; + + float[] kernel = new float[radius*2+1]; + float sum = 0; + for (int i = 1; i <= radius; ++i) { + sum += 2 * (kernel[radius-i] = (float) Math.exp(-i * i / (2 * sigmaSquare))); + } + kernel[radius] = 1 / (++sum); + for (int i = 1; i <= radius; ++i) { + kernel[radius+i] = (kernel[radius-i] /= sum); + } + + + IVideoBuffer buf1 = null, buf2 = null, buf3 = null; + try { + if (horz) { + VideoBounds bounds = input.getBounds(); + + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(input, gl); + } else { + bounds = VideoEffectUtil.expandBounds(bounds, radius, true, false); + } + + buf1 = context.createVideoBuffer(bounds); + VideoEffectUtil.convolution1D(input, buf1, true, radius, kernel, gl, glu, shaders); + } else { + buf1 = input; + input = null; + } + + if (vert) { + VideoBounds bounds = buf1.getBounds(); + + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(buf1, gl); + } else { + bounds = VideoEffectUtil.expandBounds(bounds, radius, false, true); + } + + buf2 = context.createVideoBuffer(bounds); + VideoEffectUtil.convolution1D(buf1, buf2, false, radius, kernel, gl, glu, shaders); + } else { + buf2 = buf1; + buf1 = null; + } + + if (sampleRatio != 1) { + int hRatio = horz ? sampleRatio : 1; + int vRatio = vert ? sampleRatio : 1; + VideoBounds bounds; + + if (repeatEdgePixels) { + VideoEffectUtil.setClampToEdge(buf2, gl); + bounds = inputBounds; + } else { + bounds = buf2.getBounds(); + bounds = new VideoBounds(bounds.x*hRatio, bounds.y*vRatio, bounds.width*hRatio, bounds.height*vRatio); + } + + buf3 = context.createVideoBuffer(bounds); + BlurUtil.doUpSample(buf2, buf3, hRatio, vRatio, gl, glu); + } else { + buf3 = buf2; + buf2 = null; + } + + return buf3; + + } finally { + if (input != null) { + input.dispose(); + } + if (buf1 != null) { + buf1.dispose(); + } + if (buf2 != null) { + buf2.dispose(); + } + } + } + +} diff -ruN javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/messages_ja.properties javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/messages_ja.properties --- javie-0.3.6-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/messages_ja.properties 2009-12-27 00:25:31.000000000 +0900 +++ javie-0.3.7-src/ch.kuramo.javie.effects/src/main/java/ch/kuramo/javie/effects/transition/messages_ja.properties 2010-03-22 14:09:59.000000000 +0900 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Yoshikazu Kuramochi +# Copyright (c) 2009,2010 Yoshikazu Kuramochi # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -25,3 +25,13 @@ LinearWipe.transitionCompletion.label=\u5909\u63db\u7d42\u4e86 LinearWipe.wipeAngle.label=\u30ef\u30a4\u30d7\u89d2\u5ea6 LinearWipe.feather.label=\u5883\u754c\u7dda\u3092\u307c\u304b\u3059 + +RadialWipe.label=\u653e\u5c04\u72b6\u30ef\u30a4\u30d7 +RadialWipe.transitionCompletion.label=\u5909\u63db\u7d42\u4e86 +RadialWipe.startAngle.label=\u958b\u59cb\u89d2\u5ea6 +RadialWipe.wipeCenter.label=\u30ef\u30a4\u30d7\u306e\u4e2d\u5fc3 +RadialWipe.typeOfWipe.label=\u30ef\u30a4\u30d7 +RadialWipe.feather.label=\u5883\u754c\u7dda\u3092\u307c\u304b\u3059 +TypeOfRadialWipe.CLOCKWISE=\u6642\u8a08\u56de\u308a +TypeOfRadialWipe.COUNTERCLOCKWISE=\u53cd\u6642\u8a08\u56de\u308a +TypeOfRadialWipe.BOTH=\u4e21\u65b9