Subversion Repositories Applications.gtt

Rev

Rev 61 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
60 jpm 1
<?php
2
/*
3
 * This work is hereby released into the Public Domain.
4
 * To view a copy of the public domain dedication,
5
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
6
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
7
 *
8
 */
9
 
10
require_once dirname(__FILE__)."/../Driver.class.php";
11
 
12
/**
13
 * Draw your objects
14
 *
15
 * @package Artichow
16
 */
17
class awMingDriver extends awDriver {
18
 
19
	/**
20
	 * The Flash movie
21
	 *
22
	 * @var $movie
23
	 */
24
	public $movie;
25
 
26
	public function __construct() {
27
 
28
		parent::__construct();
29
 
30
		$this->driverString = 'ming';
31
 
32
		// Nice defaults
33
		ming_setScale(20.0);
34
		ming_useswfversion(6);
35
 
36
	}
37
 
38
	/**
39
	 * Initialize the driver for a particular awImage object
40
	 *
41
	 * @param awImage $image
42
	 */
43
	public function init(awImage $image) {
44
 
45
		if($this->movie === NULL) {
46
			$this->setImageSize($image->width, $image->height);
47
 
48
			// Create movie
49
			$this->movie = new SWFMovie();
50
			if(!$this->movie) {
51
				awImage::drawError("Class Image: Unable to create a graph.");
52
			}
53
 
54
			$this->movie->setDimension($image->width, $image->height);
55
 
56
			$this->setAntiAliasing($image->getAntiAliasing());
57
 
58
			// Original color
59
			$this->filledRectangle(
60
				new awWhite,
61
				new awLine(
62
					new awPoint(0, 0),
63
					new awPoint($this->imageWidth, $this->imageHeight)
64
				)
65
			);
66
 
67
			$shadow = $image->shadow;
68
			if($shadow !== NULL) {
69
				$shadow = $shadow->getSpace();
70
				$p1 = new awPoint($shadow->left, $shadow->top);
71
				$p2 = new awPoint($this->imageWidth - $shadow->right - 1, $this->imageHeight - $shadow->bottom - 1);
72
 
73
				// Draw image background
74
				$this->filledRectangle($image->getBackground(), new awLine($p1, $p2));
75
 
76
				// Draw image border
77
				$image->border->rectangle($this, $p1, $p2);
78
			}
79
		}
80
	}
81
 
82
	/**
83
	 * Initialize the Driver for a particular FileImage object
84
	 *
85
	 * @param awFileImage $fileImage The FileImage object to work on
86
	 * @param string $file Image filename
87
	 */
88
	public function initFromFile(awFileImage $fileImage, $file) {
89
 
90
	}
91
 
92
	/**
93
	 * Change the image size
94
	 *
95
	 * @param int $width Image width
96
	 * @param int $height Image height
97
	 */
98
	public function setImageSize($width, $height) {
99
		$this->imageWidth = $width;
100
		$this->imageHeight = $height;
101
	}
102
 
103
	/**
104
	 * Inform the driver of the position of your image
105
	 *
106
	 * @param float $x Position on X axis of the center of the component
107
	 * @param float $y Position on Y axis of the center of the component
108
	 */
109
	public function setPosition($x, $y) {
110
		// Calculate absolute position
111
		$this->x = round($x * $this->imageWidth - $this->w / 2);
112
		$this->y = round($y * $this->imageHeight - $this->h / 2);
113
	}
114
 
115
	/**
116
	 * Inform the driver of the position of your image
117
	 * This method need absolutes values
118
	 *
119
	 * @param int $x Left-top corner X position
120
	 * @param int $y Left-top corner Y position
121
	 */
122
	public function setAbsPosition($x, $y) {
123
		$this->x = $x;
124
		$this->y = $y;
125
	}
126
 
127
	/**
128
	 * Move the position of the image
129
	 *
130
	 * @param int $x Add this value to X axis
131
	 * @param int $y Add this value to Y axis
132
	 */
133
	public function movePosition($x, $y) {
134
		$this->x += (int)$x;
135
		$this->y += (int)$y;
136
	}
137
 
138
	/**
139
	 * Inform the driver of the size of your image
140
	 * Height and width must be between 0 and 1.
141
	 *
142
	 * @param int $w Image width
143
	 * @param int $h Image height
144
	 * @return array Absolute width and height of the image
145
	 */
146
	public function setSize($w, $h) {
147
 
148
		// Calcul absolute size
149
		$this->w = round($w * $this->imageWidth);
150
		$this->h = round($h * $this->imageHeight);
151
 
152
		return $this->getSize();
153
 
154
	}
155
 
156
	/**
157
	 * Inform the driver of the size of your image
158
	 * You can set absolute size with this method.
159
	 *
160
	 * @param int $w Image width
161
	 * @param int $h Image height
162
	 */
163
	public function setAbsSize($w, $h) {
164
		$this->w = $w;
165
		$this->h = $h;
166
 
167
		return $this->getSize();
168
	}
169
 
170
	/**
171
	 * Get the size of the component handled by the driver
172
	 *
173
	 * @return array Absolute width and height of the component
174
	 */
175
	public function getSize() {
176
		return array($this->w, $this->h);
177
	}
178
 
179
	/**
180
	 * Turn antialiasing on or off
181
	 *
182
	 * @var bool $bool
183
	 */
184
	public function setAntiAliasing($bool) {
185
		if($this->movie !== NULL) {
186
 
187
			$actionscript = '
188
			_quality = "%s";
189
			';
190
 
191
			if((bool)$bool) {
192
				$actionscript = sprintf($actionscript, 'high');
193
			} else {
194
				$actionscript = sprintf($actionscript, 'low');
195
			}
196
 
197
			$this->movie->add(new SWFAction(str_replace("\r", "", $actionscript)));
198
		}
199
	}
200
 
201
	/**
202
	 * When passed a Color object, returns the corresponding
203
	 * color identifier (driver dependant).
204
	 *
205
	 * @param awColor $color A Color object
206
	 * @return array $rgba A color identifier representing the color composed of the given RGB components
207
	 */
208
	public function getColor(awColor $color) {
209
 
210
		// Ming simply works with R, G, B and Alpha values.
211
		list($red, $green, $blue, $alpha) = $color->rgba();
212
 
213
		// However, the Ming alpha channel ranges from 255 (opaque) to 0 (transparent),
214
		// while the awColor alpha channel ranges from 0 (opaque) to 100 (transparent).
215
		// First, we convert from 0-100 to 0-255.
216
		$alpha = (int)($alpha * 255 / 100);
217
 
218
		// Then from 0-255 to 255-0.
219
		$alpha = abs($alpha - 255);
220
 
221
		return array($red, $green, $blue, $alpha);
222
	}
223
 
224
	/**
225
	 * Draw an image here
226
	 *
227
	 * @param awImage $image Image
228
	 * @param int $p1 Image top-left point
229
	 * @param int $p2 Image bottom-right point
230
	 */
231
	public function copyImage(awImage $image, awPoint $p1, awPoint $p2) {
232
 
233
	}
234
 
235
	/**
236
	 * Draw an image here
237
	 *
238
	 * @param awImage $image Image
239
	 * @param int $d1 Destination top-left position
240
	 * @param int $d2 Destination bottom-right position
241
	 * @param int $s1 Source top-left position
242
	 * @param int $s2 Source bottom-right position
243
	 * @param bool $resample Resample image ? (default to TRUE)
244
	 */
245
	public function copyResizeImage(awImage $image, awPoint $d1, awPoint $d2, awPoint $s1, awPoint $s2, $resample = TRUE) {
246
 
247
	}
248
 
249
	/**
250
	 * Draw a string
251
	 *
252
	 * @var awText $text Text to print
253
	 * @param awPoint $point Draw the text at this point
254
	 * @param int $width Text max width
255
	 */
256
	public function string(awText $text, awPoint $point, $width = NULL) {
257
		$font = $text->getFont();
258
 
259
		// Can we deal with that font?
260
		if($this->isCompatibleWithFont($font) === FALSE) {
261
			awImage::drawError('Class MingDriver: Incompatible font type (\''.get_class($font).'\')');
262
		}
263
 
264
		// Ming can only work with awFileFont objects for now
265
		// (i.e. awFDBFont, or awTuffy et al.)
266
		$fontDriver = $this->fileFontDriver;
267
 
268
		if($text->getBackground() !== NULL or $text->border->visible()) {
269
 
270
			list($left, $right, $top, $bottom) = $text->getPadding();
271
 
272
			$textWidth = $fontDriver->getTextWidth($text, $this);
273
			$textHeight = $fontDriver->getTextHeight($text, $this);
274
 
275
			$x1 = floor($point->x - $left);
276
			$y1 = floor($point->y - $top);
277
			$x2 = $x1 + $textWidth + $left + $right;
278
			$y2 = $y1 + $textHeight + $top + $bottom;
279
 
280
			$this->filledRectangle(
281
				$text->getBackground(),
282
				awLine::build($x1, $y1, $x2, $y2)
283
			);
284
 
285
			$text->border->rectangle(
286
				$this,
287
				new awPoint($x1 - 1, $y1 - 1),
288
				new awPoint($x2 + 1, $y2 + 1)
289
			);
290
 
291
		}
292
 
293
		$fontDriver->string($this, $text, $point, $width);
294
	}
295
 
296
	/**
297
	 * Draw a pixel
298
	 *
299
	 * @param awColor $color Pixel color
300
	 * @param awPoint $p
301
	 */
302
	public function point(awColor $color, awPoint $p) {
303
		if($p->isHidden() === FALSE) {
304
			list($red, $green, $blue, $alpha) = $this->getColor($color);
305
 
306
			$point = new SWFShape();
307
			$point->setLine(1, $red, $green, $blue, $alpha);
308
			$point->movePenTo($this->x + round($p->x), $this->y + round($p->y));
309
			$point->drawLine(0.5, 0.5);
310
			$point->movePen(-0.5, 0);
311
			$point->drawLine(0.5, -0.5);
312
 
313
			$this->movie->add($point);
314
		}
315
	}
316
 
317
	/**
318
	 * Draw a colored line
319
	 *
320
	 * @param awColor $color Line color
321
	 * @param awLine $line
322
	 * @param int $thickness Line tickness
323
	 */
324
	public function line(awColor $color, awLine $line) {
325
		if($line->getThickness() > 0 and $line->isHidden() === FALSE) {
326
 
327
			list($red, $green, $blue, $alpha) = $this->getColor($color);
328
 
329
			$mingLine = new SWFShape();
330
			$mingLine->setLine($line->getThickness(), $red, $green, $blue, $alpha);
331
 
332
			list($p1, $p2) = $line->getLocation();
333
 
334
			$mingLine->movePenTo($this->x + round($p1->x), $this->y + round($p1->y));
335
 
336
			switch($line->getStyle()) {
337
 
338
				case awLine::SOLID :
339
					$mingLine->drawLineTo($this->x + round($p2->x), $this->y + round($p2->y));
340
					$this->movie->add($mingLine);
341
					break;
342
 
343
				case awLine::DOTTED :
344
					$size = sqrt(pow($p2->y - $p1->y, 2) + pow($p2->x - $p1->x, 2));
345
					$cos = ($p2->x - $p1->x) / $size;
346
					$sin = ($p2->y - $p1->y) / $size;
347
 
348
					for($i = 0; $i <= $size; $i += 2) {
349
						$p = new awPoint(
350
							round($i * $cos + $p1->x),
351
							round($i * $sin + $p1->y)
352
						);
353
						$this->point($color, $p);
354
					}
355
 
356
					break;
357
 
358
				case awLine::DASHED :
359
					$width = $p2->x - $p1->x;
360
					$height = $p2->y - $p1->y;
361
					$size = sqrt(pow($height, 2) + pow($width, 2));
362
 
363
					if($size == 0) {
364
						return;
365
					}
366
 
367
					$cos = $width / $size;
368
					$sin = $height / $size;
369
 
370
					$functionX = ($width  > 0) ? 'min' : 'max';
371
					$functionY = ($height > 0) ? 'min' : 'max';
372
 
373
					for($i = 0; $i <= $size; $i += 6) {
374
 
375
						$t1 = new awPoint(
376
							round($i * $cos + $p1->x),
377
							round($i * $sin + $p1->y)
378
						);
379
 
380
						$t2 = new awPoint(
381
							round($functionX(($i + 3) * $cos, $width) + $p1->x),
382
							round($functionY(($i + 3) * $sin, $height) + $p1->y)
383
						);
384
 
385
						$this->line($color, new awLine($t1, $t2));
386
 
387
					}
388
 
389
					break;
390
 
391
			}
392
 
393
		}
394
 
395
	}
396
 
397
	/**
398
	 * Draw a color arc
399
 
400
	 * @param awColor $color Arc color
401
	 * @param awPoint $center Point center
402
	 * @param int $width Ellipse width
403
	 * @param int $height Ellipse height
404
	 * @param int $from Start angle
405
	 * @param int $to End angle
406
	 */
407
	public function arc(awColor $color, awPoint $center, $width, $height, $from, $to) {
408
 
409
	}
410
 
411
	/**
412
	 * Draw an arc with a background color
413
	 *
414
	 * @param awColor $color Arc background color
415
	 * @param awPoint $center Point center
416
	 * @param int $width Ellipse width
417
	 * @param int $height Ellipse height
418
	 * @param int $from Start angle
419
	 * @param int $to End angle
420
	 */
421
	public function filledArc(awColor $color, awPoint $center, $width, $height, $from, $to) {
422
 
423
	}
424
 
425
	/**
426
	 * Draw a colored ellipse
427
	 *
428
	 * @param awColor $color Ellipse color
429
	 * @param awPoint $center Ellipse center
430
	 * @param int $width Ellipse width
431
	 * @param int $height Ellipse height
432
	 */
433
	public function ellipse(awColor $color, awPoint $center, $width, $height) {
434
 
435
	}
436
 
437
	/**
438
	 * Draw an ellipse with a background
439
	 *
440
	 * @param mixed $background Background (can be a color or a gradient)
441
	 * @param awPoint $center Ellipse center
442
	 * @param int $width Ellipse width
443
	 * @param int $height Ellipse height
444
	 */
445
	public function filledEllipse($background, awPoint $center, $width, $height) {
446
 
447
	}
448
 
449
	/**
450
	 * Draw a colored rectangle
451
	 *
452
	 * @param awColor $color Rectangle color
453
	 * @param awLine $line Rectangle diagonale
454
	 * @param awPoint $p2
455
	 */
456
	public function rectangle(awColor $color, awLine $line) {
457
		list($p1, $p2) = $line->getLocation();
458
 
459
		// Get Red, Green, Blue and Alpha values for the line
460
		list($r, $g, $b, $a) = $this->getColor($color);
461
 
462
		// Calculate the coordinates of the two other points of the rectangle
463
		$p3 = new Point($p1->x, $p2->y);
464
		$p4 = new Point($p2->x, $p1->y);
465
 
466
 
467
		$side = clone $line;
468
 
469
 
470
 
471
		// Draw the four sides of the rectangle, clockwise
472
		if(
473
			($p1->x <= $p2->x and $p1->y <= $p2->y)
474
			or
475
			($p1->x >= $p2->x and $p1->y >= $p2->y)
476
		) {
477
			$side->setLocation($p1, $p4);
478
			$this->line($color, $side);
479
 
480
			$side->setLocation($p4, $p2);
481
			$this->line($color, $side);
482
 
483
			$side->setLocation($p2, $p3);
484
			$this->line($color, $side);
485
 
486
			$side->setLocation($p3, $p1);
487
			$this->line($color, $side);
488
		} else {
489
			$side->setLocation($p1, $p3);
490
			$this->line($color, $side);
491
 
492
			$side->setLocation($p3, $p2);
493
			$this->line($color, $side);
494
 
495
			$side->setLocation($p2, $p4);
496
			$this->line($color, $side);
497
 
498
			$side->setLocation($p4, $p1);
499
			$this->line($color, $side);
500
		}
501
	}
502
 
503
	/**
504
	 * Draw a rectangle with a background
505
	 *
506
	 * @param mixed $background Background (can be a color or a gradient)
507
	 * @param awLine $line Rectangle diagonale
508
	 */
509
	public function filledRectangle($background, awLine $line) {
510
		list($p1, $p2) = $line->getLocation();
511
 
512
		// Common shape settings
513
		$shape = new SWFShape();
514
		$shape->setLine(0);
515
 
516
		if($background instanceof awColor) {
517
 
518
			// Get the Red, Green, Blue and Alpha values
519
			list($r, $g, $b, $a) = $this->getColor($background);
520
			$shape->setRightFill($r, $g, $b, $a);
521
 
522
		} else if($background instanceof awGradient) {
523
 
524
			// Get the Gradient object as an SWFGradient one
525
			list($flashGradient, $style) = $this->getGradient($background);
526
 
527
			$fill = $shape->addFill($flashGradient, $style);
528
 
529
			// Angles between Artichow and Ming don't match.
530
			// Don't use abs() or vertical gradients get inverted.
531
			$angle = $background->angle - 90;
532
			$fill->rotateTo($angle);
533
 
534
			// Move the gradient based on the position of the rectangle we're drawing
535
			$centerX = min($p1->x, $p2->y) + abs($p1->x - $p2->x) / 2;
536
			$centerY = min($p1->y, $p2->y) + abs($p1->y - $p2->y) / 2;
537
			$fill->moveTo($centerX, $centerY);
538
 
539
			// Ming draws its gradients on a 1600x1600 image,
540
			// so we have to resize it.
541
			if($angle === -90) {
542
				$ratio = abs($p1->y - $p2->y) / 1600;
543
			} else {
544
				$ratio = abs($p1->x - $p2->x) / 1600;
545
			}
546
			$fill->scaleTo($ratio);
547
 
548
			$shape->setRightFill($fill);
549
 
550
		}
551
 
552
		// Set starting position
553
		$shape->movePenTo($this->x + round($p1->x), $this->y + round($p1->y));
554
 
555
		// Depending on the points' relative positions,
556
		// we have two drawing possibilities
557
		if(
558
			($p1->x <= $p2->x and $p1->y <= $p2->y)
559
			or
560
			($p1->x >= $p2->x and $p1->y >= $p2->y)
561
		) {
562
			$shape->drawLineTo($this->x + round($p2->x), $this->y + round($p1->y));
563
			$shape->drawLineTo($this->x + round($p2->x), $this->y + round($p2->y));
564
			$shape->drawLineTo($this->x + round($p1->x), $this->y + round($p2->y));
565
			$shape->drawLineTo($this->x + round($p1->x), $this->y + round($p1->y));
566
		} else {
567
			$shape->drawLineTo($this->x + round($p1->x), $this->y + round($p2->y));
568
			$shape->drawLineTo($this->x + round($p2->x), $this->y + round($p2->y));
569
			$shape->drawLineTo($this->x + round($p2->x), $this->y + round($p1->y));
570
			$shape->drawLineTo($this->x + round($p1->x), $this->y + round($p1->y));
571
		}
572
 
573
		$this->movie->add($shape);
574
	}
575
 
576
	/**
577
	 * Draw a polygon
578
	 *
579
	 * @param awColor $color Polygon color
580
	 * @param Polygon A polygon
581
	 */
582
	public function polygon(awColor $color, awPolygon $polygon) {
583
		$points = $polygon->all();
584
		$count = count($points);
585
 
586
		if($count > 1) {
587
 
588
			$side = new awLine;
589
			$side->setStyle($polygon->getStyle());
590
			$side->setThickness($polygon->getThickness());
591
 
592
			$prev = $points[0];
593
 
594
			for($i = 1; $i < $count; $i++) {
595
				$current = $points[$i];
596
				$side->setLocation($prev, $current);
597
				$this->line($color, $side);
598
				$prev = $current;
599
			}
600
 
601
			// Close the polygon
602
			$side->setLocation($prev, $points[0]);
603
			$this->line($color, $side);
604
		}
605
	}
606
 
607
	/**
608
	 * Draw a polygon with a background
609
	 *
610
	 * @param mixed $background Background (can be a color or a gradient)
611
	 * @param Polygon A polygon
612
	 */
613
	public function filledPolygon($background, awPolygon $polygon) {
614
		$shape = new SWFShape();
615
 
616
		if($background instanceof awColor) {
617
			list($red, $green, $blue, $alpha) = $this->getColor($background);
618
 
619
			$shape->setRightFill($red, $green, $blue, $alpha);
620
		} elseif($background instanceof awGradient) {
621
			list($flashGradient, $style) = $this->getGradient($background);
622
 
623
			$fill = $shape->addFill($flashGradient, $style);
624
 
625
			list($xMin, $xMax) = $polygon->getBoxXRange();
626
			list($yMin, $yMax) = $polygon->getBoxYRange();
627
 
628
			if($background->angle === 0) {
629
				$fill->scaleTo(($yMax - $yMin) / 1600);
630
			} else {
631
				$fill->scaleTo(($xMax - $xMin) / 1600);
632
			}
633
			$fill->moveTo($xMin + ($xMax - $xMin) / 2, $yMin + ($yMax - $yMin) / 2);
634
 
635
			$shape->setRightFill($fill);
636
		}
637
 
638
		$points = $polygon->all();
639
		$count = count($points);
640
 
641
		if($count > 1) {
642
 
643
			$prev = $points[0];
644
 
645
			$shape->movePenTo($prev->x, $prev->y);
646
 
647
			for($i = 1; $i < $count; $i++) {
648
				$current = $points[$i];
649
				$shape->drawLineTo($current->x, $current->y);
650
			}
651
 
652
			// Close the polygon
653
			$shape->drawLineTo($prev->x, $prev->y);
654
 
655
			$this->movie->add($shape);
656
 
657
		}
658
	}
659
 
660
	/**
661
	 * Sends the image, as well as the correct HTTP headers, to the browser
662
	 *
663
	 * @param awImage $image The Image object to send
664
	 */
665
	public function send(awImage $image) {
666
		$this->drawImage($image);
667
	}
668
 
669
	/**
670
	 * Get the image as binary data
671
	 *
672
	 * @param awImage $image
673
	 */
674
	public function get(awImage $image) {
675
		return $this->drawImage($image, TRUE, FALSE);
676
	}
677
 
678
	public function getTextWidth(awText $text) {
679
		$font = $text->getFont();
680
		if($this->isCompatibleWithFont($font) === FALSE) {
681
			awImage::drawError('Class MingDriver: Incompatible font type (\''.get_class($font).'\')');
682
		}
683
 
684
		// Ming only supports FileFont
685
		$fontDriver = $this->fileFontDriver;
686
 
687
		return $fontDriver->getTextWidth($text, $this);
688
	}
689
 
690
	public function getTextHeight(awText $text) {
691
		$font = $text->getFont();
692
		if($this->isCompatibleWithFont($font) === FALSE) {
693
			awImage::drawError('Class MingDriver: Incompatible font type (\''.get_class($font).'\')');
694
		}
695
 
696
		// Ming only supports FileFont
697
		$fontDriver = $this->fileFontDriver;
698
 
699
		return $fontDriver->getTextHeight($text, $this);
700
	}
701
 
702
	protected function isCompatibleWithFont(awFont $font) {
703
		if($font instanceof awTTFFont or $font instanceof awPHPFont) {
704
			return FALSE;
705
		} else {
706
			return TRUE;
707
		}
708
	}
709
 
710
	private function drawImage(awImage $image, $return = FALSE, $header = TRUE) {
711
 
712
		// Send headers to the browser
713
		if($header === TRUE) {
714
			$image->sendHeaders();
715
		}
716
 
717
		if($return) {
718
			ob_start();
719
		}
720
 
721
		$this->movie->output();
722
 
723
		if($return) {
724
			return ob_get_clean();
725
		}
726
	}
727
 
728
	/**
729
	 * Convert an awGradient object to an SWFGradient one.
730
	 * Returns an object as well as the style of the Flash gradient.
731
	 *
732
	 * @param awGradient $gradient The awGradient object to convert
733
	 * @return array
734
	 */
735
	private function getGradient(awGradient $gradient) {
736
		$flashGradient = new SWFGradient();
737
 
738
		// Get RGBA values for the gradient boundaries
739
		list($r1, $g1, $b1, $a1) = $this->getColor($gradient->from);
740
		list($r2, $g2, $b2, $a2) = $this->getColor($gradient->to);
741
 
742
		$flashGradient->addEntry(0, $r1, $g1, $b1, $a1);
743
 
744
		if($gradient instanceof awBilinearGradient) {
745
 
746
			$flashGradient->addEntry($gradient->center, $r2, $g2, $b2, $a2);
747
			$flashGradient->addEntry(1, $r1, $g1, $b1, $a1);
748
 
749
			return array($flashGradient, SWFFILL_LINEAR_GRADIENT);
750
		} else {
751
 
752
			$flashGradient->addEntry(1, $r2, $g2, $b2, $a2);
753
 
754
			if($gradient instanceof awLinearGradient) {
755
				return array($flashGradient, SWFFILL_LINEAR_GRADIENT);
756
			} else {
757
				return array($flashGradient, SWFFILL_RADIAL_GRADIENT);
758
			}
759
		}
760
	}
761
//	abstract private function getPolygonPoints(awPolygon $polygon);
762
 
763
}
764
 
765
registerClass('MingDriver');
766
 
767
/*
768
 * Check for ming presence
769
 */
770
if(function_exists('ming_useswfversion') === FALSE) {
771
	awImage::drawErrorFile('missing-ming');
772
}
773
 
774
?>