After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 321823 - Inverted Colors Document View
Inverted Colors Document View
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 123493 132183 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-11-18 19:28 UTC by Flavio Martins
Modified: 2011-10-31 07:27 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Inverted output using CAIRO_OPERATOR_DIFFERENCE (158.62 KB, image/png)
2009-08-03 23:21 UTC, Juanjo Marín
  Details
hardcode a paper color to PDF page. (529 bytes, patch)
2009-08-19 15:24 UTC, Bug flys
none Details | Review
Add Inverted Colors features (fixes #321823) (51.00 KB, patch)
2009-10-17 14:15 UTC, Juanjo Marín
none Details | Review
data/icons/16x16/actions/stock_filters-invert.png (229 bytes, image/png)
2009-10-17 14:47 UTC, Juanjo Marín
  Details
data/icons/24x24/actions/stock_filters-invert.png (402 bytes, image/png)
2009-10-17 14:48 UTC, Juanjo Marín
  Details
Juanjo's patch cleaned up (46.67 KB, patch)
2009-10-18 00:15 UTC, Flavio Martins
none Details | Review
Fix conflict of patch 145662 and some indentation issues. (49.89 KB, patch)
2009-10-31 00:53 UTC, Juanjo Marín
none Details | Review
Add option for displaying with inverted colors. Icon borrowed from GIMP. Fixes bgo #321823 (33.71 KB, patch)
2009-11-21 00:56 UTC, Juanjo Marín
committed Details | Review

Description Flavio Martins 2005-11-18 19:28:20 UTC
A new document view called "Invert" should be implemented so users can switch
from white background to black background for example.
use case:
John has some black and white pdf documents that he has to read, he thinks it
would be easier in the eyes if it had the colors inverted. (black
background/white text instead of white background/black text)
Comment 1 Nickolay V. Shmyrev 2005-11-18 19:33:38 UTC
I think we should consider this or at least consider using of theme colors.
Comment 2 Nickolay V. Shmyrev 2006-01-31 21:54:33 UTC
*** Bug 123493 has been marked as a duplicate of this bug. ***
Comment 3 Alan Horkan 2006-04-12 00:53:48 UTC
There is a need for this or something like it sines, there will always be users who will need false colours for accessibility reasons (and sometimes black on white can be harsh on even the best eyes).  
Comment 4 Bryan W Clark 2006-06-07 14:52:31 UTC
I'd like to hear more comments about the a11y desire for this and if it is a needed feature ideas for how this could integrate in a sane way.  Adding an 'Invert Colors' item in the menus is not particularly sane from my point of view, nothing to do with wording it properly just that the action is fairly odd.
Comment 5 lunz 2006-06-09 01:20:30 UTC
it doesn't seem especially odd to me. It's quite common to use a laptop as an ebook reader. If you're going to read many pages of pdf, all white with black text, it can be hard on the eyes. Especially in a dim environment.
Comment 6 Nickolay V. Shmyrev 2006-06-09 06:00:00 UTC
We can respect some ally gconf key or introduce our own
Comment 7 Nickolay V. Shmyrev 2006-08-27 22:39:22 UTC
*** Bug 132183 has been marked as a duplicate of this bug. ***
Comment 8 Kip 2006-10-08 20:59:52 UTC
I am all for this. This is the only thing Evince is missing, from what I can tell. As Maddox once pointed out,

"I've chosen a black background for most of my text because it's easier on the eyes than staring at a white screen. Think about it: your monitor is not a piece of paper, no matter how hard you try to make it one. Staring at a white background while you read is like staring at a light bulb (don't believe me? Try turning off the lights next time you use a word processor). Would you stare at a light bulb for hours at a time? Not if you want to keep your vision."

Kip
Comment 9 Erkin Bahceci 2007-11-05 16:49:29 UTC
I totally agree. This is the only thing that is missing from evince. I hate having to stare at white backgrounds (aka light bulbs) all day long. This is now possible with Compiz, but it would be much better to have built-in support for color negation to be able to invert only the document, and also for systems where Compiz can not be installed. Kpdf has this feature and it works pretty well.
Comment 10 Wouter Bolsterlee (uws) 2008-01-13 15:13:25 UTC
Evince is simple document viewer that views the documents the way they were intended. Marking WONTFIX for now.
Comment 11 Nickolay V. Shmyrev 2008-01-13 15:20:30 UTC
It's an important problem, lets leave it open.
Comment 12 rslemos 2009-01-11 21:51:04 UTC
I'm sad to see that this was once marked as WONTFIX. This shouldn't be too hard to do.

I wouldn't call this a bug either. More of a feature request.

Once I had compiz-fusion installed and used to have the negative plugin (http://wiki.compiz-fusion.org/Plugins/Neg) loaded.

I just don't want to install it again, for it has to grab all the screen to do those fancy effects, from which Negative is the only one I'm missing. And used to activate it just for reading PDFs and web pages. I am sure you can resolve the PDF part.

For those that, like me, miss this feature, one can use xcalib to invert the whole X screen:

   xcalib -i -a
Comment 13 Mihai Capotă 2009-01-26 14:38:07 UTC
Okular has this feature, so does Adobe Reader. They work differently, but are usable.
The idea also showed up at Debian and Ubuntu:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=423119
http://brainstorm.ubuntu.com/idea/11322/
Comment 14 Eugene 2009-01-27 14:46:29 UTC
Lack of this feature makes this program useless for reading documents.
Comment 15 Wouter Bolsterlee (uws) 2009-01-27 14:49:15 UTC
(In reply to comment #14)
> Lack of this feature makes this program useless for reading documents.

This comment is not helpful at all. In fact, this attitude is highly annoying. Please keep any discussion constructive. Thanks.
Comment 16 Eugene 2009-01-27 15:00:59 UTC
I'm just telling the truth, ment no harm. I can use it to view documents, but I certainly cannot use it to read them. And I see this feature was requested long long time ago, and continues to be requested. So I think it means something. Peace.
Comment 17 Wouter Bolsterlee (uws) 2009-01-27 15:13:39 UTC
As suggested in comment #12, in the mean time this can be used to invert the whole X screen:

  xcalib -i -a
Comment 18 Paul Brauner 2009-05-17 10:45:12 UTC
Same for me, blank bg hurt my eyes when i am im a dark environment. I would love to see this  feature added.
Comment 19 John 2009-06-08 09:55:25 UTC
Hi, like many others, i can't read black text with a white background, it's just too painful.
We need a option to change the background color, so Evince will be perfect! Maybe with a colors box "HSV" (hard to do? i don't know), or the choice between 10 fix colors ( variation of grey), or a empty option where you can put your hex color (i always read with #bfbfbf background).

Thx 
Comment 20 John 2009-06-13 12:39:50 UTC
Agreed, this is a much needed feature for me. I end up using xpdf to use this feature.
Comment 21 Juanjo Marín 2009-08-03 23:21:35 UTC
Created attachment 139832 [details]
Inverted output using CAIRO_OPERATOR_DIFFERENCE

Hi, I'm experimenting a little bit about this feature. For the Cairo back end, I think we can use the new operator CAIRO_OPERATOR_DIFFERENCE.  

This operator is on the trunk version of Cairo, so there is enough time to write this feature before the operator is included in the stable version.

I'd like to write a patch for this as soon as possible, though it means after my holidays :)
Comment 22 Juanjo Marín 2009-08-04 23:17:44 UTC
The version of Cairo that includes this new operator is 1.9.4, though it hasn't be released yet.

The stable version of Cairo will be 1.10 and it seems it will be released this year (http://cairographics.org/roadmap/), but there isn't a date.
Comment 23 baron 2009-08-12 18:22:06 UTC
Just adding to the cc list.  I too have been looking for a solution to this problem.  It might be an accessibility issue for people with cataracts (before surgery, of course).  In a couple of years I'll be able to say which is better for that. :(

Comment 24 Bug flys 2009-08-19 15:24:25 UTC
Created attachment 141162 [details] [review]
hardcode a paper color to PDF page.

Here is a simple patch to hardcode a gray background for plain text.
Comment 25 Juanjo Marín 2009-08-24 13:17:24 UTC
I'm working on the bug #321823. By now I only have some dirty code to invert the output of the PDF cairo-backend. I suppose I have to extent this feature to the other backends.

For the interface, I'm thinking about adding the option "Invert" in the View option from the menu and a new toobar button. 

Another option is to add a background color (some people suggested this and even there is a snippet for this --thanks Bug flys--). I could add this option on the View menu, and entry on gconf or open a different bug for this.

Any advise or suggestion for this ?
Comment 26 Juanjo Marín 2009-08-24 13:20:38 UTC
By now, I don't invert the thumbnails, and I don't think if it is a good or bad to do that :)
Comment 27 baron 2009-08-24 13:40:43 UTC
(In reply to comment #25)
> For the interface, I'm thinking about adding the option "Invert" in the View
> option from the menu and a new toobar button. 
> 
> Another option is to add a background color (some people suggested this and
> even there is a snippet for this --thanks Bug flys--). I could add this option
> on the View menu, and entry on gconf or open a different bug for this.
> 
> Any advise or suggestion for this ?

Good to hear you're working on this.  (I should add that I just switched from xpdf to evince because xpdf got very slow at scrolling.  Reverse video is the one feature of xpdf that so far I really miss.)

It seems to me that, if the option changes the background, then you need another option to change the foreground.  Thus, I favor a simple reversal of black and white.  I think that xpdf does not do anything with any other colors.  That usually works.
Comment 28 Juanjo Marín 2009-08-24 14:30:49 UTC
Well, by now I'm for adding the reversed or inverted output to evince. I think this is the feature requested. The result is something like this:

http://www.flickr.com/photos/jjmarin/3851821327/

It is posible to change only the background and left the rest unchanged (the effect is like printing on a non-white piece of paper). 

AFAIK changing the foreground and background is something different. This is like doing a black and white version with these new colors.
Comment 29 Juanjo Marín 2009-08-27 20:43:59 UTC
I'm working slowly on the patch. By now, I added inverted thumbails as well. 

http://www.flickr.com/photos/jjmarin/3862408179/

Now, I want to add an menu entry and a new button for the toolbar. Moreover, I have to extent this feature to other backends, apart from the pdf backend I'm working on.
Comment 30 Juanjo Marín 2009-08-28 22:05:47 UTC
Which name is better for this feature ?
Invert Color
Reverse Color
Invert View
Invert Output

.... other

Which place is better for this option in menu bar
Edit (like the rotate options)
View
Comment 31 Juanjo Marín 2009-09-09 22:23:54 UTC
Some progress on the patch: Added a new option on the Edit menu and a button on the toolbar for the new invert colors feature. Some screenshoots:

http://www.flickr.com/photos/jjmarin/3905212838/
http://www.flickr.com/photos/jjmarin/3904428569/

Left:

- Some cleanup
- Fix the invert colors button and option behaviour status after loading
- Extent to other backends
- Add Cairo version checking
- Self-review of code
- Maintainers review
Comment 32 Kip 2009-09-09 23:39:18 UTC
Keep up the good work Juanjo. Looking good.
Comment 33 Juanjo Marín 2009-09-14 21:01:24 UTC
Which backends are supposed to be officially supported ? 

I'd like to know which backends are supposed to be officially supported for adding the invert colors feature to these ones, at least.

The impress seems to be unsupported ...
Comment 34 Carlos Garcia Campos 2009-09-15 08:06:19 UTC
It depends on what you mean by supported. impress backend is unmaintained, but it's supported.
Comment 35 Juanjo Marín 2009-09-15 09:44:15 UTC
OK, thank you KaL. Anyway I managed myself to add the invert colors feature to all the backends :) It was pretty easy, but I think there is room for some improvement:

I've created two functions for inverting colors: one for GdkPixBuf* and another for cairo_t*. Some backends render the pages converting GdkPixBuf* to cairo_surface_t*, son I can choose to make the inversion of colors before or after the  conversion. 

Because I don't know which function for inverting colors is better, I'd like to measure the calls to this function to choose the best one?

I was thinking about using calls to clock() before and after performing the color inversion. Any advice or suggestion about how to do that ?
Comment 36 Wouter Bolsterlee (uws) 2009-09-15 19:00:06 UTC
(In reply to comment #30)
> Which name is better for this feature ?
> Invert Color
> Reverse Color
> Invert View
> Invert Output
> 
> .... other

I'd say "Inverted Colors".

> Which place is better for this option in menu bar
> Edit (like the rotate options)
> View

I'd say "View", since "View -> Inverted Colors" exactly describes the propsed feature.
Comment 37 Juanjo Marín 2009-09-16 09:45:35 UTC
Wouter, thank you for replying. I took a look to the HIG. This is what I've got:

The Edit menu contains items relating to editing both the document (clipboard handling, search and replace, and inserting special objects) and the user's preferences.[1]

=> So then I don't understand why rotate left and right are here (If rotate left/right and the inverted colors feature goes to the View menu, then, it seems overpopulated to me, but does not exceed the limit of 15 items as stated on the HIG)

The View menu contains only items that affect the user's view of the current document. Do not place any items on the View menu that affect the the content of the current document. (Exception: View ▸ Reload may change the current contents if, for example, the document is a webpage that has been recently updated on the server).

> I'd say "View", since "View -> Inverted Colors" exactly describes the propsed
> feature.

=> So you're right. This feature affect the user's view

Label menu items with verbs for commands and adjectives for settings, according to the rules in Section 8.3.2 ― Capitalization. [3]

> I'd say "Inverted Colors".

I think it is a command, because I guess settings must be on a Preference menu.

Then Invert Colors is the one I think it's sensible, Any comment ?

[1] http://library.gnome.org/devel/hig-book/stable/menus-standard.html.en
[2] http://library.gnome.org/devel/hig-book/stable/menus-types.html.en
[3] http://library.gnome.org/devel/hig-book/stable/menus.html.en
Comment 38 Carlos Garcia Campos 2009-09-16 10:00:25 UTC
(In reply to comment #37)
> Wouter, thank you for replying. I took a look to the HIG. This is what I've
> got:
> 
> The Edit menu contains items relating to editing both the document (clipboard
> handling, search and replace, and inserting special objects) and the user's
> preferences.[1]
> 
> => So then I don't understand why rotate left and right are here

See bug #320270
Comment 39 Wouter Bolsterlee (uws) 2009-09-16 17:50:23 UTC
(In reply to comment #37)
> > I'd say "Inverted Colors". 
> I think it is a command, because I guess settings must be on a Preference menu.
> Then Invert Colors is the one I think it's sensible, Any comment ?

I still think it should be "Inverted Colors", since you "View" the document with "Inverted Colors", just like you "View" the document as a "Presentation" or in "Dual" mode.

My interpretation of:

> The View menu contains only items that affect the user's view of the current
> document. Do not place any items on the View menu that affect the the content
> of the current document. (Exception: View ▸ Reload may change the current
> contents if, for example, the document is a webpage that has been recently
> updated on the server).

... is that only "Reload" is a command (and an exception), while neither of the other items in the menu are commands.
Comment 40 Juanjo Marín 2009-09-16 22:22:17 UTC
(In reply to comment #39)

> I still think it should be "Inverted Colors", since you "View" the document
> with "Inverted Colors", just like you "View" the document as a "Presentation"
> or in "Dual" mode.

You must be right, so I'm going to do that :)

http://www.flickr.com/photos/jjmarin/3927425784/
Comment 41 Juanjo Marín 2009-10-17 14:15:18 UTC
Created attachment 145662 [details] [review]
Add Inverted Colors features (fixes #321823)

This is the patch I'm been working on. There has been a lot of changes on the Evince code since 2.27, so I've had to resolve several conflicts (new model, gvfs metadata, etc).

It applies against the current master. It works for me, but I guess that there must errors on the code because I made too much changes on several file that I'm not totally sure.

You don't need the latest Cairo to get it working, because there is an alternative way of inverting the colors using pixbuf (See code on ev-document-misc.c).

You need some icons that I'll post on another attachments (I don't knoe if it's possible to make a patch with the new icons).
Comment 42 Juanjo Marín 2009-10-17 14:46:04 UTC
The icon I've choosen for this feature is the stock_filters-invert. This icon is used on the invert option on Gimpo. I'm not quite sure if we must add it on the code, but if so, AFAIK, it must be included here:

data/icons/16x16/actions/stock_filters-invert.png
data/icons/16x16/actions/stock_filters-invert.png
Comment 43 Juanjo Marín 2009-10-17 14:47:36 UTC
Created attachment 145671 [details]
data/icons/16x16/actions/stock_filters-invert.png
Comment 44 Juanjo Marín 2009-10-17 14:48:23 UTC
Created attachment 145672 [details]
data/icons/24x24/actions/stock_filters-invert.png
Comment 45 Flavio Martins 2009-10-18 00:15:35 UTC
Created attachment 145706 [details] [review]
Juanjo's patch cleaned up

Just a cleaner patch based on Juanjo's. (whitespace, etc)
When I get jhbuild on this pc I'll try to build this.
I tried to build a package for 2.28 which would allow me to build a package for ubuntu karmic, but i failed miserably :D
Comment 46 Juanjo Marín 2009-10-18 09:22:25 UTC
Flavio,

The patch only applies against the master branch. There are changes beetwen master and gnome-2.28 so this is the reason of the conflicts you've found.

This patch is not intended for gnome-2.28 because it has a string to be translated and the translation for gnome-2.28 is frozen for addinf new strings. Anyway, if you really want a patch for gnome-2.28, I can do one for you, though I'm busy these days, so you will have to wait a little.
Comment 47 Juanjo Marín 2009-10-20 21:50:47 UTC
Following the comments on IRC,

This patch inverts the images too. For not inverting the image, I think we need that poppler could return only text or only images. And maybe we need to separate background and foreground images (background should be inverted and the foreground ones shouldn't). The same applies for the other backends, IMHO. 

This patch basically calls a function to get cairo_surface_t or GdkPixbuf inverted, and we can do that on all the backends.

It means two new functions on libdocument/ev-document-misc.c:
cairo_surface_t *ev_document_misc_inverted_colors_surface (cairo_t   *cr);
void		 ev_document_misc_inverted_colors_pixbuf  (GdkPixbuf *pixbuf);

The main idea of this patch is make easier the reading of documents on the screen, and it can be considered as an accesibility feature.

My comment about working on this for applying ASAP is because this patch is very sensitive to changes because it affects a lot of files:

backend/comics/comics-document.c
backend/djvu/djvu-document.c
backend/dvi/dvi-document.c
backend/impress/impress-document.c
backend/pdf/ev-poppler.cc
backend/pixbuf/pixbuf-document.c
backend/ps/ev-spectre.c
backend/tiff/tiff-document.c

data/evince-toolbar.xml
data/evince-ui.xml

libdocument/ev-document-misc.c
libdocument/ev-document-misc.h

libdocument/ev-render-context.c
libdocument/ev-render-context.h

libview/ev-document-model.c
libview/ev-document-model.h

libview/ev-jobs.c
libview/ev-jobs.h

libview/ev-pixbuf-cache.c
libview/ev-pixbuf-cache.h

libview/ev-stock-icons.c
libview/ev-stock-icons.h

libview/ev-view-private.h
libview/ev-view.c
libview/ev-view.h
 
shell/ev-sidebar-thumbnails.c
shell/ev-sidebar-thumbnails.h
shell/ev-window.c 

thumbnailer/evince-thumbnailer.c 

Several changes on the code (new model, gvfs metadata, etc) affected the patch, so I've tried to fix the conflicts the best I can, though I don't feel quite sure about the correctness of all the code.

I could try to keep up the patch on sync with master, but if you can take a brief review for giving some direction or to start something new from the scratch it can help a lot ;)
Comment 48 Juanjo Marín 2009-10-29 00:02:13 UTC
It has now some conflicts with master, I'll fix ASAP
Comment 49 Juanjo Marín 2009-10-31 00:53:17 UTC
Created attachment 146614 [details] [review]
Fix conflict of patch 145662 and some indentation issues.
Comment 50 Juanjo Marín 2009-11-21 00:56:36 UTC
Created attachment 148204 [details] [review]
Add option for displaying with inverted colors. Icon borrowed from GIMP.  Fixes bgo #321823

- Removes the inversion of colors from the backends and now it is implemented on
  ev-jobs.c.
- Removes inverted-color information and operations from libdocument/ev-render-
  context.c/h
- Fixes a memory leak

Patch created with git-format-patch because the icon files, so please use git-apply for applying it.
Comment 51 Juanjo Marín 2009-11-21 01:06:08 UTC
Visually, the main diference with the previous version is that the thumbnails are totally inverted, including the frame and shadow.

For example: http://www.flickr.com/photos/jjmarin/4115400873/
Comment 52 Carlos Garcia Campos 2009-11-29 15:55:38 UTC
Review of attachment 148204 [details] [review]:

Finally applied to git master with several modifications, thank you very much!
Comment 53 Nish 2011-10-31 07:24:46 UTC
This feature is a good progress indeed  , but i would love to have some themes or options other than black and white , something like dark yellow in greyish black .
High contrast colors are difficult to read , and both the current options are very high contrast schemes. Some Ipad apps have this feature .
Comment 54 Nish 2011-10-31 07:27:15 UTC
Like someone has posted below how about something like a real ebook look and feel , with some old books colors hardcoded ? I might be interested to work on this , though I am relatively new to programming.