SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Jared W. <wah...@um...> - 2004年06月08日 20:52:01
Hello, I put a patch in the tracker that implements groups in the SVG
backend. Is that the preferred way to submit patches, or should I just
mail them?
I've also been working on images. SVG has an image tag where you can
include a external .png file. I used some code from the GTK backend to
save an image as a png, then included, as shown below.
def draw_image(self, x, y, im):
 """
 Draw the Image instance into the current axes; x, y is the
 upper left hand corner of the image
 """
 rows, cols, s = im.as_str()
 X = fromstring(s, UInt8)
 X.shape = rows, cols, 4
 pb=gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
 has_alpha=1, bits_per_sample=8,
 width=cols, height=rows)
 try: pa = pb.get_pixels_array()
 except AttributeError: pa = pb.pixel_array
 pa[:,:,:] = X
 gc = self.new_gc()
 pb.save('test.png','png')
 self._draw_rawsvg('<image x=\"%f\" y=\"%f\" width=\"%f\"
height=\"%f\" xlink:href=\"test.png\"></image>' % (x, self.height-y,
cols, rows))
The above works for 'image_demo2.py' in the examples. The downside of
this approach is that it would make the SVG backend dependent on GTK.
Can anyone think of a better way?
I was thinking of naming the png files 'filename_1.png',
'filename_2.png', etc. for each image in the figure, where
'filename.svg' is the name of the main file. What do you think?
jared
From: John H. <jdh...@ac...> - 2004年06月08日 21:12:09
>>>>> "Jared" == Jared Wahlstrand <wah...@um...> writes:
 Jared> Hello, I put a patch in the tracker that implements groups
 Jared> in the SVG backend. Is that the preferred way to submit
 Jared> patches, or should I just mail them?
Since we're just talking about a single file, I think mailing them
directly to me is the easiest way for now. BTW, the attachment didn't
go through on the Tracker.
 Jared> I've also been working on images. SVG has an image tag
 Jared> where you can include a external .png file. I used some
 Jared> code from the GTK backend to save an image as a png, then
 Jared> included, as shown below.
I think you'll be better off following the lead of how backend PS
handles image drawing, which has no GTK dependence. I don't think you
need to use GTK or PNG as an intermediary. You may want to get a
fresh CVS checkout because there was a screwup in the width/height
dimensions in earlier versions that has been fixed.
Glad to see you're making progress! 
JDH
From: Jared W. <wah...@um...> - 2004年06月08日 21:49:17
Attachments: groups.diff
On Tue, 2004年06月08日 at 16:47, John Hunter wrote:
> >>>>> "Jared" == Jared Wahlstrand <wah...@um...> writes:
> 
> Jared> Hello, I put a patch in the tracker that implements groups
> Jared> in the SVG backend. Is that the preferred way to submit
> Jared> patches, or should I just mail them?
> 
> Since we're just talking about a single file, I think mailing them
> directly to me is the easiest way for now. BTW, the attachment didn't
> go through on the Tracker.
> 
Oops...the groups patch is hopefully attached to this message.
> Jared> I've also been working on images. SVG has an image tag
> Jared> where you can include a external .png file. I used some
> Jared> code from the GTK backend to save an image as a png, then
> Jared> included, as shown below.
> 
> I think you'll be better off following the lead of how backend PS
> handles image drawing, which has no GTK dependence. I don't think you
> need to use GTK or PNG as an intermediary. You may want to get a
> fresh CVS checkout because there was a screwup in the width/height
> dimensions in earlier versions that has been fixed.
I don't see any obvious way to directly include a bitmap in SVG, but
I'll keep looking.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /