|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
GDI+ Font RenderingHere's another question for you guys,
I read somewhere that GDI+ uses hardware accelerated font rendering (or something along those lines). If this is correct, is it also correct that switching to GDI+ font rendering (only) would give me a performance boost? I seem to have a bootleneck in my font rendering pipeline. Thanks ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingOn Sat, Mar 14, 2009 at 6:36 AM, George <georgios_vlachakis@...> wrote:
> Here's another question for you guys, > > I read somewhere that GDI+ uses hardware accelerated font rendering (or > something along those lines). If this is correct, is it also correct > that switching to GDI+ font rendering (only) would give me a performance > boost? I seem to have a bootleneck in my font rendering pipeline. > Windows 7 has a new API called Direct2D that renders text in hardware. As far as I know, no other version of Windows has acceleration other than .NET apps using WPF. -- Cory Nelson ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingHi,
> I read somewhere that GDI+ uses hardware accelerated font rendering (or > something along those lines). If this is correct, is it also correct > that switching to GDI+ font rendering (only) would give me a performance > boost? I seem to have a bootleneck in my font rendering pipeline. Are you already using a bitmap cache? If not, this may give you a substantial performance boost. Depends a bit on the fact whether you have transformed text or straight text only. Best regards, -Stephan ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingStephan Assmus wrote:
> Hi, > > >> I read somewhere that GDI+ uses hardware accelerated font rendering (or >> something along those lines). If this is correct, is it also correct >> that switching to GDI+ font rendering (only) would give me a performance >> boost? I seem to have a bootleneck in my font rendering pipeline. >> > > Are you already using a bitmap cache? If not, this may give you a substantial performance boost. Depends a bit on the fact whether you have transformed text or straight text only. > > Best regards, > -Stephan > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > suggest. However, I think the problem may be the fact that prior to sending to the scanline I am doing a path_storage.concat(char_glyph) to build up the text-string plus other things, so I will try to change my logic. Changing it will also facilitate be being able to test GDI+ performance. ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingHi,
I readed some time document that shows that GDI+ text rendering is slower than pure GDI text rendering. I not remember article address, but I think that if you want really fast text renderer, use pure GDI or write you own text blitter using SSE2. GDI text rendering is also not too fast (it's probably implemented in pure C without MMX/SSE). Cheers - Petr 2009/3/14 George <georgios_vlachakis@...>: > Stephan Assmus wrote: >> Hi, >> >> >>> I read somewhere that GDI+ uses hardware accelerated font rendering (or >>> something along those lines). If this is correct, is it also correct >>> that switching to GDI+ font rendering (only) would give me a performance >>> boost? I seem to have a bootleneck in my font rendering pipeline. >>> >> >> Are you already using a bitmap cache? If not, this may give you a substantial performance boost. Depends a bit on the fact whether you have transformed text or straight text only. >> >> Best regards, >> -Stephan >> >> ------------------------------------------------------------------------------ >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> > I am transforming text and I am using cache manager as the samples > suggest. However, I think the problem may be the fact that prior to > sending to the scanline I am doing a path_storage.concat(char_glyph) to > build up the text-string plus other things, so I will try to change my > logic. Changing it will also facilitate be being able to test GDI+ > performance. > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingIf you want speed, straight up Uniscribe is the way to go. GDI's funcs
use that under the hood. If you use it directly, there are a few structures you can cache to make rendering go much quicker. On Sat, Mar 14, 2009 at 2:30 PM, Petr Kobalíček <kobalicek.petr@...> wrote: > Hi, > > I readed some time document that shows that GDI+ text rendering is > slower than pure GDI text rendering. I not remember article address, > but I think that if you want really fast text renderer, use pure GDI > or write you own text blitter using SSE2. > > GDI text rendering is also not too fast (it's probably implemented in > pure C without MMX/SSE). > > Cheers > - Petr > > 2009/3/14 George <georgios_vlachakis@...>: >> Stephan Assmus wrote: >>> Hi, >>> >>> >>>> I read somewhere that GDI+ uses hardware accelerated font rendering (or >>>> something along those lines). If this is correct, is it also correct >>>> that switching to GDI+ font rendering (only) would give me a performance >>>> boost? I seem to have a bootleneck in my font rendering pipeline. >>>> >>> >>> Are you already using a bitmap cache? If not, this may give you a substantial performance boost. Depends a bit on the fact whether you have transformed text or straight text only. >>> >>> Best regards, >>> -Stephan >>> >>> ------------------------------------------------------------------------------ >>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >>> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >>> software that enables intelligent coding and step-through debugging. >>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >>> >> I am transforming text and I am using cache manager as the samples >> suggest. However, I think the problem may be the fact that prior to >> sending to the scanline I am doing a path_storage.concat(char_glyph) to >> build up the text-string plus other things, so I will try to change my >> logic. Changing it will also facilitate be being able to test GDI+ >> performance. >> >> >> ------------------------------------------------------------------------------ >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> _______________________________________________ >> Vector-agg-general mailing list >> Vector-agg-general@... >> https://lists.sourceforge.net/lists/listinfo/vector-agg-general >> > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font Renderinghi,
On Sat, Mar 14, 2009 at 10:30 PM, Petr Kobalíček <kobalicek.petr@...> wrote: > I readed some time document that shows that GDI+ text rendering is > slower than pure GDI text rendering. I not remember article address, > but I think that if you want really fast text renderer, use pure GDI > or write you own text blitter using SSE2. > > GDI text rendering is also not too fast (it's probably implemented in > pure C without MMX/SSE). As far as I remember, GDI+ is mostly software only, GDI has some hardware acceleration (do not know which :). Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingHi Pierre,
I think that DIBs have no hardware acceleration at all, so we can compare software implementations ;-) I think that blitjit will beat all of those ;-) Cheers - Petr 2009/3/15 Pierre Joye <pierre.php@...>: > hi, > > On Sat, Mar 14, 2009 at 10:30 PM, Petr Kobalíček > <kobalicek.petr@...> wrote: > >> I readed some time document that shows that GDI+ text rendering is >> slower than pure GDI text rendering. I not remember article address, >> but I think that if you want really fast text renderer, use pure GDI >> or write you own text blitter using SSE2. >> >> GDI text rendering is also not too fast (it's probably implemented in >> pure C without MMX/SSE). > > As far as I remember, GDI+ is mostly software only, GDI has some > hardware acceleration (do not know which :). > > Cheers, > -- > Pierre > > http://blog.thepimp.net | http://www.libgd.org > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font Rendering:-))
2009/3/15 Petr Kobalíček <kobalicek.petr@...>: > Hi Pierre, > > I think that DIBs have no hardware acceleration at all, so we can > compare software implementations ;-) > > I think that blitjit will beat all of those ;-) > > Cheers > - Petr > > 2009/3/15 Pierre Joye <pierre.php@...>: >> hi, >> >> On Sat, Mar 14, 2009 at 10:30 PM, Petr Kobalíček >> <kobalicek.petr@...> wrote: >> >>> I readed some time document that shows that GDI+ text rendering is >>> slower than pure GDI text rendering. I not remember article address, >>> but I think that if you want really fast text renderer, use pure GDI >>> or write you own text blitter using SSE2. >>> >>> GDI text rendering is also not too fast (it's probably implemented in >>> pure C without MMX/SSE). >> >> As far as I remember, GDI+ is mostly software only, GDI has some >> hardware acceleration (do not know which :). >> >> Cheers, >> -- >> Pierre >> >> http://blog.thepimp.net | http://www.libgd.org >> >> ------------------------------------------------------------------------------ >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> _______________________________________________ >> Vector-agg-general mailing list >> Vector-agg-general@... >> https://lists.sourceforge.net/lists/listinfo/vector-agg-general >> > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > -- Pierre http://blog.thepimp.net | http://www.libgd.org ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingThanks to everyone's contribution to my original question.
Here's another font related question: Is it possible to use gray8 adaptor and perform matrix transformations? I used to convert to curves or contour first and then matrix transform that but with the adaptor I don't see such option. -----Original Message----- From: Pierre Joye [mailto:pierre.php@...] Sent: Sunday, March 15, 2009 5:20 PM To: Anti-Grain Geometry Subject: Re: [AGG] GDI+ Font Rendering :-)) 2009/3/15 Petr Kobalíček <kobalicek.petr@...>: > Hi Pierre, > > I think that DIBs have no hardware acceleration at all, so we can > compare software implementations ;-) > > I think that blitjit will beat all of those ;-) > > Cheers > - Petr > > 2009/3/15 Pierre Joye <pierre.php@...>: >> hi, >> >> On Sat, Mar 14, 2009 at 10:30 PM, Petr Kobalíček >> <kobalicek.petr@...> wrote: >> >>> I readed some time document that shows that GDI+ text rendering is >>> slower than pure GDI text rendering. I not remember article address, >>> but I think that if you want really fast text renderer, use pure GDI >>> or write you own text blitter using SSE2. >>> >>> GDI text rendering is also not too fast (it's probably implemented in >>> pure C without MMX/SSE). >> >> As far as I remember, GDI+ is mostly software only, GDI has some >> hardware acceleration (do not know which :). >> >> Cheers, >> -- >> Pierre >> >> http://blog.thepimp.net | http://www.libgd.org >> >> ------------------------------------------------------------------------------ >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> _______________________________________________ >> Vector-agg-general mailing list >> Vector-agg-general@... >> https://lists.sourceforge.net/lists/listinfo/vector-agg-general >> > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > -- Pierre http://blog.thepimp.net | http://www.libgd.org ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingGeorge Vlahakis schrieb:
> Thanks to everyone's contribution to my original question. > > Here's another font related question: > > Is it possible to use gray8 adaptor and perform matrix transformations? I used to convert to curves or contour first and then matrix transform that but with the adaptor I don't see such option. Essentially, this means to render transformed images, which, depending on the given transformation, will have much lower quality than doing vector transformations. While the existing interface was not directly intended to work like this, since it produces coverage scanlines, it could be possible to wrap image accessors around the data, but I am sure this will involve some unwanted overhead. Coverage scanlines do not contain color information, for this, you need a "span generator", for text most likely generating a solid color. However, you would need to combine all this to be able to wrap an image accessor around the result, since they usually work in the same color space as the target surface. Like I said in the beginning, quality may be greatly reduced depending on the transformation, so I wonder if it's worth the trouble. Best regards, -Stephan ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: GDI+ Font RenderingThanks for the reply, I think I will stick with ren_gen_outline even at the performance cost as quality is of essence.
-----Original Message----- From: Stephan Aßmus [mailto:superstippi@...] Sent: Tuesday, March 17, 2009 11:55 AM To: Anti-Grain Geometry Subject: Re: [AGG] GDI+ Font Rendering George Vlahakis schrieb: > Thanks to everyone's contribution to my original question. > > Here's another font related question: > > Is it possible to use gray8 adaptor and perform matrix transformations? I used to convert to curves or contour first and then matrix transform that but with the adaptor I don't see such option. Essentially, this means to render transformed images, which, depending on the given transformation, will have much lower quality than doing vector transformations. While the existing interface was not directly intended to work like this, since it produces coverage scanlines, it could be possible to wrap image accessors around the data, but I am sure this will involve some unwanted overhead. Coverage scanlines do not contain color information, for this, you need a "span generator", for text most likely generating a solid color. However, you would need to combine all this to be able to wrap an image accessor around the result, since they usually work in the same color space as the target surface. Like I said in the beginning, quality may be greatly reduced depending on the transformation, so I wonder if it's worth the trouble. Best regards, -Stephan ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
http://channel9.msdn.com/pdc20 |
|
|
Re: http://channel9.msdn.com/pdc20 |
|
|
Preserving transparency in windowsHi all,
This should be a quick one (I hope). I am currently rendering to a HDC : pixmap->blend(hdc,0,0) and then saving to a PNG from that HDC. I works fine however, when saving to a file I would like to keep transparency (which is lost when rendering to the HDC). Do you have any suggestions as to how to bitblt to a windows HBITMAP (in memory) with transparency? Thanks George ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Preserving transparency in windowsI think you are looking for this ?
http://msdn.microsoft.com/en-us/library/aa452850.aspx Or you could use something like GetDIBbits, or just render to a RGBA in memorybuffer, and use that as source for the png. Edgar ----- Original Message ----- From: "George Vlahakis" <g.vlahakis@...> To: "Anti-Grain Geometry" <vector-agg-general@...> Sent: Tuesday, June 23, 2009 19:19 Subject: [AGG] Preserving transparency in windows > Hi all, > > This should be a quick one (I hope). > > I am currently rendering to a HDC : > > pixmap->blend(hdc,0,0) > > and then saving to a PNG from that HDC. I works fine however, when > saving to a file I would like to keep transparency (which is lost when > rendering to the HDC). > > Do you have any suggestions as to how to bitblt to a windows HBITMAP (in > memory) with transparency? > > Thanks > > George > > > ------------------------------------------------------------------------------ > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Preserving transparency in windowsThanks for that. I think the pure_api example might do it... it is even documented! ;-) From: Edgar 't Hart @ GMail [mailto:edgar.t.hart@...] Sent: Wed 6/24/2009 00:02 To: Anti-Grain Geometry Subject: Re: [AGG] Preserving transparency in windows I think you are looking for this ? ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Preserving transparency in windowsI would not go through the HDC rendering but would rather stay with
the raw pixel buffer in memory, then use a library such as libpng to encode and save the file to disk. > From: George Vlahakis [mailto:g.vlahakis@...] [...] > > I am currently rendering to a HDC : > > pixmap->blend(hdc,0,0) > > and then saving to a PNG from that HDC. I works fine however, when > saving to a file I would like to keep transparency (which is lost when > rendering to the HDC). > > Do you have any suggestions as to how to bitblt to a windows HBITMAP > (in memory) with transparency? ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Preserving transparency in windowsActually it’s a requirement to be
able to send back to a .NET framework app the transparent bmp. Here is the code I am testing on and I
can't shake those outline dots ... int
width = 320; int
height = 240; //Also
tried adding System::Drawing::Imaging::PixelFormat::Format32bppPArgb System::Drawing::Bitmap^
gdiBMP = gcnew System::Drawing::Bitmap(width,
height); System::Drawing::Graphics^
g = System::Drawing::Graphics::FromImage(gdiBMP); IntPtr hdcPtr =
g->GetHdc(); HDC hdc =
(HDC)hdcPtr.ToPointer(); //Creating
compatible DC and a bitmap to render the image BITMAPINFO bmp_info; bmp_info.bmiHeader.biSize
= sizeof(BITMAPINFOHEADER); bmp_info.bmiHeader.biWidth
= width; bmp_info.bmiHeader.biHeight
= height; bmp_info.bmiHeader.biPlanes
= 1; bmp_info.bmiHeader.biBitCount
= 32; bmp_info.bmiHeader.biCompression
= BI_RGB; bmp_info.bmiHeader.biSizeImage
= 0; bmp_info.bmiHeader.biXPelsPerMeter
= 0; bmp_info.bmiHeader.biYPelsPerMeter
= 0; bmp_info.bmiHeader.biClrUsed
= 0; bmp_info.bmiHeader.biClrImportant
= 0; HDC mem_dc =
::CreateCompatibleDC(hdc); void*
buf = 0; HBITMAP bmp =
::CreateDIBSection( mem_dc, &bmp_info, DIB_RGB_COLORS, &buf, 0, 0 ); //
Selecting the object before doing anything allows you //
to use AGG together with native Windows GDI. HBITMAP temp =
(HBITMAP)::SelectObject(mem_dc, bmp); //============================================================
//
AGG lowest level code. agg::rendering_buffer
rbuf; rbuf.attach((unsigned char*)buf,
width, height, -width*4); // Use negative stride in
order // to keep Y-axis consistent with // WinGDI, i.e., going down. //
Pixel format and basic primitives renderer // also tried
bgra32_pre agg::pixfmt_bgra32
pixf(rbuf); agg::renderer_base<agg::pixfmt_bgra32>
renb(pixf); //renb.clear(agg::rgba8(255,
255, 255, 255)); renb.clear(agg::rgba8(0,
0, 0, 0)); //
Scanline renderer for solid filling. agg::renderer_scanline_aa_solid<agg::renderer_base<agg::pixfmt_bgra32>
> ren(renb); //
Rasterizer & scanline agg::rasterizer_scanline_aa<>
ras; agg::scanline_p8 sl; //
Polygon (triangle) ras.move_to_d(20.7,
34.15); ras.line_to_d(398.23,
123.43); ras.line_to_d(165.45,
401.87); //
Setting the attrribute (color) & Rendering //ren.color(agg::rgba8(80,
90, 60)); ren.color(agg::rgba8(255,
255, 255)); agg::render_scanlines(ras,
sl, ren); //============================================================ //
demulpitplying helps a lot but still leaves black dots around // the shape pixf.demultiply(); //------------------------------------------------------------
//
Display the image. If the image is B-G-R-A (32-bits per pixel) //
one can use AlphaBlend instead of BitBlt. In case of AlphaBlend //
one also should clear the image with zero alpha, i.e. rgba8(0,0,0,0) BLENDFUNCTION ftn;
ftn.BlendOp = AC_SRC_OVER;
ftn.BlendFlags = 0;
ftn.SourceConstantAlpha = 255;
ftn.AlphaFormat = AC_SRC_ALPHA; ::AlphaBlend( hdc, 0, 0,
width, height, mem_dc, 0,0,width, height, ftn); //
Free resources ::SelectObject(mem_dc,
temp); ::DeleteObject(bmp); ::DeleteObject(mem_dc); g->ReleaseHdc(hdcPtr); g->Flush(); delete
g;
gdiBMP->Save("test2.png",
System::Drawing::Imaging::ImageFormat::Png); -----Original Message----- I would not go through the HDC rendering but would rather
stay with the raw pixel buffer in memory, then use a library such
as libpng to encode and save the file to disk. > From: George Vlahakis
[mailto:g.vlahakis@...] [...] > > I am currently rendering to a HDC : > > pixmap->blend(hdc,0,0) > > and then saving to a PNG from that HDC. I works fine
however, when > saving to a file I would like to keep transparency
(which is lost when > rendering to the HDC). > > Do you have any suggestions as to how to bitblt to a
windows HBITMAP > (in memory) with transparency? [...] ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list https://lists.sourceforge.net/lists/listinfo/vector-agg-general ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Preserving transparency in windowsWell, if I get you
right, what you want is paint with AGG into the System.Drawing.Bitmap
object ? I'd not use the
complicated Graphics/HDC/Compatible DC/etc. stuff, but simply use (in C#
syntax) something like that : Rectangle rect = new
Rectangle(0, 0, gdiBMP.Width, gdiBMP.Height); BitmapData bmpData = gdiBMP.LockBits(rect,
ImageLockMode.ReadWrite, gdiBMP.PixelFormat); bmpData.Scan0 contains
the pointer to the first scan line (i.e. use it directly with the AGG rendering
buffer) and bmpData.Stride contains the width in bytes for a given line. When you are finished
filling the buffer with AGG, simply UnlockBits and you should be done. Pierre From: George Vlahakis
[mailto:g.vlahakis@...] Actually it’s a requirement to be
able to send back to a .NET framework app the transparent bmp. Here is the code I am testing on and I
can't shake those outline dots ... int width = 320; int height = 240; //Also tried adding
System::Drawing::Imaging::PixelFormat::Format32bppPArgb
System::Drawing::Bitmap^ gdiBMP = gcnew
System::Drawing::Bitmap(width, height);
System::Drawing::Graphics^ g = System::Drawing::Graphics::FromImage(gdiBMP); IntPtr
hdcPtr = g->GetHdc(); HDC hdc =
(HDC)hdcPtr.ToPointer(); [...] ------------------------------------------------------------------------------ _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |