[cairo] problem with BitBlt

gurnett at macbat.com gurnett at macbat.com
Mon Sep 1 05:30:14 PDT 2008


I tried

(cr,CAIRO_OPERATOR_CLEAR);
> cairo_paint(cr);

but with no luck. Everything was working properly until I introduced the
TImage and Bitblt bits, so I ought to be with one of these that the problem
occurs


Thanks

Mick
----- Original Message ----- 
From: "Gerdus van Zyl" <gerdusvanzyl at gmail.com>
To: <cairo at cairographics.org>
Sent: Monday, September 01, 2008 11:50 AM
Subject: Re: [cairo] problem with BitBlt


> Have you tried:
>
> cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR);
> cairo_paint(cr);
>
> You should also check if the Graphics::TBitmap is not initialized with
> a white background and try using direct GDI to clear it if the above
> does not work.
>
> ~Gerdus
>
> On Sun, Aug 31, 2008 at 12:11 PM, Michael Gurnett <gurnett at glocalnet.net> 
> wrote:
>> Why would you want to paint the background red with and 100% opaque (no
>> transparancy). What you explain later on is the problem I have. The
>> background colour would not be unexpected if the correct procedure as 
>> used.
>> It is just a question of the correct approach.
>>
>> ----- Original Message -----
>> From: Mukul Sharma
>> To: Michael Gurnett
>> Cc: cairo at cairographics.org
>> Sent: Sunday, August 31, 2008 11:23 AM
>> Subject: Re: [cairo] problem with BitBlt
>> Ohk.
>>
>> Use cairo_set_source_rgba(1,0,0,1);
>> and then use cairo_paint();
>>
>> I think, this would work. On a sidenote, having a transparent background 
>> can
>> give you unexpected background color. I had tried doing the same thing, 
>> but
>> eventually settled on having a known background color as compared to 
>> having
>> a transparent background. For example, when I had a transparent 
>> background,
>> I obtained a black background. Thus, I painted it all in white and then
>> performed my drawings.
>>
>> I cannot support your guess that BitBlt does not support Alpha values.
>> Because, BitBlt is simply a method to transfer a value of colour. The 
>> value
>> of color is calculated at Cairo's End and rendered at the Display end. 
>> Thus,
>> if Alpha values are not supported somewhere, it would be your display and
>> AFAK it cannot be BitBlt part or Cairo part.
>>
>> Regards
>> Mukul
>>
>> On Sun, Aug 31, 2008 at 2:10 AM, Michael Gurnett <gurnett at glocalnet.net>
>> wrote:
>>>
>>> Tried with cairo_paint_with_alpha, but that didn't seem to work.
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: Michael Gurnett
>>> To: cairo at cairographics.org
>>> Sent: Sunday, August 31, 2008 2:27 AM
>>> Subject: [cairo] problem with BitBlt
>>> I have the following bit of code
>>>
>>> bckgrnd = new Graphics::TBitmap;
>>>    bckgrnd->Width = ClientWidth;
>>>    bckgrnd->Height = ClientHeight;
>>>  HDC hdc;
>>>  hdc=bckgrnd->Canvas->Handle;
>>>   cairo_pattern_t *pat;
>>>  cairo_surface_t *surface;
>>>
>>>  surface = cairo_win32_surface_create (hdc);
>>>  background = cairo_create (surface);
>>>
>>> ....
>>>
>>>
>>> The idea is the to draw on the background surface and BitBlt it on my
>>> paint routine. However, with the code above it appears that the initial
>>> drawing space is filled white (guessing rgba are all 1). Is there a way 
>>> to
>>> get the initial drawing region to be transparant.
>>>
>>> Thanks
>>>
>>> Michael
>>>
>>> ________________________________
>>>
>>> _______________________________________________
>>> cairo mailing list
>>> cairo at cairographics.org
>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>>
>>> _______________________________________________
>>> cairo mailing list
>>> cairo at cairographics.org
>>> http://lists.cairographics.org/mailman/listinfo/cairo
>>
>>
>>
>> --
>> Thanks and Regards,
>>
>> Mukul Sharma
>> Centre for High Performance Embedded Systems
>> Nanyang Technological University, Singapore
>>
>> "A person who runs from responsibilities, runs from life."
>>
>> "It is easy to hate and it is difficult to love. This is how the whole
>> scheme of things works. All good things are difficult to achieve; and bad
>> things are very easy to get."
>>
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
>>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo 



More information about the cairo mailing list