"save/restore alpha-transparency value"

[email protected] Tue, 11 Jun 2002 13:06:09 -0700
Newsgroups gmane.comp.lib.ivtools.patches
Message-ID <[email protected]>
Patch:    ivtools-020611-johnston-051
For:      ivtools-1.0
Author:   [email protected]
Subject:  save/restore alpha-transparency value
Requires: 

This is an intermediate patch to ivtools-1.0.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

- save/restore raster alpha-transparency value.

Index: OverlayUnidraw/ovraster.c
diff -c OverlayUnidraw/ovraster.c:1.4 OverlayUnidraw/ovraster.c:1.5
*** OverlayUnidraw/ovraster.c:1.4	Thu Jan 31 10:20:44 2002
--- src/OverlayUnidraw/ovraster.c	Tue Jun 11 13:03:41 2002
***************
*** 179,184 ****
--- 179,187 ----
      pl->add_param("graydouble", ParamStruct::keyword, &RasterScript::ReadGrayDouble,
  		  this, this);
  
+     pl->add_param("alpha", ParamStruct::keyword, &RasterScript::ReadAlpha,
+ 		  this, this);
+ 
      pl->add_param("proc", ParamStruct::keyword, &RasterScript::ReadProcess,
  		  this, this);
  
***************
*** 527,532 ****
--- 530,537 ----
        raster->write(out);
      }
  
+     if (rr->alphaval() != 1.0) out << " :alpha " << rr->alphaval();
+ 
      if (rr->xbeg()>=0 || rr->xend()>=0 || rr->ybeg()>=0 || rr->yend()>=0)
          out << " :sub " <<
  	    rr->xbeg() << "," <<
***************
*** 868,873 ****
--- 873,895 ----
          gr->xend(xend);
          gr->ybeg(ybeg);
          gr->yend(yend);
+         return 0;
+     }
+ }
+ 
+ 
+ int RasterScript::ReadAlpha (istream& in, void* addr1, void* addr2, void* addr3, void* addr4) {
+     RasterOvComp* comp = (RasterOvComp*)addr1;
+     float alpha;
+     OverlayRasterRect* gr = comp ? (OverlayRasterRect*) comp->GetGraphic() : nil;
+  
+     ParamList::skip_space(in);
+     in >> alpha;
+     if (!in.good()) {
+         return -1;
+     }
+     else {
+         if (gr) gr->alphaval(alpha);
          return 0;
      }
  }
Index: OverlayUnidraw/ovraster.h
diff -c OverlayUnidraw/ovraster.h:1.3 OverlayUnidraw/ovraster.h:1.4
*** OverlayUnidraw/ovraster.h:1.3	Wed Jan 30 14:12:08 2002
--- src/OverlayUnidraw/ovraster.h	Tue Jun 11 13:03:41 2002
***************
*** 189,194 ****
--- 189,196 ----
      // read floating point pixel values directly from serialized file.
      static int ReadGrayDouble(istream&, void*, void*, void*, void*);
      // read double floating point pixel values directly from serialized file.
+     static int ReadAlpha(istream&, void*, void*, void*, void*);
+     // read alpha-transparency value specification.
      static int ReadSub(istream&, void*, void*, void*, void*);
      // read sub-image specification.
      static int ReadProcess(istream&, void*, void*, void*, void*);
*** /dev/null	 Tue Jun 11 13:03:52 PDT 2002
--- patches/ivtools-020611-johnston-051
*************** patches/ivtools-020611-johnston-051
*** 0 ****
--- 1 ----
+ ivtools-020611-johnston-051

_______________________________________________________________

Multimillion Dollar Computer Inventory
Live Webcast Auctions Thru Aug. 2002 - http://www.cowanalexander.com/calendar