角丸の矩形を描画するモジュール

//
#include "a2d.hsp"
#module
// ------------------------------------------------------------ //
//
//
//
// x, y :
// w, h :
// r :
//
//
//
//
//
//
//
//
// ------------------------------------------------------------ //
// Rounded Rectangle
#deffunc DrawRoundRect int p_x, int p_y, int p_w, int p_h, int p_r
r = limit( p_r, 0, p_w/2)
alDrawLine p_x , p_y + r , p_x , p_y + p_h - r
alDrawLine p_x + r , p_y + p_h , p_x + p_w - r, p_y + p_h
alDrawLine p_x + p_w , p_y + p_h - r, p_x + p_w , p_y + r
alDrawLine p_x + p_w - r, p_y , p_x + r , p_y
alDrawArc p_x , p_y , r*2, r*2, 180, 90
alDrawArc p_x , p_y + p_h - r*2, r*2, r*2, 90, 90
alDrawArc p_x + p_w - r*2, p_y + p_h - r*2, r*2, r*2, 0, 90
alDrawArc p_x + p_w - r*2, p_y , r*2, r*2, 270, 90
return
// ------------------------------------------------------------ //
//
//
//
// x, y :
// w, h :
// r :
//
//
//
//
//
//
// ------------------------------------------------------------ //
// Rounded Rectangle
#deffunc FillRoundRect int p_x, int p_y, int p_w, int p_h, int p_r
r = limit( p_r, 0, p_w/2)
alFillRect p_x , p_y + r , r, p_h - p_r*2
alFillRect p_x + r , p_y + p_h - p_r, p_w - r*2, r
alFillRect p_x + p_w - r , p_y + r , r, p_h - p_r*2
alFillRect p_x + r , p_y , p_w - r*2, r
alFillRect p_x + r , p_y + r , p_w - r*2, p_h - p_r*2
alFillPie p_x , p_y , r*2, r*2, 180, 90
alFillPie p_x , p_y + p_h - r*2, r*2, r*2, 90, 90
alFillPie p_x + p_w - r*2, p_y + p_h - r*2, r*2, r*2, 0, 90
alFillPie p_x + p_w - r*2, p_y , r*2, r*2, 270, 90
return
#global
; 0
alCreateImage 0, 640, 480
if stat = -1 : dialog "GDI+ " : end
alPenWidth 3
//
alColor 255, 200,200
r = 10
repeat ginfo_winx*2 /r
alDrawLine cnt * r, 0, 0, cnt * r
loop
//
alColor 0, 0, 255, 127
//
DrawRoundRect 0, 0, 120, 120, 20
//
FillRoundRect 0, 150, 120, 120, 20
//
alGradientColor 150, 0, 150+120, 120, RGBA(255, 0, 0), RGBA(0, 0, 255)
DrawRoundRect 150, 0, 120, 120, 30
alGradientColor 150, 150, 150+120, 150+120, RGBA(255, 0, 0), RGBA(0, 0, 255)
FillRoundRect 150, 150, 120, 120, 30
//
alGradientColor 300, 0, 300+120, 120, RGBA(0, 255, 0, 255), RGBA(0, 255, 0, 0)
DrawRoundRect 300, 0, 120, 120, 40
alGradientColor 300, 150, 300+120, 150+120, RGBA(0, 255, 0, 255), RGBA(0, 255, 0, 0)
FillRoundRect 300, 150, 120, 120, 40
; 0 HSP
alCopyImageToScreen 0, 0
redraw
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX