Re: [Imtoolkit-users] Draw line on a image
Brought to you by:
scuri
From: Antonio S. <sc...@te...> - 2014-07-22 10:02:06
|
Here it is in Lua: require"imlua" require"imlua_process" require"cdlua" require"cdluaim" local crd = im.ImageCreate(2200, 1700, im.RGB, im.BYTE) im.ProcessRenderConstant(crd, {255, 255, 255}) local canvas = crd:cdCreateCanvas() canvas:LineStyle(cd.DASHED) canvas:Line(10, 10, 50, 50) cd.KillCanvas(canvas) im.FileImageSave("a.png", "PNG", crd) Best, Scuri On Tue, Jul 22, 2014 at 1:21 AM, Milind Gupta <mil...@gm...> wrote: > Tried this: > > local crd = im.ImageCreate(2200, 1700, im.RGB, im.BYTE) > im.ProcessRenderConstant(crd, {255, 255, 255}) > canvas = > cd.CreateCanvas(cd.IMAGERGB,tostring(crd:Width()).."x"..tostring(crd:Height()).." > 0x"..tostring(crd[0]):match("imImageChannel%((.-)%)").." > 0x"..tostring(crd[1]):match("imImageChannel%((.-)%)").." > 0x"..tostring(crd[2]):match("imImageChannel%((.-)%)")) > canvas:LineStyle(cd.DASHED) > canvas:Line(10, 10, 50, 50) > cd.KillCanvas(canvas) > im.FileImageSave("a.png", "PNG", crd) > > But did not work just a white image > > > Milind > > > On Mon, Jul 21, 2014 at 5:58 PM, Milind Gupta <mil...@gm...> > wrote: > >> Thanks for sending the steps. I am struggling to find a lua equivalent. >> Is it possible to implement it in lua? >> >> Thanks, >> Milind >> >> >> >> On Mon, Jul 21, 2014 at 7:23 AM, Antonio Scuri <sc...@te...> >> wrote: >> >>> Hi, >>> >>> Using the CD library. You can create a CD_IMAGERGB canvas using the >>> existing image buffers. >>> >>> Here is a sample in C: >>> >>> imImage* image = *imImageCreate*(width, height, IM_RGB, IM_BYTE); >>> // Can also call *imImageAddAlpha* if alpha support is wanted >>> cdCanvas* canvas = cdCreateCanvasf(CD_IMAGERGB, "%dx%d %p %p %p", width, height, >>> image->data[0], image->data[1], image->data[2]);cdCanvasLineStyle(canvas, CD_DASHED); >>> cdCanvasLine(canvas, 10, 10, 50, 50); >>> cdKillCanvas(canvas); >>> *imFileImageSave*(file_name, "PNG", image);*imImageDestroy*(image); >>> >>> Best, >>> Scuri >>> >>> >>> On Mon, Jul 21, 2014 at 3:31 AM, Milind Gupta <mil...@gm...> >>> wrote: >>> >>>> Hi, >>>> I am combining some images on a bigger images. How can I draw >>>> lines also on that combined image? >>>> >>>> Thanks, >>>> Milind >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Want fast and easy access to all the code in your enterprise? Index and >>>> search up to 200,000 lines of code with a free copy of Black Duck >>>> Code Sight - the same software that powers the world's largest code >>>> search on Ohloh, the Black Duck Open Hub! Try it now. >>>> http://p.sf.net/sfu/bds >>>> _______________________________________________ >>>> Imtoolkit-users mailing list >>>> Imt...@li... >>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Want fast and easy access to all the code in your enterprise? Index and >>> search up to 200,000 lines of code with a free copy of Black Duck >>> Code Sight - the same software that powers the world's largest code >>> search on Ohloh, the Black Duck Open Hub! Try it now. >>> http://p.sf.net/sfu/bds >>> _______________________________________________ >>> Imtoolkit-users mailing list >>> Imt...@li... >>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users >>> >>> >> > > > ------------------------------------------------------------------------------ > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight - the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Imtoolkit-users mailing list > Imt...@li... > https://lists.sourceforge.net/lists/listinfo/imtoolkit-users > > |