Grid Sage Forums

Grid Sage Forums

  • November 21, 2024, 05:47:57 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

LINKS: Website | Steam | Wiki

Author Topic: Java/Scala based image export in *.xp format  (Read 3851 times)

cosplay

  • Unaware
  • *
  • Posts: 2
    • View Profile
Java/Scala based image export in *.xp format
« 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!
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Java/Scala based image export in *.xp format
« Reply #1 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.
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

cosplay

  • Unaware
  • *
  • Posts: 2
    • View Profile
Re: Java/Scala based image export in *.xp format
« Reply #2 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!
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Java/Scala based image export in *.xp format
« Reply #3 on: May 02, 2022, 10:39:14 PM »

Good to hear!
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon