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


Name

& (bitwise AND)

Examples
int a = 207;    // In binary: 11001111
int b = 61;     // In binary: 00111101
int c = a & b; // In binary: 00001101
println(c);     // Prints "13", the decimal equivalent to 00001101

color argb = color(204, 204, 51, 255);
// The sytax "& 0xFF" compares the binary
// representation of the two values and 
// makes all but the last 8 bits into a 0.
// "0xFF" is 00000000000000000000000011111111 
int a = argb >> 24 & 0xFF;
int r = argb >> 16 & 0xFF;
int g = argb >> 8 & 0xFF;
int b = argb & 0xFF;        
fill(r, g, b, a);
rect(30, 20, 55, 55);
Description バイナリ表現された2つの値の対応するビットを比較します。 それぞれの比較結果は1と1なら1、1と0なら0、0と0なら0です。 この関数を使うことで値のバイナリ表現を見ることができます。
  11010110  // 214
& 01011100  // 92
  --------
  01010100  // 84
値のバイナリ表現を出力するには println() と一緒に binary() を使います。
Syntax
value & value2
Parameters
value1 int, char, byte
value2 int, char, byte
Usage Web & Application
Related | (bitwise OR)
binary()
Updated on September 23, 2006 05:40:15pm PDT

Creative Commons License

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

© 2007 Processing.org