Add support for BGRA and BGRx formats.
[profile/ivi/pixman.git] / pixman / pixman-image.c
1 /*
2  * Copyright © 2000 SuSE, Inc.
3  * Copyright © 2007 Red Hat, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and its
6  * documentation for any purpose is hereby granted without fee, provided that
7  * the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of SuSE not be used in advertising or
10  * publicity pertaining to distribution of the software without specific,
11  * written prior permission.  SuSE makes no representations about the
12  * suitability of this software for any purpose.  It is provided "as is"
13  * without express or implied warranty.
14  *
15  * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
17  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30
31 #include "pixman-private.h"
32
33 #define Alpha(x) ((x) >> 24)
34
35 static void
36 init_source_image (source_image_t *image)
37 {
38     image->class = SOURCE_IMAGE_CLASS_UNKNOWN;
39 }
40
41 static pixman_bool_t
42 init_gradient (gradient_t     *gradient,
43                const pixman_gradient_stop_t *stops,
44                int             n_stops)
45 {
46     return_val_if_fail (n_stops > 0, FALSE);
47
48     init_source_image (&gradient->common);
49
50     gradient->stops = pixman_malloc_ab (n_stops, sizeof (pixman_gradient_stop_t));
51     if (!gradient->stops)
52         return FALSE;
53
54     memcpy (gradient->stops, stops, n_stops * sizeof (pixman_gradient_stop_t));
55
56     gradient->n_stops = n_stops;
57
58     gradient->stop_range = 0xffff;
59     gradient->color_table = NULL;
60     gradient->color_table_size = 0;
61
62     return TRUE;
63 }
64
65 static uint32_t
66 color_to_uint32 (const pixman_color_t *color)
67 {
68     return
69         (color->alpha >> 8 << 24) |
70         (color->red >> 8 << 16) |
71         (color->green & 0xff00) |
72         (color->blue >> 8);
73 }
74
75 static pixman_image_t *
76 allocate_image (void)
77 {
78     pixman_image_t *image = malloc (sizeof (pixman_image_t));
79
80     if (image)
81     {
82         image_common_t *common = &image->common;
83
84         pixman_region32_init (&common->full_region);
85         pixman_region32_init (&common->clip_region);
86         common->src_clip = &common->full_region;
87         common->has_client_clip = FALSE;
88         common->transform = NULL;
89         common->repeat = PIXMAN_REPEAT_NONE;
90         common->filter = PIXMAN_FILTER_NEAREST;
91         common->filter_params = NULL;
92         common->n_filter_params = 0;
93         common->alpha_map = NULL;
94         common->component_alpha = FALSE;
95         common->ref_count = 1;
96         common->read_func = NULL;
97         common->write_func = NULL;
98     }
99
100     return image;
101 }
102
103 /* Ref Counting */
104 PIXMAN_EXPORT pixman_image_t *
105 pixman_image_ref (pixman_image_t *image)
106 {
107     image->common.ref_count++;
108
109     return image;
110 }
111
112 /* returns TRUE when the image is freed */
113 PIXMAN_EXPORT pixman_bool_t
114 pixman_image_unref (pixman_image_t *image)
115 {
116     image_common_t *common = (image_common_t *)image;
117
118     common->ref_count--;
119
120     if (common->ref_count == 0)
121     {
122         pixman_region32_fini (&common->clip_region);
123         pixman_region32_fini (&common->full_region);
124
125         if (common->transform)
126             free (common->transform);
127
128         if (common->filter_params)
129             free (common->filter_params);
130
131         if (common->alpha_map)
132             pixman_image_unref ((pixman_image_t *)common->alpha_map);
133
134 #if 0
135         if (image->type == BITS && image->bits.indexed)
136             free (image->bits.indexed);
137 #endif
138
139 #if 0
140         memset (image, 0xaa, sizeof (pixman_image_t));
141 #endif
142         if (image->type == LINEAR || image->type == RADIAL || image->type == CONICAL)
143         {
144             if (image->gradient.stops)
145                 free (image->gradient.stops);
146         }
147
148
149         if (image->type == BITS && image->bits.free_me)
150             free (image->bits.free_me);
151
152         free (image);
153
154         return TRUE;
155     }
156
157     return FALSE;
158 }
159
160 /* Constructors */
161 PIXMAN_EXPORT pixman_image_t *
162 pixman_image_create_solid_fill (pixman_color_t *color)
163 {
164     pixman_image_t *img = allocate_image();
165     if (!img)
166         return NULL;
167
168     init_source_image (&img->solid.common);
169
170     img->type = SOLID;
171     img->solid.color = color_to_uint32 (color);
172
173     return img;
174 }
175
176 PIXMAN_EXPORT pixman_image_t *
177 pixman_image_create_linear_gradient (pixman_point_fixed_t         *p1,
178                                      pixman_point_fixed_t         *p2,
179                                      const pixman_gradient_stop_t *stops,
180                                      int                           n_stops)
181 {
182     pixman_image_t *image;
183     linear_gradient_t *linear;
184
185     return_val_if_fail (n_stops >= 2, NULL);
186
187     image = allocate_image();
188
189     if (!image)
190         return NULL;
191
192     linear = &image->linear;
193
194     if (!init_gradient (&linear->common, stops, n_stops))
195     {
196         free (image);
197         return NULL;
198     }
199
200     linear->p1 = *p1;
201     linear->p2 = *p2;
202
203     image->type = LINEAR;
204
205     return image;
206 }
207
208
209 PIXMAN_EXPORT pixman_image_t *
210 pixman_image_create_radial_gradient (pixman_point_fixed_t         *inner,
211                                      pixman_point_fixed_t         *outer,
212                                      pixman_fixed_t                inner_radius,
213                                      pixman_fixed_t                outer_radius,
214                                      const pixman_gradient_stop_t *stops,
215                                      int                           n_stops)
216 {
217     pixman_image_t *image;
218     radial_gradient_t *radial;
219
220     return_val_if_fail (n_stops >= 2, NULL);
221
222     image = allocate_image();
223
224     if (!image)
225         return NULL;
226
227     radial = &image->radial;
228
229     if (!init_gradient (&radial->common, stops, n_stops))
230     {
231         free (image);
232         return NULL;
233     }
234
235     image->type = RADIAL;
236
237     radial->c1.x = inner->x;
238     radial->c1.y = inner->y;
239     radial->c1.radius = inner_radius;
240     radial->c2.x = outer->x;
241     radial->c2.y = outer->y;
242     radial->c2.radius = outer_radius;
243     radial->cdx = pixman_fixed_to_double (radial->c2.x - radial->c1.x);
244     radial->cdy = pixman_fixed_to_double (radial->c2.y - radial->c1.y);
245     radial->dr = pixman_fixed_to_double (radial->c2.radius - radial->c1.radius);
246     radial->A = (radial->cdx * radial->cdx
247                  + radial->cdy * radial->cdy
248                  - radial->dr  * radial->dr);
249
250     return image;
251 }
252
253 PIXMAN_EXPORT pixman_image_t *
254 pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
255                                       pixman_fixed_t angle,
256                                       const pixman_gradient_stop_t *stops,
257                                       int n_stops)
258 {
259     pixman_image_t *image = allocate_image();
260     conical_gradient_t *conical;
261
262     if (!image)
263         return NULL;
264
265     conical = &image->conical;
266
267     if (!init_gradient (&conical->common, stops, n_stops))
268     {
269         free (image);
270         return NULL;
271     }
272
273     image->type = CONICAL;
274     conical->center = *center;
275     conical->angle = angle;
276
277     return image;
278 }
279
280 static uint32_t *
281 create_bits (pixman_format_code_t format,
282              int                  width,
283              int                  height,
284              int                 *rowstride_bytes)
285 {
286     int stride;
287     int buf_size;
288     int bpp;
289
290     /* what follows is a long-winded way, avoiding any possibility of integer
291      * overflows, of saying:
292      * stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t);
293      */
294
295     bpp = PIXMAN_FORMAT_BPP (format);
296     if (pixman_multiply_overflows_int (width, bpp))
297         return NULL;
298
299     stride = width * bpp;
300     if (pixman_addition_overflows_int (stride, FB_MASK))
301         return NULL;
302
303     stride += FB_MASK;
304     stride >>= FB_SHIFT;
305
306 #if FB_SHIFT < 2
307     if (pixman_multiply_overflows_int (stride, sizeof (uint32_t)))
308         return NULL;
309 #endif
310     stride *= sizeof (uint32_t);
311
312     if (pixman_multiply_overflows_int (height, stride))
313         return NULL;
314
315     buf_size = height * stride;
316
317     if (rowstride_bytes)
318         *rowstride_bytes = stride;
319
320     return calloc (buf_size, 1);
321 }
322
323 static void
324 reset_clip_region (pixman_image_t *image)
325 {
326     pixman_region32_fini (&image->common.clip_region);
327
328     if (image->type == BITS)
329     {
330         pixman_region32_init_rect (&image->common.clip_region, 0, 0,
331                                    image->bits.width, image->bits.height);
332     }
333     else
334     {
335         pixman_region32_init (&image->common.clip_region);
336     }
337 }
338
339 PIXMAN_EXPORT pixman_image_t *
340 pixman_image_create_bits (pixman_format_code_t  format,
341                           int                   width,
342                           int                   height,
343                           uint32_t             *bits,
344                           int                   rowstride_bytes)
345 {
346     pixman_image_t *image;
347     uint32_t *free_me = NULL;
348
349     /* must be a whole number of uint32_t's
350      */
351     return_val_if_fail (bits == NULL ||
352                         (rowstride_bytes % sizeof (uint32_t)) == 0, NULL);
353
354     if (!bits && width && height)
355     {
356         free_me = bits = create_bits (format, width, height, &rowstride_bytes);
357         if (!bits)
358             return NULL;
359     }
360
361     image = allocate_image();
362
363     if (!image) {
364         if (free_me)
365             free (free_me);
366         return NULL;
367     }
368     
369     image->type = BITS;
370     image->bits.format = format;
371     image->bits.width = width;
372     image->bits.height = height;
373     image->bits.bits = bits;
374     image->bits.free_me = free_me;
375
376     image->bits.rowstride = rowstride_bytes / (int) sizeof (uint32_t); /* we store it in number
377                                                                   * of uint32_t's
378                                                                   */
379     image->bits.indexed = NULL;
380
381     pixman_region32_fini (&image->common.full_region);
382     pixman_region32_init_rect (&image->common.full_region, 0, 0,
383                                image->bits.width, image->bits.height);
384
385     reset_clip_region (image);
386     return image;
387 }
388
389 PIXMAN_EXPORT pixman_bool_t
390 pixman_image_set_clip_region32 (pixman_image_t *image,
391                                 pixman_region32_t *region)
392 {
393     image_common_t *common = (image_common_t *)image;
394
395     if (region)
396     {
397         return pixman_region32_copy (&common->clip_region, region);
398     }
399     else
400     {
401         reset_clip_region (image);
402
403         return TRUE;
404     }
405 }
406
407
408 PIXMAN_EXPORT pixman_bool_t
409 pixman_image_set_clip_region (pixman_image_t    *image,
410                               pixman_region16_t *region)
411 {
412     image_common_t *common = (image_common_t *)image;
413
414     if (region)
415     {
416         return pixman_region32_copy_from_region16 (&common->clip_region, region);
417     }
418     else
419     {
420         reset_clip_region (image);
421
422         return TRUE;
423     }
424 }
425
426 /* Sets whether the clip region includes a clip region set by the client
427  */
428 PIXMAN_EXPORT void
429 pixman_image_set_has_client_clip (pixman_image_t *image,
430                                   pixman_bool_t   client_clip)
431 {
432     image->common.has_client_clip = client_clip;
433 }
434
435 PIXMAN_EXPORT pixman_bool_t
436 pixman_image_set_transform (pixman_image_t           *image,
437                             const pixman_transform_t *transform)
438 {
439     static const pixman_transform_t id =
440     {
441         { { pixman_fixed_1, 0, 0 },
442           { 0, pixman_fixed_1, 0 },
443           { 0, 0, pixman_fixed_1 }
444         }
445     };
446
447     image_common_t *common = (image_common_t *)image;
448
449     if (common->transform == transform)
450         return TRUE;
451
452     if (memcmp (&id, transform, sizeof (pixman_transform_t)) == 0)
453     {
454         free(common->transform);
455         common->transform = NULL;
456         return TRUE;
457     }
458
459     if (common->transform == NULL)
460         common->transform = malloc (sizeof (pixman_transform_t));
461     if (common->transform == NULL)
462         return FALSE;
463
464     memcpy(common->transform, transform, sizeof(pixman_transform_t));
465
466     return TRUE;
467 }
468
469 PIXMAN_EXPORT void
470 pixman_image_set_repeat (pixman_image_t  *image,
471                          pixman_repeat_t  repeat)
472 {
473     image->common.repeat = repeat;
474 }
475
476 PIXMAN_EXPORT pixman_bool_t
477 pixman_image_set_filter (pixman_image_t       *image,
478                          pixman_filter_t       filter,
479                          const pixman_fixed_t *params,
480                          int                   n_params)
481 {
482     image_common_t *common = (image_common_t *)image;
483     pixman_fixed_t *new_params;
484
485     if (params == common->filter_params && filter == common->filter)
486         return TRUE;
487
488     new_params = NULL;
489     if (params)
490     {
491         new_params = pixman_malloc_ab (n_params, sizeof (pixman_fixed_t));
492         if (!new_params)
493             return FALSE;
494
495         memcpy (new_params,
496                 params, n_params * sizeof (pixman_fixed_t));
497     }
498
499     common->filter = filter;
500
501     if (common->filter_params)
502         free (common->filter_params);
503
504     common->filter_params = new_params;
505     common->n_filter_params = n_params;
506     return TRUE;
507 }
508
509 PIXMAN_EXPORT void
510 pixman_image_set_source_clipping (pixman_image_t  *image,
511                                   pixman_bool_t    source_clipping)
512 {
513     image_common_t *common = &image->common;
514
515     if (source_clipping)
516         common->src_clip = &common->clip_region;
517     else
518         common->src_clip = &common->full_region;
519 }
520
521 /* Unlike all the other property setters, this function does not
522  * copy the content of indexed. Doing this copying is simply
523  * way, way too expensive.
524  */
525 PIXMAN_EXPORT void
526 pixman_image_set_indexed (pixman_image_t         *image,
527                           const pixman_indexed_t *indexed)
528 {
529     bits_image_t *bits = (bits_image_t *)image;
530
531     bits->indexed = indexed;
532 }
533
534 PIXMAN_EXPORT void
535 pixman_image_set_alpha_map (pixman_image_t *image,
536                             pixman_image_t *alpha_map,
537                             int16_t         x,
538                             int16_t         y)
539 {
540     image_common_t *common = (image_common_t *)image;
541
542     return_if_fail (!alpha_map || alpha_map->type == BITS);
543
544     if (common->alpha_map != (bits_image_t *)alpha_map)
545     {
546         if (common->alpha_map)
547             pixman_image_unref ((pixman_image_t *)common->alpha_map);
548
549         if (alpha_map)
550             common->alpha_map = (bits_image_t *)pixman_image_ref (alpha_map);
551         else
552             common->alpha_map = NULL;
553     }
554
555     common->alpha_origin.x = x;
556     common->alpha_origin.y = y;
557 }
558
559 PIXMAN_EXPORT void
560 pixman_image_set_component_alpha   (pixman_image_t       *image,
561                                     pixman_bool_t         component_alpha)
562 {
563     image->common.component_alpha = component_alpha;
564 }
565
566
567 PIXMAN_EXPORT void
568 pixman_image_set_accessors (pixman_image_t             *image,
569                             pixman_read_memory_func_t   read_func,
570                             pixman_write_memory_func_t  write_func)
571 {
572     return_if_fail (image != NULL);
573
574     image->common.read_func = read_func;
575     image->common.write_func = write_func;
576 }
577
578 PIXMAN_EXPORT uint32_t *
579 pixman_image_get_data (pixman_image_t *image)
580 {
581     if (image->type == BITS)
582         return image->bits.bits;
583
584     return NULL;
585 }
586
587 PIXMAN_EXPORT int
588 pixman_image_get_width (pixman_image_t *image)
589 {
590     if (image->type == BITS)
591         return image->bits.width;
592
593     return 0;
594 }
595
596 PIXMAN_EXPORT int
597 pixman_image_get_height (pixman_image_t *image)
598 {
599     if (image->type == BITS)
600         return image->bits.height;
601
602     return 0;
603 }
604
605 PIXMAN_EXPORT int
606 pixman_image_get_stride (pixman_image_t *image)
607 {
608     if (image->type == BITS)
609         return image->bits.rowstride * (int) sizeof (uint32_t);
610
611     return 0;
612 }
613
614 PIXMAN_EXPORT int
615 pixman_image_get_depth (pixman_image_t *image)
616 {
617     if (image->type == BITS)
618         return PIXMAN_FORMAT_DEPTH (image->bits.format);
619
620     return 0;
621 }
622
623 static pixman_bool_t
624 color_to_pixel (pixman_color_t *color,
625                 uint32_t       *pixel,
626                 pixman_format_code_t format)
627 {
628     uint32_t c = color_to_uint32 (color);
629
630     if (!(format == PIXMAN_a8r8g8b8     ||
631           format == PIXMAN_x8r8g8b8     ||
632           format == PIXMAN_a8b8g8r8     ||
633           format == PIXMAN_x8b8g8r8     ||
634           format == PIXMAN_b8g8r8a8     ||
635           format == PIXMAN_b8g8r8x8     ||
636           format == PIXMAN_r5g6b5       ||
637           format == PIXMAN_b5g6r5       ||
638           format == PIXMAN_a8))
639     {
640         return FALSE;
641     }
642
643     if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
644     {
645         c = ((c & 0xff000000) >>  0) |
646             ((c & 0x00ff0000) >> 16) |
647             ((c & 0x0000ff00) >>  0) |
648             ((c & 0x000000ff) << 16);
649     }
650     if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_BGRA)
651     {
652         c = ((c & 0xff000000) >> 24) |
653             ((c & 0x00ff0000) >>  8) |
654             ((c & 0x0000ff00) <<  8) |
655             ((c & 0x000000ff) << 24);
656     }
657
658     if (format == PIXMAN_a8)
659         c = c >> 24;
660     else if (format == PIXMAN_r5g6b5 ||
661              format == PIXMAN_b5g6r5)
662         c = cvt8888to0565 (c);
663
664 #if 0
665     printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
666     printf ("pixel: %x\n", c);
667 #endif
668
669     *pixel = c;
670     return TRUE;
671 }
672
673 PIXMAN_EXPORT pixman_bool_t
674 pixman_image_fill_rectangles (pixman_op_t                   op,
675                               pixman_image_t               *dest,
676                               pixman_color_t               *color,
677                               int                           n_rects,
678                               const pixman_rectangle16_t   *rects)
679 {
680     pixman_image_t *solid;
681     pixman_color_t c;
682     int i;
683
684     if (color->alpha == 0xffff)
685     {
686         if (op == PIXMAN_OP_OVER)
687             op = PIXMAN_OP_SRC;
688     }
689
690     if (op == PIXMAN_OP_CLEAR)
691     {
692         c.red = 0;
693         c.green = 0;
694         c.blue = 0;
695         c.alpha = 0;
696
697         color = &c;
698
699         op = PIXMAN_OP_SRC;
700     }
701
702     if (op == PIXMAN_OP_SRC)
703     {
704         uint32_t pixel;
705
706         if (color_to_pixel (color, &pixel, dest->bits.format))
707         {
708             for (i = 0; i < n_rects; ++i)
709             {
710                 pixman_region32_t fill_region;
711                 int n_boxes, j;
712                 pixman_box32_t *boxes;
713
714                 pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
715                 if (!pixman_region32_intersect (&fill_region,
716                                                 &fill_region,
717                                                 &dest->common.clip_region))
718                     return FALSE;
719
720
721                 boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
722                 for (j = 0; j < n_boxes; ++j)
723                 {
724                     const pixman_box32_t *box = &(boxes[j]);
725                     pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
726                                  box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
727                                  pixel);
728                 }
729
730                 pixman_region32_fini (&fill_region);
731             }
732             return TRUE;
733         }
734     }
735
736     solid = pixman_image_create_solid_fill (color);
737     if (!solid)
738         return FALSE;
739
740     for (i = 0; i < n_rects; ++i)
741     {
742         const pixman_rectangle16_t *rect = &(rects[i]);
743
744         pixman_image_composite (op, solid, NULL, dest,
745                                 0, 0, 0, 0,
746                                 rect->x, rect->y,
747                                 rect->width, rect->height);
748     }
749
750     pixman_image_unref (solid);
751
752     return TRUE;
753 }
754
755 pixman_bool_t
756 pixman_image_can_get_solid (pixman_image_t *image)
757 {
758     if (image->type == SOLID)
759         return TRUE;
760
761     if (image->type != BITS     ||
762         image->bits.width != 1  ||
763         image->bits.height != 1)
764     {
765         return FALSE;
766     }
767
768     if (image->common.repeat != PIXMAN_REPEAT_NORMAL)
769         return FALSE;
770
771     switch (image->bits.format)
772     {
773     case PIXMAN_a8r8g8b8:
774     case PIXMAN_x8r8g8b8:
775     case PIXMAN_a8b8g8r8:
776     case PIXMAN_x8b8g8r8:
777     case PIXMAN_b8g8r8a8:
778     case PIXMAN_b8g8r8x8:
779     case PIXMAN_r8g8b8:
780     case PIXMAN_b8g8r8:
781     case PIXMAN_r5g6b5:
782     case PIXMAN_b5g6r5:
783         return TRUE;
784     default:
785         return FALSE;
786     }
787 }
788
789 pixman_bool_t
790 pixman_image_is_opaque(pixman_image_t *image)
791 {
792     int i = 0;
793     int gradientNumberOfColors = 0;
794
795     if(image->common.alpha_map)
796         return FALSE;
797
798     switch(image->type)
799     {
800     case BITS:
801         if(PIXMAN_FORMAT_A(image->bits.format))
802             return FALSE;
803         break;
804
805     case LINEAR:
806     case CONICAL:
807     case RADIAL:
808         gradientNumberOfColors = image->gradient.n_stops;
809         i=0;
810         while(i<gradientNumberOfColors)
811         {
812             if(image->gradient.stops[i].color.alpha != 0xffff)
813                 return FALSE;
814             i++;
815         }
816         break;
817
818     case SOLID:
819          if(Alpha(image->solid.color) != 0xff)
820             return FALSE;
821         break;
822     }
823
824     /* Convolution filters can introduce translucency if the sum of the weights
825        is lower than 1. */
826     if (image->common.filter == PIXMAN_FILTER_CONVOLUTION)
827          return FALSE;
828
829     if (image->common.repeat == PIXMAN_REPEAT_NONE)
830     {
831         if (image->common.filter != PIXMAN_FILTER_NEAREST)
832             return FALSE;
833
834         if (image->common.transform)
835             return FALSE;
836
837         /* Gradients do not necessarily cover the entire compositing area */
838         if (image->type == LINEAR || image->type == CONICAL || image->type == RADIAL)
839             return FALSE;
840     }
841
842      return TRUE;
843 }