开发者

raphael.js crop image

开发者 https://www.devze.com 2023-02-24 04:53 出处:网络
I am newbie to raphael.js and svg. I have a开发者_高级运维n image element, i can select rectangles on it using drag and drop in any area. The problem is that image must be transparent, but selected re

I am newbie to raphael.js and svg. I have a开发者_高级运维n image element, i can select rectangles on it using drag and drop in any area. The problem is that image must be transparent, but selected rectangles not.

If i used css i would set background-image for rectangles and background position, but i have not found such possibility for svg (and probably vml for ie).

How can i crop the image and put it over transparent image or set background position to rectangle?

UPD: Actually i found the solution: for each newly created rectangle I can copy image and use clip-rect attribute. But this solution does not match my needs. I can not rotate clip-rect area, image only.


The rectangular clip-rect that raphaël provides is a subset of what you can do in svg.

Here's an example of rotated clipping: masking-path-02-b

Here's something a bit more advanced: masking-path-07-b

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号