silly question... pixmap to image ?

BlitzMax Forums/BlitzMax Programming/silly question... pixmap to image ?

Paul "Taiphoz"(Posted 2011) [#1]
I have a resize function that converts and image to a pixmap, I then need to save the resized image to file.

in a round about what what I am doing is this, I have an image 1280*1024 I want to load this from incbin, I then want to resize it to fit the current resolution, and then save it to a temp file, where I then wanted to loadanimimage from it.

My resize function converts the image to a pixmap and the new image is not compatible with the save function.

Global BackImage:TImage = LoadImage("incbin::images/back.png")
BackImage = resizeimage(BackImage , width , height)
SavePixmapPNG(BackImage , CurrentDir() + "/cDesk2011_back.png" , 9)


Is there a way for me to leadanimimage from something thats been loaded already ? to bypass the act of saving the resized file out ?


d-bug(Posted 2011) [#2]
You can load TPixmap objects instead of paths with LoadImage or LoadAnimImage!

Should look like LoadAnimImage(BackImage.pixmaps[0] ...)

Last edited 2011


Jesse(Posted 2011) [#3]
You can can just use this function:

Function AnimImageFromPixmap:TImage(pixmap:TPixmap,cellwidth:Int,cellHeight:Int,firstCell:Int,count:Int,flags:Int=-1)
	Local gfx:TMax2dGraphics = TMax2dgraphics.Current()
	Return TImage.loadAnim(pixmap,cellwidth,cellheight,firstcell,count,flags,gfx.mask_red,gfx.mask_green,gfx.mask_blue)
End Function


Last edited 2011


Paul "Taiphoz"(Posted 2011) [#4]
I will try that, gona rewrite all of my code, got to the point things just got messy as hell so I'll take what I learnt this time round and your tip and do it again cleaner.