Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gex

Pages: [1]
1
Graphics / Re: Issue with RenderTexture to Image copy
« on: July 17, 2019, 01:19:12 pm »
I use qrencode to generate the QR Code. I am aware of the QR code, version, module error correction level et al, so there I won't have issue.

If I could choose, I would only do integer scaling, however I'm not free to. However quality will be okay as I'm going to generate "high" resolution images, I just need to run some examples for different QR versions with different scaling factors in order to check if there are particular bad combinations.

Oh my, "stb_image_resize.h" could have seen this myself.

2
Graphics / Re: Issue with RenderTexture to Image copy
« on: July 17, 2019, 08:37:15 am »
Although this is out of SFML scope and thus of this forum you might still have a hint for me. The QR code, which I need to include into the image, varies in terms of encoded data length and thus in the number of modules. In the final image the QR code need to have always the same size (+/- some pixels is okay). Therefore I assume I well get into situations where I need to scale the qr code at runtime before integrating it into my output bitmap. What algorithm or even small lib is best suited for such a job? I guess if I get this done, then the rest is just coding effort.

3
Graphics / Re: Issue with RenderTexture to Image copy
« on: July 17, 2019, 12:30:07 am »
Just made first steps with FreeType. I have to confess this does feel too low level to me, however I guess I will follow this path and complete my PoC. By now I was able to compile a simple exe which renders a simple text string and outputs it into a BMP file using stb_image_write.h

4
Graphics / Re: Issue with RenderTexture to Image copy
« on: July 16, 2019, 04:17:19 pm »
At first we only expected the code to run on desktop systems, where we did not expected those issues.
But from a retrospective point of view it would indeed have been less effort to go the way you outlined. I will do some PoC coding and see how things go there. I already have stbi included for saving data as PNG/JPG included.
I'm just wondering if there is a thin abstraction library over FreeType or not. Furthermore I will need to include a small scissor image which needs to be scaled.

Anyway I appreciate your explanation on what could have gone wrong.

5
Graphics / Re: Issue with RenderTexture to Image copy
« on: July 16, 2019, 02:30:57 pm »
First of all, thank you binary1248 for spending your time to answer me, I really appreciate it.

I expected this kind of reply :) - I am aware what SFML is intended for and that it is too much for my use case. We were looking for a library that abstracts some details away and it worked well - until this issue.

Still, I would be very interested in any hints that can point to the actual issue I am running into so that I do not need to rewrite the code at this moment. At the same time I will consider rewriting it...

6
Graphics / Issue with RenderTexture to Image copy
« on: July 16, 2019, 12:20:14 am »
Hey there

First of all I try to explain what I am doing before going into the specific issue I encountered and where I will appreciate any help and experience.

SFML version 2.5.1 on windows, dynamic linked in c++ 11

I am using SFML Graphics for creating a rasterized output containing text and a QR code, which can be added to print output (yeah, not best for print, but reality for a lot of legacy applications, but we use high resolutions to get best quality). When everything is drawn, it is exported/saved as PNG/JPEG or whatsoever. Initially I created one "large" RenderTexture and used is one canvas where I drew all the stuff. when finished I copied the texture to an Image and saved it to a file. This worked fine on Desktop machines.

So now for the fun part:
Then we made tests on target machines and some of them were Windows Server (2012 / 2016) machines, where no RenderTexture larger than 1000x1000 or maybe 1024/1024 could have been created. So the obvious thing to do was to split it up to multiple RenderTextures and then combined it into the final Image. Now it still worked on my Machine and it did on the target Windows Server machines. However it did only work properly on the windows server machine if our executable was executed directly (both traditional win32 exe and console application). As soon as the same binaries with same commands and data were executed as a subprocess of another programm, parts of the output image went black (/or gray when saved as png). This messed up part did only occur in the largest RenderTexture, so I like to illustrate this with two pictures

layout_lines.png is created using "debug layout" option, which draws green lines around all layout areas, which currently match a RenderTexture each.

https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=25561.0;attach=4391;image


and as you can see in the following example.jpg, in the largest layout area, the end / bottom is messed up.
https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=25561.0;attach=4389;image



From a code perspective the following pattern is followed:
sf::RenderTexture rt;
if (!rt.create(width, height)) {
            throw ...;
}
rt.clear(sf::Color::White);

// multiple draw calls
rt.draw(...);

rt.display();
const sf::Texture &texture = rt.getTexture();
img.copy(texture.copyToImage(), an_x_pos, a_y_pos);
 

I am passing the RenderTexture as a reference to other functions in order to draw to it.

At the moment I am unable to reproduce the issue on any of my machines at hand - I ran the examples on azure virtual machines (server) and was able to reproduce the RenderTexture size limit but not black/gray-area issue. What am I missing, does any one have an idea what goes wrong there?

7
Feature requests / Re: Image saving
« on: February 15, 2019, 04:18:08 pm »
And you're linking dynamically, right? Because there is a small issue with using your own STB image and image write along statically linked SFML: https://en.sfml-dev.org/forums/index.php?topic=25011.msg166598

Thank you for the hint. Yes, currently I am linking SFML dynamically and will probably stick to it.

8
Feature requests / Re: Image saving
« on: February 15, 2019, 02:56:44 pm »
Today I solved my issue by using stb_image_write.h in my code in order to save images into memory without use of temporary files. Therefore my urgent need is gone, although I sill think it would be a great addition to SFML if it was possible directly using SFML API.

Again, many thanks for your great work.

9
Feature requests / Re: Image saving
« on: February 11, 2019, 07:06:30 pm »
An advantage of adding sf::OutputStream before SFML 3 would be that we might get feedback to improve. If the API is not ideal initially, we're not stuck with it forever.

I would really love to see that in 2.x (if 2.6 shall be last 2.x release, then in 2.6 ;-) ). At the moment I need to write a tmp file and the read it again for further usage. Obviously that is not ideal.

I don't feel experienced enough in C++ development and SFML in specific to get enganged in neither the discussion regarding implementation and nor in contributing code. However I'd be more than happy to give feedback!

Pages: [1]
anything