1 /*------------------------------------------------------------------------
3 * Derivative of the OpenVG 1.0.1 Reference Implementation
4 * -------------------------------------
6 * Copyright (c) 2007 The Khronos Group Inc.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and /or associated documentation files
10 * (the "Materials "), to deal in the Materials without restriction,
11 * including without limitation the rights to use, copy, modify, merge,
12 * publish, distribute, sublicense, and/or sell copies of the Materials,
13 * and to permit persons to whom the Materials are furnished to do so,
14 * subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Materials.
19 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
23 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
25 * THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 *-------------------------------------------------------------------*/
28 #import <Onyx2D/O2Paint_pattern.h>
29 #import <Onyx2D/O2Surface.h>
31 @implementation O2Paint_pattern
33 ONYX2D_STATIC int o2pattern_largb8u_PRE(O2Paint *selfX,int x,int y,O2argb8u *span,int length){
34 O2Paint_pattern *self=(O2Paint_pattern *)selfX;
35 O2Image *image=self->_image;
37 O2ImageReadPatternSpan_largb8u_PRE(image,x,y,span,length,self->m_surfaceToPaintMatrix,kO2PatternTilingNoDistortion);
42 ONYX2D_STATIC int o2pattern_largb32f_PRE(O2Paint *selfX,int x,int y,O2argb32f *span,int length){
43 O2Paint_pattern *self=(O2Paint_pattern *)selfX;
47 span[i]=O2argb32fInit(1,0,0,1);
53 static int O2PaintReadPremultipliedPatternSpan(O2Paint *selfX,int x,int y,O2argb32f *span,int length){
54 O2Paint_pattern *self=(O2Paint_pattern *)selfX;
56 O2ImageReadPatternSpan_largb32f_PRE(self->_image,x, y,span,length, self->m_surfaceToPaintMatrix, kO2PatternTilingConstantSpacing);
61 -initWithImage:(O2Image *)image surfaceToPaintTransform:(O2AffineTransform)xform phase:(O2Size)phase {
62 // O2PaintInitWithTransform(self,O2AffineTransformMakeTranslation(phase.width,phase.height));
63 O2PaintInitWithTransform(self,O2AffineTransformIdentity);
64 _paint_largb8u_PRE=o2pattern_largb8u_PRE;
65 _paint_largb32f_PRE=o2pattern_largb32f_PRE;
66 _image=[image retain];