Re: drawing a generated bitmap



hello :)

thank you very much for your answer :)
but i'm afraid i won't be able to use it. the access to the rgb class seems to 
be either very much limited in gtk sharp (mono) compared to the original and 
other bindings, or at least quite a way beyond my programming skills.
i think i'm supposed to be using a gdk.pixbuf instead but than again i can't 
or don't know how to access the memory directly.

anyways, in the meantime i've received another answer which made me finally 
grab the concept behind colour allocation and colour.pixel value. it seems 
that i eventually got an idea of what i'm actually writing :)

still, thanks a lot for the answer once again:)

Dnia niedziela, 18 czerwca 2006 15:27, napisałeś:
> hi,
>
> i do something like this in an application used to draw probability
> density function plots.  what i do is render the image to an internal
> RGB buffer followed by gdk_draw_rgb_image() to render it to the
> internal pixmap (this pixmap subsequently rendered to the screen):
>
> width = DrawingArea->allocation.width;
> height = DrawingArea->allocation.height;
> rgbbuf = malloc(width * height * 3);
> memset(rgbbuf, 240, width * height * 3);		// set the background to
> GREY=(240, 240, 240)
> DrawBufferImage(rgbbuf, width, height, data);
> gdk_draw_rgb_image(pixmap, DrawingArea->style->fg_gc[GTK_STATE_NORMAL],
> 	0, 0, width, height, GDK_RGB_DITHER_NONE, rgbbuf, width*3);
> free(rgbbuf);
>
> my input data dictates an absolute starting size, so inside my
> DrawBufferImage() routine, i also magnify the image using a bi-cubic
> spline interpolation algorithm.  the speed achieved in ultimately
> rendering the image is as fast as possible, and there is no real
> discernable delay between receiving the data to plot and rendering
> the image to the screen, i.e., it's instantaneous.
>
> plotting pixel by pixel (and magnifying to boot) can result in a
> quickly drawn image (depending on the number of data points, of
> course), if gone about in the right manner.
>
> cheers,
>
> richard
>
> On Jun 18, 2006, at 1:28 PM, kamil stachowski wrote:
> > thank you for the answer :)
> >
> >> Don't draw pixel by pixel, it would be awfully slow.
> >> Use GdkPixbufs and gdk_draw_pixbuf().
> >
> > you mean "don't draw pixel by pixel using drawpoint", is that it?
> >
> >> Something along these lines should be doable *if* you can
> >> get a indexed color visual, which you cannot count on.  So
> >> I would just redraw it (incidentally I develop a program
> >> which uses false-color maps a lot and redrawing works good
> >> enough).
> >
> > that's a pity but i'll have to cope with that if there's no other way.
> >
> > however, i ran into a problem with colourmaps. i was using
> > gdk.image (has the
> > putpixel method which treats the colours in a more traditional way,
> > and seems
> > to be fast enough for my needs) but didn't manage to change the
> > colours it
> > uses. i keep getting a blue gradient which is not precisely what i
> > want.
> > here's the code:
> >
> > def img=Image(ImageType.Fastest,Visual.System,500,500);
> > for (mutable x=0, x<500; x++) for (mutable y=0; y<500; y++)
> > 	img.PutPixel(x,y,(x+y):>UInt32);
> >
> > def gc=GC(args.Event.Window);
> > mutable col=Color(0xff,0,0);
> > gc.Colormap.AllocColor(ref col,true,true);
> > img.Colormap=gc.Colormap;
> >
> > args.Event.Window.DrawImage(gc,img,0,0,0,0,500,500);
> >
> > i don't seem to be able to spot anything red in the result. could
> > you please
> > tell me what i am doing wrong?
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]