当前位置: 移动技术网 > IT编程>开发语言>.net > asp画的五星红旗(bmp格式)

asp画的五星红旗(bmp格式)

2018年10月03日  | 移动技术网IT编程  | 我要评论

异界之我是创世神,民主生活会剖析材料,零影

程序代码
<%
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
 &

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网