-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support EMF #21
support EMF #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for creating the PR.
I've added few comments after digging into this peculiar format.
I also suggest to use non square image for test to be certain about using right values.
Thank you for your extremely diligent feedback. You are a better human being than I am. :-) |
Few small things left: CHANGELOG entry, description in gemspec and legacy ruby doesn't understand I've checked few variants and did a benchmark: require 'securerandom'
require 'benchmark'
STRINGS = 1_000_000.times.map do
SecureRandom.random_bytes(16)
end
UMAX = 256**4
SMAX = UMAX / 2
Benchmark.bmbm do |x|
x.report('repack') do
STRINGS.map{ |s| s.unpack('V*').pack('L*').unpack('l*') }
end
x.report('conditional') do
STRINGS.map{ |s| s.unpack('V*').map{ |u| u < SMAX ? u : u - UMAX } }
end
x.report('arythemical') do
STRINGS.map{ |s| s.unpack('V*').map{ |u| (u + SMAX) % UMAX - SMAX } }
end
end outputs:
not sure which is better from clarity/readability and maybe there is another option. Alternative can be conditionally used for |
Also forgot to attach non square emf converted from svg using Inkscape + changed values to also be negative |
Thank you, will get to these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for all the changes!
To keep the history tidy could you compact commits or do you prefer that I squash merge?
Happy for you to squash merge. |
And can I say again, Ivan, you are a very good human being, and I'm honoured to have contributed to your gem. Thank you for your help and diligence! |
Thank you for taking time to contribute to the gem! I've released version 3.2.0 |
Support of Microsoft EMF format:
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-emf/e4a35c41-e8e3-43f9-bc07-a18e99bb866d
https://stackoverflow.com/questions/3391087/extracting-width-height-dimensions-from-emf-image-files