|
106 | 106 | renderer.color_rgba8( white ) |
107 | 107 | agg.render_scanlines_rgba(rasterizer, scanline, renderer); |
108 | 108 |
|
109 | | -## Copy a rectangle from the buffer the rectangle defined by |
110 | | -## x0,y0->x1,y1 and paste it at xdest, ydest |
111 | | -x0, y0 = 10, 50 |
112 | | -x1, y1 = 110, 190 |
113 | | -xdest, ydest = 350, 200 |
114 | | - |
115 | | - |
116 | | -widthr, heightr = x1-x0, y1-y0 |
117 | | -strider = widthr*4 |
118 | | -copybuffer = agg.buffer(widthr, heightr, strider) |
119 | | - |
120 | | -rbufcopy = agg.rendering_buffer() |
121 | | -rbufcopy.attachb(copybuffer) |
122 | | -pfcopy = agg.pixel_format_rgba(rbufcopy) |
123 | | -rbasecopy = agg.renderer_base_rgba(pfcopy) |
124 | | - |
125 | | -rect = agg.rect(x0, y0, x1, y1) |
126 | | -print rect.is_valid() |
127 | | -rectp = agg.rectPtr(rect) |
128 | | -#print dir(rbasecopy) |
129 | | - |
130 | | -# agg is funny about the arguments to copy from; the last 2 args are |
131 | | -# dx, dy. If the src and dest buffers are the same size and you omit |
132 | | -# the dx and dy args, the position of the copy in the dest buffer is |
133 | | -# the same as in the src. Since our dest buffer is smaller than our |
134 | | -# src buffer, we have to offset the location by -x0, -y0 |
135 | | -rbasecopy.copy_from(rbuf, rect, -x0, -y0); |
136 | | - |
137 | | -# paste the rectangle at a new location xdest, ydest |
138 | | -rbase.copy_from(rbufcopy, None, xdest, ydest); |
| 109 | +if 0: |
| 110 | + ## Copy a rectangle from the buffer the rectangle defined by |
| 111 | + ## x0,y0->x1,y1 and paste it at xdest, ydest |
| 112 | + x0, y0 = 10, 50 |
| 113 | + x1, y1 = 110, 190 |
| 114 | + xdest, ydest = 350, 200 |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + widthr, heightr = x1-x0, y1-y0 |
| 119 | + strider = widthr*4 |
| 120 | + copybuffer = agg.buffer(widthr, heightr, strider) |
| 121 | + |
| 122 | + |
| 123 | + rbufcopy = agg.rendering_buffer() |
| 124 | + rbufcopy.attachb(copybuffer) |
| 125 | + pfcopy = agg.pixel_format_rgba(rbufcopy) |
| 126 | + rbasecopy = agg.renderer_base_rgba(pfcopy) |
| 127 | + |
| 128 | + rect = agg.rect(x0, y0, x1, y1) |
| 129 | + print rect.is_valid() |
| 130 | + rectp = agg.rectPtr(rect) |
| 131 | + #print dir(rbasecopy) |
| 132 | + |
| 133 | + # agg is funny about the arguments to copy from; the last 2 args are |
| 134 | + # dx, dy. If the src and dest buffers are the same size and you omit |
| 135 | + # the dx and dy args, the position of the copy in the dest buffer is |
| 136 | + # the same as in the src. Since our dest buffer is smaller than our |
| 137 | + # src buffer, we have to offset the location by -x0, -y0 |
| 138 | + rbasecopy.copy_from(rbuf, rect, -x0, -y0); |
| 139 | + |
| 140 | + # paste the rectangle at a new location xdest, ydest |
| 141 | + rbase.copy_from(rbufcopy, None, xdest, ydest); |
139 | 142 |
|
140 | 143 |
|
141 | 144 |
|
|
0 commit comments