On 2018-12-26 22:27-0000 António Rodrigues Tomé wrote:

HI Alan
I'll try to answer your question. But first a little clarification in my
system example 30 works exactly the same way with my changes or without
them.
But really that was not the question.  just try to  put in xo1c example
plscolbga(0,0,0,0.);

(alpha=0 expected a background transparency) put this before    plstar( 2,
2 );

attach the result with my changes and without my changes.

Hi António:

Here is how I applied your commit here and locally modified it on my own
local topic branch.  (I give git details since I thought you might be interested
in those).

# Start with fresh copy of local master branch so it doesn't interfere with
# the other PLplot development work I am doing on a different topic branch
software@raven> git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
software@raven> git checkout -b qt5
software@merlin> git checkout -b qt5
Switched to a new branch 'qt5'
# Remind myself how to use "git am"
software@merlin> git help am
# Apply your commit
software@merlin> git am <~irwin/António.Rodrigues.Tomé/20181226/0001-correction-in-QtRasterDevice-QtRasterDevice-to-fix-a.patch Applying: correction in QtRasterDevice::QtRasterDevice to fix a alpha problem in the raster qt Drivers
.git/rebase-apply/patch:19: trailing whitespace.
fill(Qt::transparent); .git/rebase-apply/patch:30: trailing whitespace.

.git/rebase-apply/patch:31: trailing whitespace.

.git/rebase-apply/patch:34: trailing whitespace.

warning: 4 lines add whitespace errors.

# See what your commit message looks like currently.

commit 11caa19fb0666706794aa955d1a0657d7ec4d54c (HEAD -> qt5)
Author: António R. Tomé <antoniort...@users.sourceforge.net>
Date:   Mon Dec 24 14:58:00 2018 +0000

    correction in QtRasterDevice::QtRasterDevice to fix a alpha problem in the 
raster qt Drivers

# Fix trailing whitespace issues
software@merlin> scripts/remove_trailing_whitespace.sh The following list of files have trailing white space
./bindings/qt_gui/plqt.cpp
Remove trailing whitespace from all those files (yes/no)? yes

# Find current status
software@merlin> git status
On branch qt5
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   bindings/qt_gui/plqt.cpp

no changes added to commit (use "git add" and/or "git commit -a")

# Amend your commit with those whitespace changes
software@merlin> git add bindings
software@merlin> git status
On branch qt5
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   bindings/qt_gui/plqt.cpp

software@merlin> git commit --amend
[qt5 1ea8ea0a2] correction in QtRasterDevice::QtRasterDevice to fix a alpha 
problem in the raster qt Drivers
 Author: António R. Tomé <antoniort...@users.sourceforge.net>
 Date: Mon Dec 24 14:58:00 2018 +0000
 1 file changed, 6 insertions(+), 2 deletions(-)

# Style your commit to get rid of one additional whitespace change you made.
software@merlin> scripts/style_source.sh --apply
bindings/qt_gui/plqt.cpp

The --apply option is POWERFUL and will replace _all_ files mentioned above
(if any) with their styled versions.

Continue (yes/no)? yes
software@merlin> git status
On branch qt5
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   bindings/qt_gui/plqt.cpp

no changes added to commit (use "git add" and/or "git commit -a")
software@merlin> git add bindings
software@merlin> git commit --amend
[qt5 783c85ab5] correction in QtRasterDevice::QtRasterDevice to fix a alpha 
problem in the raster qt Drivers
 Author: António R. Tomé <antoniort...@users.sourceforge.net>
 Date: Mon Dec 24 14:58:00 2018 +0000
 1 file changed, 4 insertions(+), 1 deletion(-)

# Now see what your modified commit now looks like.
software@merlin> git diff HEAD^ HEAD
diff --git a/bindings/qt_gui/plqt.cpp b/bindings/qt_gui/plqt.cpp
index 13f582d84..f13f6176e 100644
--- a/bindings/qt_gui/plqt.cpp
+++ b/bindings/qt_gui/plqt.cpp
@@ -519,11 +519,13 @@ void QtPLDriver::setSolid()
 #if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || 
defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt )
 QtRasterDevice::QtRasterDevice( int i_iWidth, int i_iHeight ) :
     QtPLDriver( i_iWidth, i_iHeight ),
-    QImage( i_iWidth, i_iHeight, QImage::Format_RGB32 )
+    QImage( i_iWidth, i_iHeight, QImage::Format_ARGB32 )
 {
     // Painter initialised in the constructor contrary
     // to buffered drivers, which paint only in doPlot().
     m_painterP = new QPainter( this );
+    fill( Qt::transparent );
+
     QBrush b = m_painterP->brush();
     b.setStyle( Qt::SolidPattern );
     m_painterP->setBrush( b );
@@ -561,6 +563,7 @@ void QtRasterDevice::setBackgroundColor( int r, int g, int 
b, double alpha )
     if ( !m_painterP->isActive() )
         return;

+
     QBrush brush( QColor( r, g, b, (int) ( alpha * 255 ) ) );
     m_painterP->fillRect( 0, 0, width(), height(), brush );
 }

So far so good.

Now I test example 30 with a semi-transparent background after
rebuilding the qt target to incorporate the above (white-space modified) change.

examples/c/x30c -dev pngqt -o test2_qt.png -fam -bg 00F0.3

Unfortunately,

display -alpha activate png:test2_qt.png.1

(where "display" is an imagemagick application) renders an opaque blue
background in this case rather than a checkerboard with our semi-transparent
blue background superimposed. That is, apparently imagemagick has not figured out that test2_qt.png.1
has a semi-transparent blue background.

For what it is worth I attach test2_qt.png.1 so you can compare it with your 
own.

Could you send me the equivalent result you get there for the exact
experiment above?  Also, please let me know what application you use
(assuming it is not "display") to look at your own test2_qt.png.1 file
generated as above.

Alan
__________________________
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

Attachment: test2_qt.png.1
Description: Alan's results for fixed case

_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to