3

Quartz2Dで「CGContextSetBlendMode」関数を使用していますが、「kCGBlendModeColorDodge」定数の意味がわかりません。kCGBlendModeColorDodgeの式は何ですか?

4

2 に答える 2

1

「カラーダッジ」の式は次のとおりです。

// v1 and v2 are the RGBA pixel values for the two pixels 
// "on top of each other" being blended
void someFunction(v1,v2) {
    return Math.min(v1 + v2, 255);
}

ソースは次のページです:

http://jswidget.com/blog/2011/03/11/image-blending-algorithmpart-ii/

編集:

2つの回避機能があります。1つは線形で、もう1つは単に「回避」と呼ばれます。さまざまなブレンディングモードのより広範なリストを次に示します。

Photoshopは2つの画像をどのようにブレンドしますか?

ブレンディングモードの公式は、このページで確認されています。

http://www.pegtop.net/delphi/articles/blendmodes/dodge.htm

...しかし、このページでは、式を逆にすることで正しく理解しているように見えます。

http://www.simplefilter.de/en/basics/mixmods.html

おそらくまだ特殊なケースを理解する必要があり、「1」は実際には「255」であることを覚えておいてください。

于 2012-05-01T10:10:24.473 に答える
0

試す:

// t_component's range is [0...1]
t_component dodge_component(const t_component& a, const t_component& b) {
  // note: saturate and limit to range
  return a / (1.0 - b);
}

t_color dodge_color(const t_color& a, const t_color& b) {
  t_color result;
  for (each component in color_model) {
    result.component[i] = dodge_component(a.component[i], b.component[i]);
  }
  return result;
}
于 2012-05-01T06:06:08.947 に答える