| 1 | /* cairo - a vector graphics library with display and print output |
|---|
| 2 | * |
|---|
| 3 | * Copyright © 2006 Keith Packard |
|---|
| 4 | * Copyright © 2006 Red Hat, Inc |
|---|
| 5 | * |
|---|
| 6 | * This library is free software; you can redistribute it and/or |
|---|
| 7 | * modify it either under the terms of the GNU Lesser General Public |
|---|
| 8 | * License version 2.1 as published by the Free Software Foundation |
|---|
| 9 | * (the "LGPL") or, at your option, under the terms of the Mozilla |
|---|
| 10 | * Public License Version 1.1 (the "MPL"). If you do not alter this |
|---|
| 11 | * notice, a recipient may use your version of this file under either |
|---|
| 12 | * the MPL or the LGPL. |
|---|
| 13 | * |
|---|
| 14 | * You should have received a copy of the LGPL along with this library |
|---|
| 15 | * in the file COPYING-LGPL-2.1; if not, write to the Free Software |
|---|
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 17 | * You should have received a copy of the MPL along with this library |
|---|
| 18 | * in the file COPYING-MPL-1.1 |
|---|
| 19 | * |
|---|
| 20 | * The contents of this file are subject to the Mozilla Public License |
|---|
| 21 | * Version 1.1 (the "License"); you may not use this file except in |
|---|
| 22 | * compliance with the License. You may obtain a copy of the License at |
|---|
| 23 | * http://www.mozilla.org/MPL/ |
|---|
| 24 | * |
|---|
| 25 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY |
|---|
| 26 | * OF ANY KIND, either express or implied. See the LGPL or the MPL for |
|---|
| 27 | * the specific language governing rights and limitations. |
|---|
| 28 | * |
|---|
| 29 | * The Original Code is the cairo graphics library. |
|---|
| 30 | * |
|---|
| 31 | * The Initial Developer of the Original Code is University of Southern |
|---|
| 32 | * California. |
|---|
| 33 | * |
|---|
| 34 | * Contributor(s): |
|---|
| 35 | * Carl D. Worth <cworth@cworth.org> |
|---|
| 36 | * Keith Packard <keithp@keithp.com> |
|---|
| 37 | */ |
|---|
| 38 | |
|---|
| 39 | #include "cairoint.h" |
|---|
| 40 | |
|---|
| 41 | /* The analysis here assumes destination alpha semantics (that is |
|---|
| 42 | * CAIRO_CONTENT_COLOR_ALPHA). More things can be considered opaque |
|---|
| 43 | * otherwise (CAIRO_CONTENT_COLOR) so we'll probably want to add a |
|---|
| 44 | * cairo_content_t parameter to this function |
|---|
| 45 | * |
|---|
| 46 | * We also need a definition of what "opaque" means. Is it, "does not |
|---|
| 47 | * requiring 'knowing' the original contents of destination, nor does |
|---|
| 48 | * it set the destination alpha to anything but 1.0" ? |
|---|
| 49 | */ |
|---|
| 50 | cairo_bool_t |
|---|
| 51 | _cairo_operator_always_opaque (cairo_operator_t op) |
|---|
| 52 | { |
|---|
| 53 | switch (op) { |
|---|
| 54 | case CAIRO_OPERATOR_CLEAR: |
|---|
| 55 | return FALSE; |
|---|
| 56 | |
|---|
| 57 | case CAIRO_OPERATOR_SOURCE: |
|---|
| 58 | return FALSE; |
|---|
| 59 | |
|---|
| 60 | case CAIRO_OPERATOR_OVER: |
|---|
| 61 | case CAIRO_OPERATOR_IN: |
|---|
| 62 | case CAIRO_OPERATOR_OUT: |
|---|
| 63 | case CAIRO_OPERATOR_ATOP: |
|---|
| 64 | return FALSE; |
|---|
| 65 | |
|---|
| 66 | case CAIRO_OPERATOR_DEST: |
|---|
| 67 | return TRUE; |
|---|
| 68 | |
|---|
| 69 | case CAIRO_OPERATOR_DEST_OVER: |
|---|
| 70 | case CAIRO_OPERATOR_DEST_IN: |
|---|
| 71 | case CAIRO_OPERATOR_DEST_OUT: |
|---|
| 72 | case CAIRO_OPERATOR_DEST_ATOP: |
|---|
| 73 | return FALSE; |
|---|
| 74 | |
|---|
| 75 | case CAIRO_OPERATOR_XOR: |
|---|
| 76 | case CAIRO_OPERATOR_ADD: |
|---|
| 77 | case CAIRO_OPERATOR_SATURATE: |
|---|
| 78 | return FALSE; |
|---|
| 79 | } |
|---|
| 80 | return FALSE; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | /* As above, we'll probably want to add a cairo_content_t parameter to |
|---|
| 84 | * this function |
|---|
| 85 | * |
|---|
| 86 | * We also need a definition of what "translucent" means. |
|---|
| 87 | */ |
|---|
| 88 | cairo_bool_t |
|---|
| 89 | _cairo_operator_always_translucent (cairo_operator_t op) |
|---|
| 90 | { |
|---|
| 91 | switch (op) { |
|---|
| 92 | case CAIRO_OPERATOR_CLEAR: |
|---|
| 93 | return TRUE; |
|---|
| 94 | |
|---|
| 95 | case CAIRO_OPERATOR_SOURCE: |
|---|
| 96 | return FALSE; |
|---|
| 97 | |
|---|
| 98 | case CAIRO_OPERATOR_OVER: |
|---|
| 99 | case CAIRO_OPERATOR_IN: |
|---|
| 100 | case CAIRO_OPERATOR_OUT: |
|---|
| 101 | case CAIRO_OPERATOR_ATOP: |
|---|
| 102 | return FALSE; |
|---|
| 103 | |
|---|
| 104 | case CAIRO_OPERATOR_DEST: |
|---|
| 105 | return FALSE; |
|---|
| 106 | |
|---|
| 107 | case CAIRO_OPERATOR_DEST_OVER: |
|---|
| 108 | case CAIRO_OPERATOR_DEST_IN: |
|---|
| 109 | case CAIRO_OPERATOR_DEST_OUT: |
|---|
| 110 | case CAIRO_OPERATOR_DEST_ATOP: |
|---|
| 111 | return FALSE; |
|---|
| 112 | |
|---|
| 113 | case CAIRO_OPERATOR_XOR: |
|---|
| 114 | case CAIRO_OPERATOR_ADD: |
|---|
| 115 | case CAIRO_OPERATOR_SATURATE: |
|---|
| 116 | return TRUE; |
|---|
| 117 | } |
|---|
| 118 | return TRUE; |
|---|
| 119 | } |
|---|