importing bitmaps as patterns

I got an idea today which I went on to quickly implement, so you can test it in CVS already.
Now when you import a bitmap into your drawing, it appears not as an <image> element but as a <rect> with pattern fill, the pattern being the image you imported. It looks the same, but the important difference is that you can easily "mask" the image by changing the shape of the rect (round corners, or convert to path and node-edit, or apply some booleans etc. just as you would with any rectangle). I think this makes it a lot more useful and I would even suggest making this a default (as it is now in CVS), although an option to create <image> as before still remains.
There are a bunch of bugs related to pattern fills currently, but I hope to clear them sooner or later. For now, set Transforms to Preserve in the preferences so that rects behave as expected when transformed.
I'd like to hear opinions on the usefulness and possible default-ness of this trick. It does not remove the necessity to have a pattern fill tool or dialog, but I think it lets you do without in the majority of situations. You can even apply the same pattern fill to other shapes by doing Copy/Paste Style (the imported rect ends up grouped as of now, so ungroup it first).
_________________________________________________________________ MSN Premium helps eliminate e-mail viruses. Get 2 months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI...

On Wed, 26 May 2004, bulia byak wrote:
I got an idea today which I went on to quickly implement, so you can test it in CVS already.
Now when you import a bitmap into your drawing, it appears not as an <image> element but as a <rect> with pattern fill, the pattern being the image you imported. It looks the same, but the important difference is that you can easily "mask" the image by changing the shape of the rect (round corners, or convert to path and node-edit, or apply some booleans etc. just as you would with any rectangle). I think this makes it a lot more useful and I would even suggest making this a default (as it is now in CVS), although an option to create <image> as before still remains.
There are a bunch of bugs related to pattern fills currently, but I hope to clear them sooner or later. For now, set Transforms to Preserve in the preferences so that rects behave as expected when transformed.
I'd like to hear opinions on the usefulness and possible default-ness of this trick. It does not remove the necessity to have a pattern fill tool or dialog, but I think it lets you do without in the majority of situations. You can even apply the same pattern fill to other shapes by doing Copy/Paste Style (the imported rect ends up grouped as of now, so ungroup it first).
Definitely sounds like an improvement. The existing functionality for images has been pretty anemic. I don't import images myself, but did do it for a demo for an artist, and it was pretty quickly obvious that it would be *very* nice to be able to do everything with an image that can be done with a rect. So even if there's still a lot of quirks introduced, it's probably well worth doing.
Bryce

Yeah, seems good. But, I guess people will have to live with scaling the pattern in XML editor for now, until image is properly implemented.
I like this...now we have automatic masking!!! Awesome! Now, just need UI around...bulia...you rock!
Jon
On Tue, 2004-05-25 at 23:33, Bryce Harrington wrote:
On Wed, 26 May 2004, bulia byak wrote:
I got an idea today which I went on to quickly implement, so you can test it in CVS already.
Now when you import a bitmap into your drawing, it appears not as an <image> element but as a <rect> with pattern fill, the pattern being the image you imported. It looks the same, but the important difference is that you can easily "mask" the image by changing the shape of the rect (round corners, or convert to path and node-edit, or apply some booleans etc. just as you would with any rectangle). I think this makes it a lot more useful and I would even suggest making this a default (as it is now in CVS), although an option to create <image> as before still remains.
There are a bunch of bugs related to pattern fills currently, but I hope to clear them sooner or later. For now, set Transforms to Preserve in the preferences so that rects behave as expected when transformed.
I'd like to hear opinions on the usefulness and possible default-ness of this trick. It does not remove the necessity to have a pattern fill tool or dialog, but I think it lets you do without in the majority of situations. You can even apply the same pattern fill to other shapes by doing Copy/Paste Style (the imported rect ends up grouped as of now, so ungroup it first).
Definitely sounds like an improvement. The existing functionality for images has been pretty anemic. I don't import images myself, but did do it for a demo for an artist, and it was pretty quickly obvious that it would be *very* nice to be able to do everything with an image that can be done with a rect. So even if there's still a lot of quirks introduced, it's probably well worth doing.
Bryce
This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel

Hi Bulia and everyone else
Sounds good, though later on, it shouldn't be a fill, but actually a mask. I admit not to have tried the cvs, but I wonder how scaling of the image would work... if I just change the shape, I'll crop it. Is there a easy way to scale the pattern with the object? In InDesign (well, that is masks, but anyway) wou press ctrl, so scale frame and content. Is there a keybinding alike for that? Cause frankly, scaling of images is IMHO even more important than clipping.
Anyway, keep up the great work on Inkscape! Having been annoyed at some point due to the heavy advertisement of inkscape on the sodipodi-list, I now am, as you guys know, a total inkscaper and love it!
Take care
David

