GSoC Status - Week 7 (Customizable prints)

Lubomir I. Ivanov neolit123 at gmail.com
Fri Jul 17 12:17:22 PDT 2015


On 17 July 2015 at 22:10, Gehad Elrobey <gehadelrobey at gmail.com> wrote:
>
>
> On Fri, Jul 17, 2015 at 9:01 PM, Lubomir I. Ivanov <neolit123 at gmail.com>
> wrote:
>>
>> On 17 July 2015 at 21:54, Gehad Elrobey <gehadelrobey at gmail.com> wrote:
>> >
>> >
>> > On Fri, Jul 17, 2015 at 8:46 PM, Lubomir I. Ivanov <neolit123 at gmail.com>
>> > wrote:
>>
>> >
>> >> On 17 July 2015 at 21:36, Tomaz Canabrava <tcanabrava at kde.org> wrote:
>> >> >
>> >> >>>> I am forces to render the dive profile on a QImage so that I can
>> >> >>>> convert
>> >> >>>> it to grayscale image and then render it on top of the QWebview,
>> >> >>>> Do
>> >> >>>> you
>> >> >>>> think there is a way to convert the vector graphics to grayscale?
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> graphicsview-common.h:QColor getColor(const color_indice_t i, bool
>> >> >>> isGrayscale = false);
>> >> >>>
>> >> >>> so, 90% of the time we are using getColor without the isGrayscale
>> >> >>> boolean, triggering the false state.
>> >> >>> this is where you should do your stuff :)
>> >> >>>
>> >> >>> grep getColor inside qt-ui/profile and see where you should change.
>> >> >>>
>> >> >>>
>> >> >>
>> >> >> I already tried to do this, I also added isGrayscale members in
>> >> >> DiveProfileItem, but there are some remaining elements that I
>> >> >> couldn't
>> >> >> change into grayscale (eg. cylinder pressure curve and numbers on
>> >> >> horizontal/vertical axis) please check the screenshot attached, Am I
>> >> >> missing
>> >> >> something?
>> >> >
>> >> >
>> >> >
>> >> > yes, in a few places we are not using the get color correctly and
>> >> > this
>> >> > needs
>> >> > to be fixed:
>> >> >
>> >> > tankitem.cpp ( see the setColorAt calls )
>> >> > rulerItem.cpp ( check for QColor usage )
>> >> > profileWidget.cpp ( check for QColor )
>> >> > diveprofileItem.cpp ( check for "     // This paints the colors of
>> >> > the
>> >> > velocities. " )
>> >> >
>> >> > getSacColor also doesn't takes into consideration printMode
>> >> >
>> >>
>> >> thanks Tomaz,
>> >> i admit that when i saw that profile2 didn't support the greyscale
>> >> color table, i didn't even bother fixing this. :(
>> >>
>> >> Gehad, if we can't find an easy way to preserve everything in vector
>> >> while in greyscale we may have to use the custom color table for the
>> >> profile, after all.
>> >> because having the profile and table in raster because of the
>> >> greyscale mode is a bit subpar?
>> >>
>> >
>> > The QPrinter::setColorMode() work very nicely it converts the whole
>> > printouts to grayscale pages without the need to rasterize the page, the
>> > only drawback is that this doesn't work correctly with the
>> > QPrintPreviewDialog which I think we may use the css filter way to work
>> > around this issue - we will not have identical previewing and printing
>> > methods though , what do you think?
>> >
>>
>> well, does setColorMode() preserve at least the vector graphics of the
>> hard-copy - for both the table and profile?
>
>
> Yes it does, you can test it on current master.
>

alright, let's not waste anymore time with this.

just make the actual print use setColorMode() with everything in
vector when in greyscale, while for the preview, only in greyscale we
are going to use QImage for the profile and the CSS filter for
everything else.

for color mode though, the preview and the actual print should be the
same and everything should be in vector.

this is technically a Qt bug of sorts, because the QPrintEngine
greyscale property for some *very odd* doesn't work in the preview
dialog.
if there is more time towards the end of GSoC we are going to get back
to this and attempt some workarounds.

lubomir
--


More information about the subsurface mailing list