Package pyjamas :: Package Canvas :: Module CanvasGradientImplIE6
[hide private]
[frames] | no frames]

Source Code for Module pyjamas.Canvas.CanvasGradientImplIE6

 1  """ 
 2  * Copyright 2008 Google Inc. 
 3  * 
 4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 5  * use this file except in compliance with the License. You may obtain a copy of 
 6  * the License at 
 7  * 
 8  * http:#www.apache.org/licenses/LICENSE-2.0 
 9  * 
10  * Unless required by applicable law or agreed to in writing, software 
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
13  * License for the specific language governing permissions and limitations under 
14  * the License. 
15  """ 
16   
17  import math 
18   
19   
20   
21  from pyjamas.Canvas.ColorStop import ColorStop 
22   
23  """* 
24  * Gradients for IE6 implementation need some extra meta info. 
25  """ 
26 -class CanvasGradientImplIE6:
27 - def __init__(self, x0, y0, x1, y1):
28 self.startX = x0 29 self.startY = y0 30 self.endX = x1 31 self.endY = y1 32 self.startRad = 0 33 self.endRad = 0 34 self.dx = x1 - x0 35 self.dy = y1 - y0 36 self.length = math.sqrt((self.dx * self.dx) + (self.dy * self.dy)) 37 self.angle = int(math.atan(self.dx / self.dy) * 180 / math.pi) + 180 38 39 self.colorStops = []
40
41 - def addColorStop(self, offset, color):
42 newColorStop = ColorStop(offset, color) 43 for i in range(len(self.colorStops)): 44 cs = self.colorStops[i] 45 if offset < cs.offset: 46 self.colorStops.append(i, newColorStop) 47 return 48 49 self.colorStops.append(newColorStop)
50 51 52 """* 53 * Creates an equivalent copy of this Gradient object. 54 * 55 * @return returns an equivalent copy of this gradient object 56 """
57 - def cloneGradient(self):
58 pass
59