Stupid thing in xorsd3d /maybe b3d too that concerns Image

Started by Hardcoal, November 06, 2019, 15:19:38

Previous topic - Next topic

Hardcoal

Ive made yesterday a png image combiner.. it take single png images and makes them one long strip image for animation purpose.

The thing is that when i create an empty image and if the image is bigger than the screen resolution, when i draw on it the single pngs, if it passes the screen resolution it wont draw.
so the outcome depands on the resolution i set up to the app..

For example if i did xgraphics (800,600) and the target image is 1200,100 it will not draw on it from point x800 and above.

anyway  i can live with that.. but its kinda unelegent..

just wanted to share this. if anyone has a solution..


Import xorsteam.xors3d

Include "../../mylibs/Fileissues.bmx"
Include "../../mylibs/stringissues.bmx"

Global Strng:StringCommands_Class = New StringCommands_Class
Global FC:FileCommands_Class = New FileCommands_Class

xKey("M1Rk6-581XS-g6J5W-M4UFg-M77f8")
xSetEngineSetting("Splash::TilingTime", "0")
xSetEngineSetting("Splash::AfterTilingTime", "0")

xGraphics3D (3500, 1000, 32, False, True)

'-----------------------------------------------------'

Global PNGURL:String = RequestDir("Choose a Folder")
PNGURL = PNGURL + "/"

Global FilesList:TList = FC.ReadDirectory(PNGURL)

'-----------------------------------------------------'

'Error
If FilesList.Count() = 0 Then Quit("List is Empty")

Local NewImage = BuildNewImage(FilesList, PNGURL)

'Error
  If NewImage = 0 Then Quit("New Image was not Created")
 
  xSaveImage(NewImage, PNGURL + "../" + "NewPng.apng")

While Not xKeyHit(1) Or xWinMessage("WM_CLOSE")

xRenderWorld()
xUpdateWorld()
xCls()

xDrawImage(NewImage, 10, 10)

xFlip
Wend

Function Quit(Reason:String = "")
Notify "Quiting " + Reason
End
End Function

Function BuildNewImage(ImagesFilesList:TList, URL:String, WantedSize:Float = 50, DrawRects = False)
Local TempImage, FileName:String, Counter
Local NewImage = xCreateImage(WantedSize * ImagesFilesList.Count(), WantedSize)

xSetBuffer(xImageBuffer(NewImage))

For FileName = EachIn ImagesFilesList

TempImage = xLoadImage(URL + FileName)

   'Error
If TempImage = 0 Then Quit("TempImage is Null")

    xResizeImage(TempImage, WantedSize, WantedSize)

xDrawImage(TempImage, Counter * WantedSize, 0)

If DrawRects Then xRect(Counter * WantedSize, 0, WantedSize, WantedSize)

Counter = Counter + 1

Next

If DrawRects Then xRect(0, 0, WantedSize * ImagesFilesList.Count() - 1, WantedSize - 1)

xSetBuffer(xBackBuffer())

Return NewImage
End Function


'Need to fit the size according to number of frame vs secreen width resolution.



all is left to me is to find a way to upload a gif so i can turn it onto a png for my editor.
since i have  problams with freeimage and so, im using external program to turn gif ont o single png images
Code

Derron

My framework contains a little helper for such stuff:
https://github.com/GWRon/Dig/blob/master/base.gfx.imagehelper.bmx

Function DrawImageOnImage:int(src:object, dest:object, x:Int, y:Int, modifyColor:TColor = null, drawMode:int=0)


So in essence:
target = CreatePixmap(width, height, format)
ClearPixels(target, 0)

DrawImageOnImge(mysprite, target, 0, 0)

SavePixmapPNG(target, ...)


The whole thing is using software only, so no texture size limit - except for the amount of memory available on the Computer (or for a 32bit build ... the 32bit ;D)

bye
Ron

Hardcoal

lol ok man, i think i have enough memory since the commodore 64,
Ill give it a try.

but like i said , my main problem remains, to load Gif files.

btw can you explain me how to download from github? i dont understand its concept, why there is no [download file] button
I did Edit object and than copied the whole text.. that the only way i found to get it
Code

Derron

For such sourcefiles here:



For complete files/repositories:
- click on "clone or download" (green button)
- click on "download" -> repositoryname-master.zip is downloaded



- to download a specific version state you can - eg. - select one from the "commits" (hit commit in the nav bar) and then hit the "< >" button and you will land on a similar page as above with the green button for downloads



bye
Ron

Hardcoal

Wow.. you really put an effort, i cant ask more than that

Thanks  ;D
Code