Changeset 3588 for trunk/GSASIIplot.py
- Timestamp:
- Sep 7, 2018 9:10:11 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIplot.py ¶
r3584 r3588 1097 1097 size = Page.canvas.GetSize() 1098 1098 GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1) 1099 if mode in ['jpeg',]: 1100 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGBA,GL.GL_UNSIGNED_BYTE) 1101 im = Im.new("RGBA", (size[0],size[1])) 1102 else: 1103 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB,GL.GL_UNSIGNED_BYTE) 1104 im = Im.new("RGB", (size[0],size[1])) 1099 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB,GL.GL_UNSIGNED_BYTE) 1100 im = Im.new("RGB", (size[0],size[1])) 1105 1101 try: 1106 1102 im.frombytes(Pix) … … 3088 3084 ''' 3089 3085 def ClosestColorNumber(color): 3090 '''Convert a RGB or RGBAvalue to the closest default Grace color3086 '''Convert a RGB value to the closest default Grace color 3091 3087 ''' 3092 3088 import matplotlib.colors as mpcls … … 7111 7107 else: 7112 7108 dlg = wx.FileDialog(G2frame, 'Choose graphics save file', 7113 wildcard='Graphics file (*.'+mode+')|*.'+mode,style=wx.FD_OPEN| wx. CHANGE_DIR)7109 wildcard='Graphics file (*.'+mode+')|*.'+mode,style=wx.FD_OPEN| wx.FD_CHANGE_DIR) 7114 7110 try: 7115 7111 if dlg.ShowModal() == wx.ID_OK: … … 7118 7114 dlg.Destroy() 7119 7115 size = Page.canvas.GetSize() 7120 GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1) 7121 if mode in ['jpeg',]: 7122 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGBA, GL.GL_UNSIGNED_BYTE) 7123 im = Im.new("RGBA", (size[0],size[1])) 7124 else: 7125 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 7126 im = Im.new("RGB", (size[0],size[1])) 7127 try: 7128 im.frombytes(Pix) 7129 except AttributeError: 7130 im.fromstring(Pix) 7131 im = im.transpose(Im.FLIP_TOP_BOTTOM) 7132 im.save(Fname,mode) 7133 cb.SetValue(' save as/key:') 7134 G2frame.G2plotNB.status.SetStatusText('Drawing saved to: '+Fname,1) 7116 if Fname: 7117 GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1) 7118 if mode in ['jpeg',]: 7119 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 7120 im = Im.new("RGB", (size[0],size[1])) 7121 else: 7122 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 7123 im = Im.new("RGB", (size[0],size[1])) 7124 try: 7125 im.frombytes(Pix) 7126 except AttributeError: 7127 im.fromstring(Pix) 7128 im = im.transpose(Im.FLIP_TOP_BOTTOM) 7129 im.save(Fname,mode) 7130 cb.SetValue(' save as/key:') 7131 G2frame.G2plotNB.status.SetStatusText('Drawing saved to: '+Fname,1) 7135 7132 else: 7136 7133 event.key = cb.GetValue()[0] … … 8478 8475 size = Page.canvas.GetSize() 8479 8476 GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1) 8480 if mode in ['jpeg',]: 8481 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGBA, GL.GL_UNSIGNED_BYTE) 8482 im = Im.new("RGBA", (size[0],size[1])) 8483 else: 8484 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 8485 im = Im.new("RGB", (size[0],size[1])) 8477 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 8478 im = Im.new("RGB", (size[0],size[1])) 8486 8479 try: 8487 8480 im.frombytes(Pix) … … 8625 8618 size = Page.canvas.GetSize() 8626 8619 GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1) 8627 if mode in ['jpeg',]: 8628 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGBA, GL.GL_UNSIGNED_BYTE) 8629 im = Im.new("RGBA", (size[0],size[1])) 8630 else: 8631 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 8632 im = Im.new("RGB", (size[0],size[1])) 8620 Pix = GL.glReadPixels(0,0,size[0],size[1],GL.GL_RGB, GL.GL_UNSIGNED_BYTE) 8621 im = Im.new("RGB", (size[0],size[1])) 8633 8622 try: 8634 8623 im.frombytes(Pix)
Note: See TracChangeset
for help on using the changeset viewer.