… | |
… | |
1620 | it. You are not necessarily meant to do it this way, this example just |
1620 | it. You are not necessarily meant to do it this way, this example just |
1621 | shows you the accessors to use :) |
1621 | shows you the accessors to use :) |
1622 | |
1622 | |
1623 | my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE); |
1623 | my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE); |
1624 | |
1624 | |
1625 | $mapped->set ($_ * $mapped->row_pitch, pack "C", 5) |
1625 | $mapped->write ($_ * $mapped->row_pitch, pack "C", 5) |
1626 | for 0..$image->height; |
1626 | for 0 .. $mapped->height - 1; |
1627 | |
1627 | |
1628 | $mapped->unmap;. |
1628 | $mapped->unmap;. |
1629 | $mapped->wait; # only needed for out of order queues normally |
1629 | $mapped->wait; # only needed for out of order queues normally |
1630 | |
1630 | |
1631 | =item $ev = $queue->unmap ($mapped, $wait_events...) |
1631 | =item $ev = $queue->unmap ($mapped, $wait_events...) |
… | |
… | |
2343 | |
2343 | |
2344 | This is a subclass of OpenCL::Mapped, representing mapped images. |
2344 | This is a subclass of OpenCL::Mapped, representing mapped images. |
2345 | |
2345 | |
2346 | =over 4 |
2346 | =over 4 |
2347 | |
2347 | |
|
|
2348 | =item $pixels = $mapped->width |
|
|
2349 | |
|
|
2350 | =item $pixels = $mapped->height |
|
|
2351 | |
|
|
2352 | =item $pixels = $mapped->depth |
|
|
2353 | |
|
|
2354 | Return the width/height/depth of the mapped image region, in pixels. |
|
|
2355 | |
2348 | =item $bytes = $mapped->row_pitch |
2356 | =item $bytes = $mapped->row_pitch |
2349 | |
2357 | |
2350 | =item $bytes = $mapped->slice_pitch |
2358 | =item $bytes = $mapped->slice_pitch |
2351 | |
2359 | |
2352 | Return the row or slice pitch of the image that has been mapped. |
2360 | Return the row or slice pitch of the image that has been mapped. |
2353 | |
2361 | |
|
|
2362 | =item $bytes = $mapped->element_size |
|
|
2363 | |
|
|
2364 | Return the size of a single pixel. |
|
|
2365 | |
|
|
2366 | =item $data = $mapped->get_row ($count, $x=0, $y=0, $z=0) |
|
|
2367 | |
|
|
2368 | Return C<$count> pixels from the given coordinates. The pixel data must |
|
|
2369 | be completely contained within a single row. |
|
|
2370 | |
|
|
2371 | If C<$count> is C<undef>, then all the remaining pixels in that row are |
|
|
2372 | returned. |
|
|
2373 | |
|
|
2374 | =item $mapped->set_row ($data, $x=0, $y=0, $z=0) |
|
|
2375 | |
|
|
2376 | Write the given pixel data at the given coordinate. The pixel data must |
|
|
2377 | be completely contained within a single row. |
|
|
2378 | |
2354 | =back |
2379 | =back |
2355 | |
|
|
2356 | |
2380 | |
2357 | =cut |
2381 | =cut |
2358 | |
2382 | |
2359 | 1; |
2383 | 1; |
2360 | |
2384 | |