fheroes2 icon indicating copy to clipboard operation
fheroes2 copied to clipboard

Add proper icons for screen scrolling speed

Open ihhub opened this issue 2 years ago • 6 comments

close #6552

all credits go to @golden-lining

image

Also fixed missing palette loading in h2dmgr tool.

ihhub avatar Apr 07 '23 15:04 ihhub

Hi @ihhub in fact, we don't need a palette for the extract command because it extracts all files from H2D bundle as-is, no conversion to BMP or PNG is performed as of now. We only need it for the combine command, because it offers a special handling for input images. Also I moved the palette_file.pal argument after the target_file.h2d to match other image processing tools in this regard (icn2img and til2img). Please take a look.

oleg-derevenetz avatar Apr 07 '23 20:04 oleg-derevenetz

Hi @ihhub I'm trying to implement image conversion on extraction for the h2dmgr tool and faced the following interesting issue. I'm extracting resurrection.h2d like this:

> h2dmgr.exe extract H2D kb.pal resurrection.h2d
Processing resurrection.h2d...
Total extracted items: 11

H2D/resurrection/scroll_icon_0.png looks like this:

scroll_icon_0

So far so good. Now let's try to do the following:

> h2dmgr.exe combine test.h2d kb.pal H2D\resurrection\*
Processing H2D\resurrection\barbarian_castle_captain_quarter_left_side.png...
Processing H2D\resurrection\graphics_icon.png...
Processing H2D\resurrection\hotkeys_icon.png...
Processing H2D\resurrection\knight_castle_left_farm.png...
Processing H2D\resurrection\petrification_spell_icon.png...
Processing H2D\resurrection\petrification_spell_icon_mini.png...
Processing H2D\resurrection\scroll_icon_0.png...
Processing H2D\resurrection\scroll_icon_1.png...
Processing H2D\resurrection\scroll_icon_2.png...
Processing H2D\resurrection\scroll_icon_3.png...
Processing H2D\resurrection\sorceress_castle_captain_quarter_left_side.png...
Total added items: 11

> h2dmgr.exe extract H2D kb.pal test.h2d
Processing test.h2d...
Total extracted items: 11

And after that H2D/test/scroll_icon_0.png looks like this:

scroll_icon_0

It looks like red and blue colors have swapped places at some point, but I'm not quite understand when exactly. It is unlikely that this happens during extraction because it does not happen when extracting images from resurrection.h2d, so it looks like it happens during packing of images to test.h2d, but you somehow successfully packed the original file to the resurrection.h2d! Any thoughts?

P.S. It looks like this issue is observed only when PNG support is enabled (using SDL_image). This issue is not observed on builds without WITH_IMAGE. Looks like some SDL_image-specific issue which is not directly related to this PR.

P.P.S. After some thought I think that there may be an issue in fheroes2::Load(). We should check not just the SDL_PixelFormat::BytesPerPixel, but also SDL_PixelFormat::format, because there may be different formats with different order of colors and IMG_Load() is free to produce the surface in any of these formats. But this is not directly related to the current PR anyway.

oleg-derevenetz avatar Apr 07 '23 22:04 oleg-derevenetz

Hi @ihhub could you please take a look on my latest changes when you have time? They should resolve the issue with SDL_Surface color formats (they are reliably resolved only with SDL2, but tools are not used with SDL1 anyway).

oleg-derevenetz avatar Apr 18 '23 23:04 oleg-derevenetz

Hi @oleg-derevenetz , is it possible for you if it's not difficult and not time consuming extract your changes from this pull request and create a new one since this PR is stalled due to required changes from an artist?

ihhub avatar Jun 17 '23 13:06 ihhub

Hi @ihhub

is it possible for you if it's not difficult and not time consuming extract your changes from this pull request and create a new one since this PR is stalled due to required changes from an artist?

Yes, of course, extracted relevant changes to #7331.

oleg-derevenetz avatar Jun 17 '23 14:06 oleg-derevenetz

I am closing this pull request as it requires more work and it is easier to recreate everything again rather than fixing merge conflicts.

ihhub avatar Jun 21 '25 16:06 ihhub