bulia byak wrote:
I got an idea today which I went on to quickly implement, so you can test it in CVS already.
Now when you import a bitmap into your drawing, it appears not as an <image> element but as a <rect> with pattern fill, the pattern being the image you imported. It looks the same, but the important difference is that you can easily "mask" the image by changing the shape of the rect (round corners, or convert to path and node-edit, or apply some booleans etc. just as you would with any rectangle). I think this makes it a lot more useful and I would even suggest making this a default (as it is now in CVS), although an option to create <image> as before still remains.
There are a bunch of bugs related to pattern fills currently, but I hope to clear them sooner or later. For now, set Transforms to Preserve in the preferences so that rects behave as expected when transformed.
I'd like to hear opinions on the usefulness and possible default-ness of this trick. It does not remove the necessity to have a pattern fill tool or dialog, but I think it lets you do without in the majority of situations. You can even apply the same pattern fill to other shapes by doing Copy/Paste Style (the imported rect ends up grouped as of now, so ungroup it first).
This currently makes image imports useless to me. There are several problems that I see....
1) The image's top-left is not aligned with the rect's top-left. Currently the image's top-left is (usually) in the center of the rect.
2) When the rect is grown, the image is tiled to fit the rect. It should cover the rect exactly and completely -once-.
2) Image transparency is broken. The background of the rect is copied onto whatever is behind it. I do not know how to fix this. If the image it placed upon an invisible rect, isn't the entire image invisible also? The rect would have to be 0% opaque on the transparent parts, and whatever the user wants on the rest (default 100%). It would basically need to be a matte fill, or the alpha-blend algorithm.
This is a great idea, but I can't use it right now. I'd like to keep using the current CVS, but is there a way I can back this change out just for myself?
Bob

Bob Jamison wrote:
This is a great idea, but I can't use it right now. I'd like to keep using the current CVS, but is there a way I can back this change out just for myself?
Never mind!
I found your new option in preferences.xml : <group id="importbitmapsasimages" value="1" />
So things are working like before.
But since I am doing a lot of image importing , maybe I can help with the new code in gdk-pixbuf.cpp to fix these little problems. I am at work, and for some reason cannot reach a Jabber server from here, but I can get onto Freenode/#inkscape just fine.
Bob

bulia byak wrote:
I got an idea today which I went on to quickly implement, so you can test it in CVS already.
Now when you import a bitmap into your drawing, it appears not as an <image> element but as a <rect> with pattern fill, the pattern being the image you imported. It looks the same, but the important difference is that you can easily "mask" the image by changing the shape of the rect (round corners, or convert to path and node-edit, or apply some booleans etc. just as you would with any rectangle). I think this makes it a lot more useful and I would even suggest making this a default (as it is now in CVS), although an option to create <image> as before still remains.
Personally, I don't think that it is a good idea for this to be the default. My understanding was that inkscape is to be an SVG editor rather than just another vector drawing app which happens to use the SVG namespace as part of its XML file format. That is certainly the reason that I have enthusiastically adopted it.
To me, using a pattern filled rectangle as the *default* way of placing a simple bitmap onto the image cannot be described as clean SVG (even though it is certainly legal). In fact, as far as I can see, the best way to model the use cases you've mentioned would be an <image> with a clip-path rather than a pattern-fill, though I can see that it cannot be implemented this way in inkscape until clipping is supported.
In all of my use of images, I have either wanted them rectangular or they have come with a suitable alpha mask [0]. I can see the utility of more complex cropping I just wanted to point out that it isn't universal. As I frequently take inkscape SVG output, as input to further processing I'm quite keen for it to be easy to use inkscape to produce and edit clean SVG.
That isn't to say that the new functionality isn't good - implementing any new svg feature is a good thing. Just that doing simple things should produce clean and simple SVG. I think an option on the import selector (with its default globally configurable) would be the best way to expose this feature.
Thanks for listening,
John (a very happy inkscape user)
[0] As an aside: has any thought been given to supporting JNG? It is a variant of PNG supporting jpeg compressed image data with a PNG alpha channel, and is specified as part of MNG: http://www.libmng.com/pub/mng/
participants (6)
-
Bob Jamison
-
Bryce Harrington
-
bulia byak
-
David Christian Berg
-
John Pybus
-
Jon Phillips