asp画的五星红旗(bmp格式)
程序代码
<%
Option Explicit
Class FiveStarredFlag
PRivate Width
Private Height
Private Filler
Private SizeImage
Private FileSize
Private BitMap()
Private Sub Class_Initialize
Height = 200
Width = 300
Filler = (32 - Width Mod 32) Mod 32
SizeImage = (Width + Filler) * Height 8
FileSize = SizeImage + 14 + 40 + 8
ReDim BitMap(Width + Filler - 1, Height - 1)
Star Height * 0.25, Height * 0.75, Height * 0.15, 0
Star Width / 3, Height * 0.9, Height * 0.05, 120.9637565320735
Star Width * 0.4, Height * 0.8, Height * 0.05, 98.13010235415598
Star Width * 0.4, Height * 0.65, Height * 0.05, 74.0546040990771
Star Width / 3, Height * 0.55, Height * 0.05, 51.3401917459099
End Sub
Private Sub Class_Terminate
Response.ContentType = "image/bmp"
Response.BinaryWrite FileHeader & InfoHeader & Palette & ImageData
End Sub
Private Sub Star(x, y, r, a)
Dim pi, v, d, i, j, k, m2
pi = 3.1415926535897932
v = r * Sin(pi * 0.1) / Sin(pi * 0.7)
For j = -r To r
For i = -r To r
d = Sqr(i ^ 2 + j ^ 2)
If d < v Then
BitMap(x + i, y + j) = 1
ElseIf d < r Then
If i = 0 Then
If j > 0 Then k = 90 Else k = -90
Else
k = Atn(j / i) * 180 / pi
If i < 0 Then k = k + 180
End If
k = k - a - 18
While k < 0
k = k + 360
Wend
&nb
相关新闻>>
- 发表评论
-
- 最新评论 更多>>