Bug 370381

Summary: Custom stamp has default square dimensions regardless of original graphic
Product: [Applications] okular Reporter: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR Keywords: usability
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 1.9.0
Sentry Crash Report:

Description Carl-Daniel Hailfinger 2016-10-09 22:11:55 UTC
Using the "custom stamp from PNG/SVG file" feature in okular 0.26.70 to e.g. add a signature to a PDF will result in the signature being distorted to a square shape instead of the long rectangle. Note: This happens if the stamp is not being sized manually with click+drag during insertion.

This is probably caused in the source by importing the custom stamp file as icon instead of using the same way as the other SVG stamps shipped with okular.
Comment 1 Simone Gaiarin 2019-07-25 18:09:33 UTC
Git commit f15e8568a5330b6795b1dd5287a6a1530dc60476 by Simone Gaiarin.
Committed on 25/07/2019 at 18:09.
Pushed by gaiarin into branch 'master'.

General improvements to stamp annotation

Summary:
Configuration:
- Add push button to select custom stamp image
- Check if loaded image is usable as stamp or throw error
- Keep image proportions in previewer
- Move previewer below the combobox to display larger preview

Annotation tool:
- Keep stamp image proportion in annotation preview (while left mouse button is down)
- Adding the annotation with one-click (without holding the left mouse button and dragging) adds the stamp with original proportions
Related: bug 383652, bug 383651
FIXED-IN: 1.9.0

Closes T8074

TODO:
- [ ] Check if filters in file chooser make sense / propose better alternative
- [x] Update doc ( @yurchor will do it after we merge this)

Test Plan:
>From stamp annotation configuration dialog:
- Show a warning regarding limitations of the feature's current implementation
- Click push button next to combo box opens a file selector
- Selecting a corrupted image file should throw an error
- Selecting a good image file shows the preview of the image
- Select a horizontal image shows a large clear preview
- Select a vertical image file shows a smaller preview without messing up the visual of the config dialog
- Input a valid icon name in the combobox and the preview of the icon is shown

>From page view, select the stamp annotation with horizontal image file (not squared):
- Click and hold. The preview maintains proportions
- Single click. The stamp image in the pdf maintains proportions and has the same size of the click and hold preview.
- Add an annotation of the Okular custom stamps (internal SVG so treated slightly differently) do not create problems

Reviewers: #okular, ngraham

Reviewed By: ngraham

Subscribers: pino, aacid, yurchor, ngraham, okular-devel

Tags: #okular

Maniphest Tasks: T8074

Differential Revision: https://phabricator.kde.org/D22064

M  +62   -9    ui/annotationwidgets.cpp
M  +7    -1    ui/annotationwidgets.h
M  +25   -9    ui/guiutils.cpp
M  +8    -1    ui/guiutils.h
M  +1    -1    ui/pagepainter.cpp
M  +4    -4    ui/pageviewannotator.cpp

https://invent.kde.org/kde/okular/commit/f15e8568a5330b6795b1dd5287a6a1530dc60476