[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo irregular2.py xupdf.py
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz/gfx/demo irregular2.py xupdf.py |
Date: |
Fri, 27 Sep 2002 11:37:21 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/09/27 11:37:21
Modified files:
gfx/demo : irregular2.py xupdf.py
Log message:
Make irregu2 use distortion - looks nice but some artifacts. Try to use
irregu in xupdf but for some reason, encountering the most fundamental bug of
computer graphics
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregular2.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xupdf.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregular2.py
diff -c gzz/gfx/demo/irregular2.py:1.19 gzz/gfx/demo/irregular2.py:1.20
*** gzz/gfx/demo/irregular2.py:1.19 Thu Sep 26 13:37:11 2002
--- gzz/gfx/demo/irregular2.py Fri Sep 27 11:37:21 2002
***************
*** 89,94 ****
--- 89,100 ----
self.scale * -14.2,
self.scale * 150)
vs.matcher.add(cs1, "1")
+
+ cs1_d = vs.coords.distort(cs1, 0, 0, 0.1, 0.1, 10, 0.5)
+ vs.matcher.add(cs1_d, "1_d")
+
+ if 1:
+ cs1 = cs1_d
#vs.map.put(self.mask, cs2)
if self.mode & 4:
Index: gzz/gfx/demo/xupdf.py
diff -c gzz/gfx/demo/xupdf.py:1.24 gzz/gfx/demo/xupdf.py:1.25
*** gzz/gfx/demo/xupdf.py:1.24 Fri Sep 27 05:53:22 2002
--- gzz/gfx/demo/xupdf.py Fri Sep 27 11:37:21 2002
***************
*** 95,107 ****
def moveToCell(cell, nx=1, ny=1):
! global globalcursor, globalx, globaly, globalpap, globalcurlinks
global globalforw, globalback
- content = space.cellTexter.getEnfilade(cell, None)
# Check type
if 1: # PDF
! globalpap = getPDFPapers(content)
linktaken = globalcurlinks.get(cell.getId(), None)
if linktaken:
--- 95,106 ----
def moveToCell(cell, nx=1, ny=1):
! global globalcursor, globalx, globaly, globalcurlinks, globalview
global globalforw, globalback
# Check type
if 1: # PDF
! globalview = CellPDFView(cell)
linktaken = globalcurlinks.get(cell.getId(), None)
if linktaken:
***************
*** 111,116 ****
--- 110,116 ----
globalx, globaly = nx, ny
+ content = space.cellTexter.getEnfilade(cell, None)
globalforw = xuindexer.getForwardIndex().getMatches(content)
globalback = xuindexer.getBackwardIndex().getMatches(content)
***************
*** 119,126 ****
--- 119,189 ----
java.lang.System.gc()
AbstractUpdateManager.chg()
+ class CellPDFView:
+ def __init__(self, cell):
+ self.cell = cell
+ self.content = space.cellTexter.getEnfilade(cell, None)
+ self.pap = getPDFPapers(self.content)
+ self.irregu = IrreguFrame(0.2, 10, 10, # XXX
+ 1)
+ # Height = always 1.
+ # Start = always (0,0)
+ def placepapers(self, vs,
+ cs1into, onlypages=None, depth=10,
+ cliprect = None):
+ key = self.cell.getId()
+ # The height in coords
+ h = 1
+ papers = self.pap
+ ph = papers[0][2]
+ scale = h/ph
+ curx = 0
+ ycoord = 0
+ # print "x,y for place: ",curx, ycoord
+ # print papers
+ grid = 13
+ corners = (0, 0, papers[0][1], papers[0][2])
+ cs2 = vs.coords.affineCoordsys(0, 0,
+ 0, 0, 1, 0, 0, 1)
+ vs.matcher.add(cs2, key+"_p2_")
+
+ class PutPapers(java.lang.Runnable):
+ def run(rself):
+ for i in range(0, len(papers)):
+ # create always all cs, gets interpolation better
+ cs1 = vs.coords.affineCoordsys(cs1into, 100,
+ curx, ycoord, scale, 0, 0, scale)
+ vs.matcher.add(cs1, key+"_p_"+str(i))
+ if onlypages == None or i in onlypages:
+ if globalusefancypaper:
+ pq = GLRen.createPaperQuad(
+ papers[i][3], *corners)
+ vs.map.put(pq, cs1, cs2)
+ else:
+ pq = GLRen.createPaperQuad(
+ papers[i][0], *corners)
+ vs.map.put(pq, cs1, cs2)
+ curx += 1.02 * papers[i][1] * scale
+
+ pp = PutPapers()
+ if cliprect:
+ irr = vs.coords.affineCoordsys(0, 0,
+ (cliprect[0]+cliprect[2])/2,
+ (cliprect[1]+cliprect[3])/2,
+ (cliprect[2]-cliprect[0])/2,
+ 0, 0,
+ (cliprect[3]-cliprect[1])/2)
+ vs.map.put(self.irregu.frame, cs1into, irr)
+ vs.map.put(self.irregu.content, cs1into, irr)
+ print "Irr: ",cliprect
+ else:
+ pp.run()
+
+
globalscrollblockPapers = {}
def getScrollblockPaper(sb):
+ """Get the paper object for a given scrollblock.
+ """
hashkey = sb.hashCode() + globalseedoffs
ret = globalscrollblockPapers.get(hashkey, None)
if ret == None:
***************
*** 136,144 ****
for i in range(0, content.length()):
rect = GLSpans.getRect(contentspan.subSpan(i,i+1), globalLOD)
print "Rect: ",globalLOD, rect
! ret.append(
! (scrollblockPaper, pdfpaper(rect))
! )
return ret
--- 199,205 ----
for i in range(0, content.length()):
rect = GLSpans.getRect(contentspan.subSpan(i,i+1), globalLOD)
print "Rect: ",globalLOD, rect
! ret.append( pdfpaper(rect, scrollblockPaper) )
return ret
***************
*** 160,166 ****
globalseedoffs += 1
moveToCell(globalcursor)
! def pdfpaper(pdfrect):
# Papercoords: (0,0) .. (w,h) where
# w = pdfrect.w / 72 / 6, same for h
# ret: (paper, w, h)
--- 221,232 ----
globalseedoffs += 1
moveToCell(globalcursor)
! def pdfpaper(pdfrect, background):
! """Get the papers for the pages.
!
! Returns: (pdf on white background, width, height,
! pdf on given background paper)
! """
# Papercoords: (0,0) .. (w,h) where
# w = pdfrect.w / 72 / 6, same for h
# ret: (paper, w, h)
***************
*** 168,177 ****
ph = pdfrect.h / 72.0 / 6
wm = (pdfrect.x1-pdfrect.x0) / pw
hm = (pdfrect.y1-pdfrect.y0) / ph
! def mpap(blend):
! pap = Paper()
! pap.setNPasses(1)
! ppass = pap.getPass(0)
texid = pdfrect.texId
ppass.setSetupcode("""
--- 234,248 ----
ph = pdfrect.h / 72.0 / 6
wm = (pdfrect.x1-pdfrect.x0) / pw
hm = (pdfrect.y1-pdfrect.y0) / ph
! def mpap(blend, pap = None):
! if pap == None:
! pap = Paper()
! pap.setNPasses(1)
! ppass = pap.getPass(0)
! else:
! p = pap.getNPasses()
! pap.setNPasses(p+1)
! ppass = pap.getPass(p)
texid = pdfrect.texId
ppass.setSetupcode("""
***************
*** 213,219 ****
FCI G ZERO UNSIGNED_IDENTITY_NV ALPHA
BlendFunc ONE ONE_MINUS_SRC_COLOR
BlendEquation FUNC_REVERSE_SUBTRACT
! """))
return (papw, pw, ph, papo)
--- 284,290 ----
FCI G ZERO UNSIGNED_IDENTITY_NV ALPHA
BlendFunc ONE ONE_MINUS_SRC_COLOR
BlendEquation FUNC_REVERSE_SUBTRACT
! """), pap = background.clone())
return (papw, pw, ph, papo)
***************
*** 225,267 ****
page * 1.02 * papers[0][1][1] * scale + pointx * pscale * scale,
pointy * pscale * scale,
)
-
- # Height = always 1.
- # Start = always (0,0)
- def placepapers(vs, cs1into, papers, key, onlypages=None, depth=10,
- cliprect = None):
- # The height in coords
- h = 1
- ph = papers[0][1][2]
- scale = h/ph
- curx = 0
- ycoord = 0
- # print "x,y for place: ",curx, ycoord
- # print papers
- grid = 13
- corners = (0, 0, papers[0][1][1], papers[0][1][2])
- cs2 = vs.coords.affineCoordsys(0, 0,
- 0, 0, 1, 0, 0, 1)
- vs.matcher.add(cs2, key+"_p2_")
- for i in range(0, len(papers)):
- # create always all cs, gets interpolation better
- cs1 = vs.coords.affineCoordsys(cs1into, 100,
- curx, ycoord, scale, 0, 0, scale)
- vs.matcher.add(cs1, key+"_p_"+str(i))
- if onlypages == None or i in onlypages:
- if globalusefancypaper:
- pq = GLRen.createPaperQuad(
- papers[i][0], *corners)
- vs.map.put(pq, cs1, cs2)
- pq = GLRen.createPaperQuad(
- papers[i][1][3], *corners)
- vs.map.put(pq, cs1, cs2)
- else:
- pq = GLRen.createPaperQuad(
- papers[i][1][0], *corners)
- vs.map.put(pq, cs1, cs2)
- curx += 1.02 * papers[i][1][1] * scale
-
def bg(vs):
putnoc(vs, background((0.3,0.5,0.4)))
putnoc(vs, getDListNocoords("""
--- 296,301 ----
***************
*** 384,390 ****
AbstractUpdateManager.chg()
def scene(self, vs):
bg(vs)
- print globalpap
bf = NadirCircleFloater_NoAnchor(vs,
screenctr, 100, None, 1)
cs1 = bf.addCentralBuoy(globalcursor.getId())
--- 418,423 ----
***************
*** 396,402 ****
vs.matcher.add(cs1_zoom, globalcursor.getId()+"__bulg")
cs1_trans = vs.coords.translateXY(cs1_zoom, -globalx, -globaly)
vs.matcher.add(cs1_trans, globalcursor.getId()+"__trans")
! placepapers(vs, cs1_trans, globalpap, globalcursor.getId())
currentScene = XuPDFScene_PDFZoom()
--- 429,438 ----
vs.matcher.add(cs1_zoom, globalcursor.getId()+"__bulg")
cs1_trans = vs.coords.translateXY(cs1_zoom, -globalx, -globaly)
vs.matcher.add(cs1_trans, globalcursor.getId()+"__trans")
!
! globalview.placepapers(vs, cs1_trans,
! cliprect = (-10+globalx, -1+globaly, 10+globalx, 10+globaly))
! # placepapers(vs, cs1_trans, globalpap, globalcursor.getId())
currentScene = XuPDFScene_PDFZoom()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx/demo irregular2.py xupdf.py,
Tuomas J. Lukka <=