Processing (BETA) version 135+ のリファレンスです。 旧バージョン使用者はソフトウェア内のリファレンスを参照してください。
この文書は Processing のAPIリファレンスを日本語に訳したものです。 最新の内容は 英語版 で確認して下さい。


Name

| (bitwise OR)

Examples
int a = 205;   // In binary: 11001101
int b = 45;    // In binary: 00101101
int c = a | b; // In binary: 11101101
println(c);    // Prints "237", the decimal equivalent to 11101101

int a = 255 << 24; // Binary: 11111111000000000000000000000000
int r = 204 << 16; // Binary: 00000000110011000000000000000000
int g = 204 << 8;  // Binary  00000000000000001100110000000000
int b = 51;        // Binary: 00000000000000000000000000110011
// OR the values together:    11111111110011001100110000110011 
color argb = a | r | g | b; 
fill(argb); 
rect(30, 20, 55, 55);
Description バイナリ表現された2つの値の対応するビットを比較します。 それぞれの比較結果は1と1なら1、1と0なら1、0と0なら0です。 この関数を使うことで値のバイナリ表現を見ることができます。

  11010110  // 214
& 01011100 // 92
--------
11011110 // 222

値のバイナリ表現を出力するには println() と一緒に binary() を使います。
Syntax
value | value2
Parameters
value1 int, char, byte
value2 int, char, byte
Usage Web & Application
Related & (bitwise AND)
binary()
Updated on September 23, 2006 05:40:19pm PDT

Creative Commons License

この文書の原文はクリエイティブ・コモンズ(Creative Commons)Attribution-Noncommercial-Share Alike(表示・非営利・継承) ライセンスで公開されています。 このライセンスは同一の許諾条件の下で原作者のクレジットを表示し、また作品を営利目的で利用しなければ、作品に対して複製、頒布、展示、実演、二次的著作物の作成が行えることを示します。

© 2007 Processing.org