Windows 版の SetPixel を使った四角形を描画する関数 DirectDrawRectangle と塗りつぶした四角形を描画する関数 DirectFillRectangle は以下のようになります。
これらの関数の形式はできるだけ .NET Framework の関数に合わせるようにします。これは C# からの変換が簡単になるようにしたいためです。
これらは比較的単純なので、X68000 で直接メモリーに書き込む形で描画する関数はまずこれらに対応するものから作っていこうと思います。
void DirectDrawRectangle(HDC hdc, int x1, int y1, int w, int h, COLORREF color) { for (int x = x1; x < x1 + w; ++x) { SetPixel(hdc, x, y1, color); SetPixel(hdc, x, y1 + h, color); } for (int y = y1; y < y1 + h; ++y) { SetPixel(hdc, x1, y, color); SetPixel(hdc, x1 + w, y, color); } } void DirectFillRectangle(HDC hdc, int x1, int y1, int w, int h, COLORREF color) { for (int y = y1; y < y1 + h; ++y) { for (int x = x1; x < x1 + w; ++x) { SetPixel(hdc, x, y, color); } } }




