animimage trouble...
BlitzPlus Forums/BlitzPlus Programming/animimage trouble...| 
 | ||
| i try doing the following, for creating a pixelfont with variable colors: (my png-s are black on white ground, one for the outline of the font and one for filling) 
Global FontA = LoadImage("font1.png",120,108
Global FontB = LoadImage("font2.png",120,108)
Global xFontA = CreateImage(120,108)
Global xFontB = CreateImage(120,108)
Global mFont = CreateImage(12,12,90)
MaskImage(xFontB,255,255,255)
MaskImage(xFontA,255,255,255)
Function ColorFont(c1%,c2%)
	
SetBuffer ImageBuffer(xFontA)
ClsColor GetR(c1%),GetG(c1%),GetB(c1%)
Cls
	DrawImage FontA,0,0
SetBuffer ImageBuffer(xFontB)
ClsColor GetR(c2%),GetG(c2%),GetB(c2%)
Cls
	DrawImage FontB,0,0
SetBuffer ImageBuffer(mFont)
 
	DrawImage xFontA,0,0
	DrawImage xFontB,0,0
SetBuffer(BackBuffer())
	
End Function
The Problem is, i need the mFont as AnimImage but when I run it like this it only draws on the first frame. if i use for-next loops to draw each frame seperatly it gets really slow.. my questions: can i convert an normal image to an animimage-strip? are there possibilitys to work with animimage as normal images, ignoring frame-separation? does anybody know a faster solution to solve this? greetings GrrBrr P.S. Uh, Oh, sorry for my bad english... | 
| 
 | ||
| oh, theres sth wrong.. of course the correct syntax is: [coding] Global FontA = LoadImage("font1.png") Global FontB = LoadImage("font2.png") [/coding] just copied it wrong in the forum | 
| 
 | ||
|  can i convert an normal image to an animimage-strip? An 'animimage strip' *is* a normal image. You need to use LoadAnimImage to load the fonts, then DrawImage image,x,y,frame to draw each character. I can't make any sense out of what you're trying to achieve with all that CreateImage and Cls stuff, though...? | 
| 
 | ||
| "for creating a pixelfont with variable colors" i know how to draw single frames with an animimage. the problem is that i want to realtime change colors in an image without using write or readpixel. my solution is quite fast, but it doesn't work because i can treat an animimage like a normal image. | 
| 
 | ||
| when i use an imagebuffer on an animimage it takes only the first frame :( :( :( perhaps now the problem is discribed better. sorry | 
| 
 | ||
| Hi GrrBrr I think I know where youre comin from! Did you know that imagebuffer() has an optional second parameter? Imagebuffer(image[,frame]) if you set the frame parameter to the letter offset in the string youre trying to display this is the line that'll need altering: SetBuffer ImageBuffer(mFont) hope this helps Mr Brine | 
| 
 | ||
| i tried this, but then i need to loop through all letters doing a lot of imagebuffer and drawimage, this is quite slow. drawing the whole image at once is much faster. but then i can't use it as imagestrip... :( | 
| 
 | ||
| heres a couple of things that might be causesing problems: - loadimage / createimage have an optional 'flag' parameter if you aint planning on changing screen resolution mid program then I'd set the flag parameter to 2 - any kind of string manipulation is cpu intensive. - createimage is cpu intensive. | 
| 
 | ||
| fontmap = LoadAnimImage ("gfx\font.bmp",8,8,0,91)MaskImage fontmap,255,0,255 ; set variables and strings txt1$="paardje rijden is fijn." Graphics 640,480,16 ; screen building For count=1 To Len(txt1$) char$=Mid$(txt1$,count,1) DrawImage fontmap,x,40,Asc(char$)-32 x=x+8 ; character width Next --------------------------------------------------------- I was doing some font stuff myself. See my code above for a powerfull bmp font processing. the font MUST be ASCII compattible. have fun! | 
| 
 | ||
| please read carefully before you post useless information everybody already knows. thank you. thats not the problem. I KNOW HOW TO USE ANIMIMAGE |