Grid Sage Forums

REXPaint => Everything REXPaint => Topic started by: cosplay on May 01, 2022, 02:26:59 PM

Title: Java/Scala based image export in *.xp format
Post by: cosplay on May 01, 2022, 02:26:59 PM
Hi There,
I'm working on CosPlay Engine (https://cosplayengine.com) and I wrote a simple function that stores any image in *.xp format so that it could be further edited in REXPaint. I've followed the format details in the manual. In fact, I have two functions: one for reading *.xp files and one for write in *.xp format. Reading works fine.

However, when I am trying to open *.xp file produced by my function in REXPaint - it says in 'run.log' the following:
N=0000308 |   CPathButton::init() | Ignoring protected file: images/pong_logo.xp

(pong_logo.xp is the file I produced).

Here's direct source code for the *.xp image saver: https://github.com/nivanov/cosplay/blob/dc853a45e6b460dac4e1ca665041188eaac7c38a/modules/cosplay/src/main/scala/org/cosplay/CPImage.scala#L215

Any clues would be greatly appreciated - thanks!
Title: Re: Java/Scala based image export in *.xp format
Post by: Kyzrati on May 01, 2022, 07:47:48 PM
Hey cosplay, the only way to get that message ("Ignoring protected file") should be if the layer count happens to be stored as a value >= 10000, so maybe something went wrong there? (I use that as a special way to identify .xp files for my own use with a different version of RP.)

It looks like you're indeed saving it as 1 by default there with "buf.putInt(1) // Only 1 layer", but I dunno, maybe the actual file output is not quite what you intended.

If you want you can attach your .xp file here and I can look at it, but that'd be what to check first.
Title: Re: Java/Scala based image export in *.xp format
Post by: cosplay on May 02, 2022, 10:33:56 AM
Got it to work - it was a problem in my side. Works perfect right now. CosPlay now have bi-directional support for REXPaint *.xp format. Excellent!
Title: Re: Java/Scala based image export in *.xp format
Post by: Kyzrati on May 02, 2022, 10:39:14 PM
Good to hear!