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
while k >= 360
k = k - 360
wend
while k >= 72
k = k - 72
wend
if k > 36 then k = 72 - k
m2 = d ^ 2 + r ^ 2 - d * r * 2 * cos(k * pi / 180)
if (m2 + r ^ 2 - d ^ 2) / (sqr(m2) * r * 2) > cos(pi * 0.1) then
bitmap(x + i, y + j) = 1
end if
end if
next
next
end sub
private function cword(i16)
cword = chrb(i16 and &hff) & chrb(i16 256 and &hff)
end function
private function cdword(i32)
cdword = chrb(i32 and &hff) & chrb(i32 256 and &hff) & chrb(i32 65536 and &hff) & chrb(i32 &hffffff and &hff)
end function
www.knowsky.com
private property get fileheader
const filetype = &h4d42
const reserved1 = 0
const reserved2 = 0
const offbits = 62
fileheader = cword(filetype) & cdword(filesize) & cword(reserved1) & cword(reserved2) & cdword(offbits)
end property
private property get infoheader
const infosize = 40
const planes = 1
const bitcount = 1
const compression = 0
const xpelspermeter = 0
const ypelspermeter = 0
const clrused = 0
const clrimportant = 0
infoheader = cdword(infosize) & cdword(width) & cdword(height) & cword(planes) & cword(bitcount) & cdword(compression) & cdword(sizeimage) & cdword(xpelspermeter) & cdword(ypelspermeter) & cdword(clrused) & cdword(clrimportant)
end property
private property get palette
&
上一篇: JS获取时间代码展示
推荐阅读
-
C#将PDF转为多种图像文件格式的方法(Png/Bmp/Emf/Tiff)
-
在ASP.NET 2.0中操作数据之十一:基于数据的自定义格式化
-
在ASP.NET 2.0中操作数据之三十:格式化DataList和Repeater的数据
-
ASP.NET通过byte正确安全的判断上传文件格式
-
C#将PDF转为多种图像文件格式的方法(Png/Bmp/Emf/Tiff)
-
解决Asp.net Mvc返回JsonResult中DateTime类型数据格式问题的方法
-
在ASP.NET 2.0中操作数据之十一:基于数据的自定义格式化
-
在ASP.NET 2.0中操作数据之三十:格式化DataList和Repeater的数据
-
解决Asp.net Mvc返回JsonResult中DateTime类型数据格式问题的方法
-
asp.net浏览器向服务器提交json格式的数据