Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package javafx.scene.effect; 027 028/** 029 * A blending mode defines the manner in which the inputs of a Blend 030 * effect are composited together or how a Node is blended into the 031 * background of a scene. 032 * 033<PRE> 034import javafx.scene.*; 035import javafx.scene.effect.*; 036import javafx.scene.paint.*; 037import javafx.scene.shape.*; 038 039Rectangle r = new Rectangle(); 040r.setX(50); 041r.setY(50); 042r.setWidth(50); 043r.setHeight(50); 044r.setFill(Color.BLUE); 045 046Circle c = new Circle(); 047c.setFill(Color.rgb(255, 0, 0, 0.5)); 048c.setCenterX(50); 049c.setCenterY(50); 050c.setRadius(25); 051c.setBlendMode(BlendMode.MULTIPLY); 052 053Group g = new Group(); 054g.getChildren().add(r); 055g.getChildren().add(c); 056</PRE> 057 */ 058public enum BlendMode { 059 060 /** 061 * The top input is blended over the bottom input. 062 * (Equivalent to the Porter-Duff "source over destination" rule.) 063 */ 064 SRC_OVER, 065 066 /** 067 * The part of the top input lying inside of the bottom input 068 * is blended with the bottom input. 069 * (Equivalent to the Porter-Duff "source atop destination" rule.) 070 */ 071 SRC_ATOP, 072 073 /** 074 * The color and alpha components from the top input are 075 * added to those from the bottom input. 076 * The result is clamped to 1.0 if it exceeds the logical 077 * maximum of 1.0. 078 * <p> 079 * Notes: 080 * <ul> 081 * <li>This mode is commutative (ordering of inputs 082 * does not matter). 083 * <li>This mode is sometimes referred to as "linear dodge" in 084 * imaging software packages. 085 * </ul> 086 */ 087 ADD, 088 089 /** 090 * The color components from the first input are multiplied with those 091 * from the second input. 092 * The alpha components are blended according to 093 * the {@link #SRC_OVER} equation. 094 * <p> 095 * Notes: 096 * <ul> 097 * <li>This mode is commutative (ordering of inputs 098 * does not matter). 099 * <li>This mode is the mathematical opposite of 100 * the {@link #SCREEN} mode. 101 * <li>The resulting color is always at least as dark as either 102 * of the input colors. 103 * <li>Rendering with a completely black top input produces black; 104 * rendering with a completely white top input produces a result 105 * equivalent to the bottom input. 106 * </ul> 107 */ 108 MULTIPLY, 109 110 /** 111 * The color components from both of the inputs are 112 * inverted, multiplied with each other, and that result 113 * is again inverted to produce the resulting color. 114 * The alpha components are blended according 115 * to the {@link #SRC_OVER} equation. 116 * <p> 117 * Notes: 118 * <ul> 119 * <li>This mode is commutative (ordering of inputs 120 * does not matter). 121 * <li>This mode is the mathematical opposite of 122 * the {@link #MULTIPLY} mode. 123 * <li>The resulting color is always at least as light as either 124 * of the input colors. 125 * <li>Rendering with a completely white top input produces white; 126 * rendering with a completely black top input produces a result 127 * equivalent to the bottom input. 128 * </ul> 129 */ 130 SCREEN, 131 132 /** 133 * The input color components are either multiplied or screened, 134 * depending on the bottom input color. 135 * The alpha components are blended according 136 * to the {@link #SRC_OVER} equation. 137 * <p> 138 * Notes: 139 * <ul> 140 * <li>This mode is a combination of {@link #SCREEN} and 141 * {@link #MULTIPLY}, depending on the bottom input color. 142 * <li>This mode is the mathematical opposite of 143 * the {@link #HARD_LIGHT} mode. 144 * <li>In this mode, the top input colors "overlay" the bottom input 145 * while preserving highlights and shadows of the latter. 146 * </ul> 147 */ 148 OVERLAY, 149 150 /** 151 * The darker of the color components from the two inputs are 152 * selected to produce the resulting color. 153 * The alpha components are blended according 154 * to the {@link #SRC_OVER} equation. 155 * <p> 156 * Notes: 157 * <ul> 158 * <li>This mode is commutative (ordering of inputs 159 * does not matter). 160 * <li>This mode is the mathematical opposite of 161 * the {@link #LIGHTEN} mode. 162 * </ul> 163 */ 164 DARKEN, 165 166 /** 167 * The lighter of the color components from the two inputs are 168 * selected to produce the resulting color. 169 * The alpha components are blended according 170 * to the {@link #SRC_OVER} equation. 171 * <p> 172 * Notes: 173 * <ul> 174 * <li>This mode is commutative (ordering of inputs 175 * does not matter). 176 * <li>This mode is the mathematical opposite of 177 * the {@link #DARKEN} mode. 178 * </ul> 179 */ 180 LIGHTEN, 181 182 /** 183 * The bottom input color components are divided by the inverse 184 * of the top input color components to produce the resulting color. 185 * The alpha components are blended according 186 * to the {@link #SRC_OVER} equation. 187 */ 188 COLOR_DODGE, 189 190 /** 191 * The inverse of the bottom input color components are divided by 192 * the top input color components, all of which is then inverted 193 * to produce the resulting color. 194 * The alpha components are blended according 195 * to the {@link #SRC_OVER} equation. 196 */ 197 COLOR_BURN, 198 199 /** 200 * The input color components are either multiplied or screened, 201 * depending on the top input color. 202 * The alpha components are blended according 203 * to the {@link #SRC_OVER} equation. 204 * <p> 205 * Notes: 206 * <ul> 207 * <li>This mode is a combination of {@link #SCREEN} and 208 * {@link #MULTIPLY}, depending on the top input color. 209 * <li>This mode is the mathematical opposite of 210 * the {@link #OVERLAY} mode. 211 * </ul> 212 */ 213 HARD_LIGHT, 214 215 /** 216 * The input color components are either darkened or lightened, 217 * depending on the top input color. 218 * The alpha components are blended according 219 * to the {@link #SRC_OVER} equation. 220 * <p> 221 * Notes: 222 * <ul> 223 * <li>This mode is similar to {@link #OVERLAY}, but generally 224 * produces "lighter" results than {@code OVERLAY}. 225 * </ul> 226 */ 227 SOFT_LIGHT, 228 229 /** 230 * The darker of the color components from the two inputs are 231 * subtracted from the lighter ones to produce the resulting color. 232 * The alpha components are blended according 233 * to the {@link #SRC_OVER} equation. 234 * <p> 235 * Notes: 236 * <ul> 237 * <li>This mode is commutative (ordering of inputs 238 * does not matter). 239 * <li>This mode can be used to invert parts of the bottom input 240 * image, or to quickly compare two images (equal pixels will result 241 * in black). 242 * <li>Rendering with a completely white top input inverts the 243 * bottom input; rendering with a completely black top input produces 244 * a result equivalent to the bottom input. 245 * </ul> 246 */ 247 DIFFERENCE, 248 249 /** 250 * The color components from the two inputs are multiplied and 251 * doubled, and then subtracted from the sum of the bottom input 252 * color components, to produce the resulting color. 253 * The alpha components are blended according 254 * to the {@link #SRC_OVER} equation. 255 * <p> 256 * Notes: 257 * <ul> 258 * <li>This mode is commutative (ordering of inputs 259 * does not matter). 260 * <li>This mode can be used to invert parts of the bottom input. 261 * <li>This mode produces results that are similar to those of 262 * {@link #DIFFERENCE}, except with lower contrast. 263 * <li>Rendering with a completely white top input inverts the 264 * bottom input; rendering with a completely black top input produces 265 * a result equivalent to the bottom input. 266 * </ul> 267 */ 268 EXCLUSION, 269 270 /** 271 * The red component of the bottom input is replaced with the 272 * red component of the top input; the other color components 273 * are unaffected. 274 * The alpha components are blended according 275 * to the {@link #SRC_OVER} equation. 276 */ 277 RED, 278 279 /** 280 * The green component of the bottom input is replaced with the 281 * green component of the top input; the other color components 282 * are unaffected. 283 * The alpha components are blended according 284 * to the {@link #SRC_OVER} equation. 285 */ 286 GREEN, 287 288 /** 289 * The blue component of the bottom input is replaced with the 290 * blue component of the top input; the other color components 291 * are unaffected. 292 * The alpha components are blended according 293 * to the {@link #SRC_OVER} equation. 294 */ 295 BLUE 296 297}