.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Wed Mar 30, 2022 9:39 am Post subject: The D3D sprite loads and draws text |
|
|
I have successfully drawn text on the loaded image, but the text is transparent, which is different from the saved image. Can you help me? Code: | function d3dImgeText(x,y,txt)
d3dhook_initializeHook()
if not p then
p=createPicture()
end
p.loadFromStream(findTableFile('AJ2.png').Stream)
w=p.PNG.Width
h=p.PNG.Height
--p.PNG.PixelFormat = pf4bit
c=p.PNG.Canvas
c.Clear()
c.Font.Size=13
c.Font.Style=nil--'fsBold'
c.Font.Color=0xFFFFFF
c.Brush.Style=1
--c.Brush.Color=0
c.Font.Name='celuafont'
--c.Font.Quality = 'fqCleartypeNatural'
p.PNG.Width=math.max(w,c.getTextWidth(txt))
p.PNG.Height=math.max(h,c.getTextHeight(txt))
c.textOut(0,h/4,txt)
p.SaveToFile('ccc.jpg')
destroyD3D()
pt=d3dhook_createTexture(p)
ps=d3dhook_createSprite(pt)
ps.x=x
ps.y=y
ps.Alphablend=10
--ps.Width=p.PNG.Width+100
--ps.Height=p.PNG.Height+40
end
function destroyD3D()
if ps then ps.Destroy() end
if pt then pt.Destroy() end
end
txt=os.clock()
d3dImgeText(280,135,' '..txt..' ') |
Description: |
|
Filesize: |
365.24 KB |
Viewed: |
626 Time(s) |
|
Description: |
|
Filesize: |
200.33 KB |
Viewed: |
626 Time(s) |
|
|
|