いつもお世話になっております。
前提・実現したいこと
赤枠の中を表示するために3つのイメージを1つのイメージとして扱いたいです。
draw()内では3つのイメージのy位置が変わっても、纏められたイメージが更新されるだけなので、動的にイメージを纏めたいです。
1つのイメージに纏められさえすれば、
copy(イメージ,[赤枠領域],[表示領域])で出来るはずなのですが......
###コード
spd_number,spd_label_1,spd_label_10,spd_label_100はどれもPGraphics型です。
processing
1void move_spd_num_label() 2{ 3 float divisor = spd_label_1.height / 2 - (spd_num_distance / 2) * 3; 4 5 float y_1 = map(kvc, 0, 20, -divisor, divisor); 6 float y_10 = map(floor(kvc / 10), 0, 20, -divisor, divisor); 7 float y_100 = map(floor(kvc / 100), 0, 20, -divisor, divisor); 8 9 if (kvc >= 10) 10 { 11 y_1 = y_1 % divisor; 12 } 13 if (floor(kvc / 10) >= 10) 14 { 15 y_10 = y_10 % divisor; 16 } 17 if (floor(kvc / 100) >= 10) 18 { 19 y_100 = y_100 % divisor; 20 } 21 22 translate(displayWidth/2, displayHeight/2); 23 stroke(0, 255, 0); 24 line(0, 0, displayWidth/2, 0); 25 //imageMode(CENTER); 26 //image(spd_label_1, spd_num_x, y_1 - font_size_large / 2); 27 //image(spd_label_10, -(spd_label_1.width + spd_label_10.width) / 2 + spd_num_x, y_10 - font_size_large /2); 28 //image(spd_label_100, -(spd_label_1.width + spd_label_100.width) / 2 - spd_label_10.width + spd_num_x, y_100 - font_size_large / 2); 29 30 imageMode(CORNER); 31 spd_number = createGraphics(spd_label_1.width + spd_label_10.width + spd_label_100.width, displayHeight / 10); 32 spd_number.beginDraw(); 33 spd_number.imageMode(CORNER); 34 spd_number.image(spd_label_1, 0, y_1 - font_size_large / 2); 35 spd_number.image(spd_label_10, -spd_label_1.width, y_10 - font_size_large /2); 36 spd_number.image(spd_label_100, -(spd_label_1.width + spd_label_10.width), y_100 - font_size_large / 2); 37 spd_number.endDraw(); 38 39 image(spd_number, 0, 0); 40 noFill(); 41 translate(-displayWidth/2, -displayHeight/2); 42}
補足情報(FW/ツールのバージョンなど)
processig 3.3.6
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/10 10:38
2018/03/10 11:05
2018/03/10 11:18
2018/03/10 11:59 編集
2018/03/11 01:07