标题: [原创] vbs画色图 [打印本页]
作者: jyswjjgdwtdtj 时间: 2023-6-4 17:30 标题: vbs画色图
本帖最后由 jyswjjgdwtdtj 于 2023-6-5 20:33 编辑
重点:vector.add的类型一定是要long!每个变量都要clng!
- set vector=createobject("wia.vector")
- for i=&h00 to &hff
- for j=&h00 to &hff
- vector.add 65280+i+256*256*j
- next
- next
- vector.ImageFile(256,256).savefile "1.jpg"
复制代码
- set vector=createobject("wia.vector")
- c1=array(&hca,&h0c,&h9f)
- c2=array(&hff,&hd3,&h0c)
- r=c1(0)-c2(0)
- g=c1(1)-c2(1)
- b=c1(2)-c2(2)
- t=&hff
- for i=&h00 to t
- num=clng(c1(2)-i/(t+1)*b)+&h100*clng(c1(1)-i/(t+1)*g)+&h10000*clng(c1(0)-i/(t+1)*r)
- for aaaa=&h00 to &hff
- vector.add num
- next
- next
- vector.ImageFile(256,t+1).savefile "1.jpg"
复制代码
- '嘿嘿 用一次函数和用错误排除浪费了性能 但是简单啊:lol
- set vector=createobject("wia.vector")
- c1=array(&hff,&h62,&h6e)
- c2=array(&hff,&hbe,&h71)
- r=c1(0)-c2(0)
- g=c1(1)-c2(1)
- b=c1(2)-c2(2)
- t=&hff
- l=&hff
- dim p()
- redim p(t,l)
- k=t/l'k为斜率
- function f(x,t)
- f=k*x+t
- end function
- call a
- function a
- on error resume next
- for i=-t to t't为截距
- num=clng(c1(2)-i/(t+1)*b)+&h100*clng(c1(1)-i/(t+1)*g)+&h10000*clng(c1(0)-i/(t+1)*r)
- for j=0 to l
- p(j,f(j,i))=num
- next
- next
- end function
- for i=0 to t
- for j=0 to l
- vector.add p(i,j)
- next
- next
- vector.ImageFile(l+1,t+1).savefile "1.jpg"
复制代码
作者: LTSC1809 时间: 2023-6-4 19:05
回复 1# jyswjjgdwtdtj 还要归功于微软的WSH,自带这么多对象
作者: jyswjjgdwtdtj 时间: 2023-6-4 19:20
回复 2# LTSC1809
这不是wsh哦 这是com组件
作者: Five66 时间: 2023-6-6 21:25
看不懂为啥类型一定要 long
作者: jyswjjgdwtdtj 时间: 2023-6-6 21:47
回复 4# Five66
可能是类型转换的时候int会变成负数吧
作者: segree 时间: 2023-7-16 18:01
- dim ar,Range,Img
- ar=Array(&HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFF000000, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF, &HFFFFFFFF, &HFF000000, &HFF000000, &HFF000000, &HFF000000, &HFFFFFFFF, &HFFFFFFFF)
- Set Range = CreateObject("WIA.Vector")
- Set Img = CreateObject("WIA.ImageFile")
- For i = 1 To 80*30
-
- Range.Add ar(i)
-
- Next
-
- Img.ImageFile(80,30).SaveFile "1." & Img.FileExtension
复制代码
WIA.Vector菜鸟一枚,不懂用这来画个简单图,求高手指教。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |