SP2 and transparent bitmaps

  • Thread starter Thread starter Elisa
  • Start date Start date
E

Elisa

Hi,

I just installed SP2 and think I found a bug:

If have a custom-drawn button that can display an image (hands up
everyone that think MS made a big mistake not including that in the
Compact Framework itself!).

As taken from the FAQ, and as used in an example on the GotDotNet
website, I use the Image Attributes to specify a transparent color. But
with SP2, it not only makes the color I specify transparent, it also
interprets RGB 255;255;255 (white) as transparent?!


Regards,

Elisa
 
I believe there's a known change in behaviour for icons and transparency
color in SP2.
To workaround that you can define a trasparent color dynamically:

ImageAttributes attr = new ImageAttributes();

attr.SetColorKey(thumbTemp.GetPixel(1, 1), thumbTemp.GetPixel(1, 1));
 
Hi Alex,
I believe there's a known change in behaviour for icons and
transparency color in SP2.

Well, it certainly isn't listed on the "changes" page that is shown when
you download SP2! If it has changed, can anyone tell us what the actual
new behaviour is?
To workaround that you can define a trasparent color dynamically:
attr.SetColorKey(thumbTemp.GetPixel(1, 1), thumbTemp.GetPixel(1, 1));

I actually do that already, still, it seems that it now not only uses
the color of that particular pixel, it also assumes every Color.White
pixel is transparant. Nice feature! Not!!


Regards,

Elisa

-----
 
it also assumes every Color.White
pixel is transparant. Nice feature! Not!!

no, not really... i allways use a magenta as transparent color... or a full
blue if i need the magenta ... good to know that white-problem! A
work-around may be to use a light gray instead of white.

Do you have 256 color bitmaps (or more colors)? If so, then replace every
255,255,255 by a 254, 254, 254... i think no one will notice that - but it
shouldn't be transparent anymore

Boris
 
Hello Elisa,

Please could you post a simple application that reproduces the problem?

Thank you in advance,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: SP2 and transparent bitmaps
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 17
| Message-ID: <[email protected]>
| Date: Mon, 02 Feb 2004 09:02:09 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon, 02 Feb 2004
10:02:09 MET)
| NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
.be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
l
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44559
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi,
|
| I just installed SP2 and think I found a bug:
|
| If have a custom-drawn button that can display an image (hands up
| everyone that think MS made a big mistake not including that in the
| Compact Framework itself!).
|
| As taken from the FAQ, and as used in an example on the GotDotNet
| website, I use the Image Attributes to specify a transparent color. But
| with SP2, it not only makes the color I specify transparent, it also
| interprets RGB 255;255;255 (white) as transparent?!
|
|
| Regards,
|
| Elisa
|
 
Here's some quick sample code:

-----

Public Class TransparentImageControl
Inherits Control

Public _img As Image
Private _bmpOffscreen As Bitmap

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

Dim gxOff As Graphics
Dim imgAttr As ImageAttributes = New ImageAttributes

If _bmpOffscreen Is Nothing Then
_bmpOffscreen = New Bitmap(Me.ClientSize.Width,
Me.ClientSize.Height)
End If

gxOff = Graphics.FromImage(_bmpOffscreen)
gxOff.Clear(Parent.BackColor)

imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
GetUpperLeftPixelColor(_img))

gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0, 32,
32, GraphicsUnit.Pixel, imgAttr)

e.Graphics.DrawImage(_bmpOffscreen, 0, 0)

MyBase.OnPaint(e)

End Sub

Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)

' Prevents flicker

End Sub

Private Function GetUpperLeftPixelColor(ByVal img As Image) As Color

Dim bmp As Bitmap = New Bitmap(img)

Return bmp.GetPixel(0, 0)

End Function

-----

Some info about the problem:

- it appeared after installing SP2.
- the images in question are GIF files.
- beside the color in the upper-left corner of the image, it also
interprets everything closely resembling white (RGB 255/255/255) as
transparent. I tried with a value of RGB 252/254/252.

If you need any additional info, just yell. I'd really like this resolved!


Regards,

Elisa

------
 
I experience exactly the same problem. before sp2 a gif with
transparency was read with the transparent color intact, so you could
set this particular color to transparent using setColorKey.

with sp2 the transparent color is turned into white when reading the
bitmap from disk. The problem with my app is that white is a color i
do not want to be transparent in my picture! (there are significant
white pixels in it). I do not create the gifs myself, so I cannot
change this!

Any updates on this problem yet?



Elisa,

If you could post a simple project that has all necessary code (so I'd just
need to hit F5 to run it) I would greatly appreciate it. It would help a
lot to narrow the problem down. If you cannot do it, please could you at
least post the image that causes the problem?

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 127
| Message-ID: <[email protected]>
| Date: Wed, 04 Feb 2004 09:37:15 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04 Feb 2004
10:37:15 MET)
| NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44804
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Here's some quick sample code:
|
| -----
|
| Public Class TransparentImageControl
| Inherits Control
|
| Public _img As Image
| Private _bmpOffscreen As Bitmap
|
| Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
|
| Dim gxOff As Graphics
| Dim imgAttr As ImageAttributes = New ImageAttributes
|
| If _bmpOffscreen Is Nothing Then
| _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| Me.ClientSize.Height)
| End If
|
| gxOff = Graphics.FromImage(_bmpOffscreen)
| gxOff.Clear(Parent.BackColor)
|
| imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| GetUpperLeftPixelColor(_img))
|
| gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0, 32,
| 32, GraphicsUnit.Pixel, imgAttr)
|
| e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
|
| MyBase.OnPaint(e)
|
| End Sub
|
| Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
|
| ' Prevents flicker
|
| End Sub
|
| Private Function GetUpperLeftPixelColor(ByVal img As Image) As Color
|
| Dim bmp As Bitmap = New Bitmap(img)
|
| Return bmp.GetPixel(0, 0)
|
| End Function
|
| -----
|
| Some info about the problem:
|
| - it appeared after installing SP2.
| - the images in question are GIF files.
| - beside the color in the upper-left corner of the image, it also
| interprets everything closely resembling white (RGB 255/255/255) as
| transparent. I tried with a value of RGB 252/254/252.
|
| If you need any additional info, just yell. I'd really like this resolved!
|
|
| Regards,
|
| Elisa
|
| ------
|
|
| Serg Kuryata [MS] wrote:
|
| > Hello Elisa,
| >
| > Please could you post a simple application that reproduces the problem?
| >
| > Thank you in advance,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: SP2 and transparent bitmaps
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 17
| > | Message-ID: <[email protected]>
| > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon, 02 Feb
2004
10:02:09 MET)
| > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > l
| > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44559
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi,
| > |
| > | I just installed SP2 and think I found a bug:
| > |
| > | If have a custom-drawn button that can display an image (hands up
| > | everyone that think MS made a big mistake not including that in the
| > | Compact Framework itself!).
| > |
| > | As taken from the FAQ, and as used in an example on the GotDotNet
| > | website, I use the Image Attributes to specify a transparent color.
But
| > | with SP2, it not only makes the color I specify transparent, it also
| > | interprets RGB 255;255;255 (white) as transparent?!
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| >
|
 
with sp2 the transparent color is turned into white when reading the
bitmap from disk. The problem with my app is that white is a color i
do not want to be transparent in my picture! (there are significant
white pixels in it). I do not create the gifs myself, so I cannot
change this!

i'm using PaintShopPro for years. You can open the GIF, CTRL+RightClick on
the "white" to get that color with the picker then CTRL+LeftClick on that
white to get that color as foreground-color too. Then click on the
foregroundcolor (at the right where the colors are listed) and then change
it to 254, 254, 254 for example. Then use the color replacer and make a
double click (changes background color with foreground color in the whole
image). then save the gif.

Until MS will fix this problem, that may a suitable work-around. It sounds
complicated but in fact it will just need a few seconds.

Hope that helps

Boris
 
Hi Serg,

You can download a simple project exhibiting the mentioned behaviour here:

http://www.teutenhof.be/ImageBug.zip


Regards,

Elisa

---------
Elisa,

If you could post a simple project that has all necessary code (so I'd just
need to hit F5 to run it) I would greatly appreciate it. It would help a
lot to narrow the problem down. If you cannot do it, please could you at
least post the image that causes the problem?

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 127
| Message-ID: <[email protected]>
| Date: Wed, 04 Feb 2004 09:37:15 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04 Feb 2004
10:37:15 MET)
| NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44804
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Here's some quick sample code:
|
| -----
|
| Public Class TransparentImageControl
| Inherits Control
|
| Public _img As Image
| Private _bmpOffscreen As Bitmap
|
| Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
|
| Dim gxOff As Graphics
| Dim imgAttr As ImageAttributes = New ImageAttributes
|
| If _bmpOffscreen Is Nothing Then
| _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| Me.ClientSize.Height)
| End If
|
| gxOff = Graphics.FromImage(_bmpOffscreen)
| gxOff.Clear(Parent.BackColor)
|
| imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| GetUpperLeftPixelColor(_img))
|
| gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0, 32,
| 32, GraphicsUnit.Pixel, imgAttr)
|
| e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
|
| MyBase.OnPaint(e)
|
| End Sub
|
| Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
|
| ' Prevents flicker
|
| End Sub
|
| Private Function GetUpperLeftPixelColor(ByVal img As Image) As Color
|
| Dim bmp As Bitmap = New Bitmap(img)
|
| Return bmp.GetPixel(0, 0)
|
| End Function
|
| -----
|
| Some info about the problem:
|
| - it appeared after installing SP2.
| - the images in question are GIF files.
| - beside the color in the upper-left corner of the image, it also
| interprets everything closely resembling white (RGB 255/255/255) as
| transparent. I tried with a value of RGB 252/254/252.
|
| If you need any additional info, just yell. I'd really like this resolved!
|
|
| Regards,
|
| Elisa
|
| ------
|
|
| Serg Kuryata [MS] wrote:
|
| > Hello Elisa,
| >
| > Please could you post a simple application that reproduces the problem?
| >
| > Thank you in advance,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
| > Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: SP2 and transparent bitmaps
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 17
| > | Message-ID: <[email protected]>
| > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon, 02 Feb
2004
| > 10:02:09 MET)
| > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > l
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44559
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi,
| > |
| > | I just installed SP2 and think I found a bug:
| > |
| > | If have a custom-drawn button that can display an image (hands up
| > | everyone that think MS made a big mistake not including that in the
| > | Compact Framework itself!).
| > |
| > | As taken from the FAQ, and as used in an example on the GotDotNet
| > | website, I use the Image Attributes to specify a transparent color.
But
| > | with SP2, it not only makes the color I specify transparent, it also
| > | interprets RGB 255;255;255 (white) as transparent?!
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| >
|
 
Hi Boris,

Finding a workaround is not the problem, but as Peter also mentioned,
the workaround is only of use if you actually have control over the
images. If, for example, your user base can supply its own images, or
you need to use existing images (e.g. from your company's logo library),
you're out of luck...

Let's face it, it's a bug, it's needs to get resolved...


Regards,

Elisa

----------
 
You are right Elisa. My app shows radar images of showers (rain)
projected on a map. The radarimages are generated by a weatherservice
bureau, and updated every 15 minutes. I retrieve them by FTP, so
changing the format of the gifs is that easy.....
 
Hi Elisa,

I think I found what caused this problem. Unfortunately, there is no easy
workaround but I'll try to help you find one. So, here is description of
the problem.

The problem is due to the fact the gif file that you gave me has a
transparent background. The color that represents the transparent color in
this image is (252, 2, 252). If the image did not have transparency, you
would have never run into this problem (you would be able to use the left
top pixel to specify the transparent color for your needs without any
problems).

In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll belongs
to the operating system) to work with images. As you may know, Windows CE
does not support transparent images and because of this fact, when
imgdcmp.dll loads a transparent image, it replaces the transparent color
with the White color. But, due to some circumstances, probably due to a bug
(I'm not sure about this), the RGB value of the White color that is used by
imgdcmp.dll is (248, 248, 240) while RGB of the real white color on a 16
bits color device is (248, 248, 248). As a result, all transparent pixels
are replaced with pixels that have color (248, 248, 240) and that's why
everything worked fine for you when you used v1 and SP1.

After SP1, our team was forced to switch to a newer dll (imaging.dll) to
work with images. This dll also replaces the transparent color with the
White color but unlike imgdcmp.dll it uses the correct RGB value (248, 248,
248). As a result, when you query color of the left top pixel of the image
on SP1, you get (248, 248, 240), which is not a real White, but on SP2 you
get (248, 248, 248), which is a real white.

The only workaround that I see here is to turn off transparency of the
image. As I understood, you cannot edit your images, so if you could give
me a few days, I would try to provide you with some code that would turn
off transparency programmatically.

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 193
| Message-ID: <[email protected]>
| Date: Thu, 05 Feb 2004 08:56:43 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05 Feb 2004
09:56:43 MET)
| NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
enet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44939
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Serg,
|
| You can download a simple project exhibiting the mentioned behaviour here:
|
| http://www.teutenhof.be/ImageBug.zip
|
|
| Regards,
|
| Elisa
|
| ---------
|
| Serg Kuryata [MS] wrote:
|
| > Elisa,
| >
| > If you could post a simple project that has all necessary code (so I'd
just
| > need to hit F5 to run it) I would greatly appreciate it. It would help
a
| > lot to narrow the problem down. If you cannot do it, please could you
at
| > least post the image that causes the problem?
| >
| > Thank you,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
| > Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 127
| > | Message-ID: <[email protected]>
| > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04 Feb
2004
| > 10:37:15 MET)
| > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44804
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Here's some quick sample code:
| > |
| > | -----
| > |
| > | Public Class TransparentImageControl
| > | Inherits Control
| > |
| > | Public _img As Image
| > | Private _bmpOffscreen As Bitmap
| > |
| > | Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
| > |
| > | Dim gxOff As Graphics
| > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > |
| > | If _bmpOffscreen Is Nothing Then
| > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | Me.ClientSize.Height)
| > | End If
| > |
| > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | gxOff.Clear(Parent.BackColor)
| > |
| > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | GetUpperLeftPixelColor(_img))
| > |
| > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0, 32,
| > | 32, GraphicsUnit.Pixel, imgAttr)
| > |
| > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > |
| > | MyBase.OnPaint(e)
| > |
| > | End Sub
| > |
| > | Protected Overrides Sub OnPaintBackground(ByVal e As
PaintEventArgs)
| > |
| > | ' Prevents flicker
| > |
| > | End Sub
| > |
| > | Private Function GetUpperLeftPixelColor(ByVal img As Image) As
Color
| > |
| > | Dim bmp As Bitmap = New Bitmap(img)
| > |
| > | Return bmp.GetPixel(0, 0)
| > |
| > | End Function
| > |
| > | -----
| > |
| > | Some info about the problem:
| > |
| > | - it appeared after installing SP2.
| > | - the images in question are GIF files.
| > | - beside the color in the upper-left corner of the image, it also
| > | interprets everything closely resembling white (RGB 255/255/255) as
| > | transparent. I tried with a value of RGB 252/254/252.
| > |
| > | If you need any additional info, just yell. I'd really like this
resolved!
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ------
| > |
| > |
| > | Serg Kuryata [MS] wrote:
| > |
| > | > Hello Elisa,
| > | >
| > | > Please could you post a simple application that reproduces the
problem?
| > | >
| > | > Thank you in advance,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
| > | > Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: SP2 and transparent bitmaps
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 17
| > | > | Message-ID: <[email protected]>
| > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon, 02
Feb
| > 2004
| > | > 10:02:09 MET)
| > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | >
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | >
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > l
| > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:44559
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi,
| > | > |
| > | > | I just installed SP2 and think I found a bug:
| > | > |
| > | > | If have a custom-drawn button that can display an image (hands up
| > | > | everyone that think MS made a big mistake not including that in
the
| > | > | Compact Framework itself!).
| > | > |
| > | > | As taken from the FAQ, and as used in an example on the GotDotNet
| > | > | website, I use the Image Attributes to specify a transparent
color.
| > But
| > | > | with SP2, it not only makes the color I specify transparent, it
also
| > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | >
| > |
| >
|
 
Hi Serg,

Thanks for spending some time on this issue. I really appreciate it!

Turning of transparancy is not always a possibility, no. Imagine a
scenario where you would want to write a sort of web browser, you'd have
to ask every webmaster to create a seperate set of images for Pocket
PC's ;-)


Regards,

Elisa

----------
Hi Elisa,

I think I found what caused this problem. Unfortunately, there is no easy
workaround but I'll try to help you find one. So, here is description of
the problem.

The problem is due to the fact the gif file that you gave me has a
transparent background. The color that represents the transparent color in
this image is (252, 2, 252). If the image did not have transparency, you
would have never run into this problem (you would be able to use the left
top pixel to specify the transparent color for your needs without any
problems).

In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll belongs
to the operating system) to work with images. As you may know, Windows CE
does not support transparent images and because of this fact, when
imgdcmp.dll loads a transparent image, it replaces the transparent color
with the White color. But, due to some circumstances, probably due to a bug
(I'm not sure about this), the RGB value of the White color that is used by
imgdcmp.dll is (248, 248, 240) while RGB of the real white color on a 16
bits color device is (248, 248, 248). As a result, all transparent pixels
are replaced with pixels that have color (248, 248, 240) and that's why
everything worked fine for you when you used v1 and SP1.

After SP1, our team was forced to switch to a newer dll (imaging.dll) to
work with images. This dll also replaces the transparent color with the
White color but unlike imgdcmp.dll it uses the correct RGB value (248, 248,
248). As a result, when you query color of the left top pixel of the image
on SP1, you get (248, 248, 240), which is not a real White, but on SP2 you
get (248, 248, 248), which is a real white.

The only workaround that I see here is to turn off transparency of the
image. As I understood, you cannot edit your images, so if you could give
me a few days, I would try to provide you with some code that would turn
off transparency programmatically.

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 193
| Message-ID: <[email protected]>
| Date: Thu, 05 Feb 2004 08:56:43 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05 Feb 2004
09:56:43 MET)
| NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
enet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44939
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Serg,
|
| You can download a simple project exhibiting the mentioned behaviour here:
|
| http://www.teutenhof.be/ImageBug.zip
|
|
| Regards,
|
| Elisa
|
| ---------
|
| Serg Kuryata [MS] wrote:
|
| > Elisa,
| >
| > If you could post a simple project that has all necessary code (so I'd
just
| > need to hit F5 to run it) I would greatly appreciate it. It would help
a
| > lot to narrow the problem down. If you cannot do it, please could you
at
| > least post the image that causes the problem?
| >
| > Thank you,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
| > Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 127
| > | Message-ID: <[email protected]>
| > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04 Feb
2004
| > 10:37:15 MET)
| > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44804
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Here's some quick sample code:
| > |
| > | -----
| > |
| > | Public Class TransparentImageControl
| > | Inherits Control
| > |
| > | Public _img As Image
| > | Private _bmpOffscreen As Bitmap
| > |
| > | Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
| > |
| > | Dim gxOff As Graphics
| > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > |
| > | If _bmpOffscreen Is Nothing Then
| > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | Me.ClientSize.Height)
| > | End If
| > |
| > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | gxOff.Clear(Parent.BackColor)
| > |
| > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | GetUpperLeftPixelColor(_img))
| > |
| > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0, 32,
| > | 32, GraphicsUnit.Pixel, imgAttr)
| > |
| > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > |
| > | MyBase.OnPaint(e)
| > |
| > | End Sub
| > |
| > | Protected Overrides Sub OnPaintBackground(ByVal e As
PaintEventArgs)
| > |
| > | ' Prevents flicker
| > |
| > | End Sub
| > |
| > | Private Function GetUpperLeftPixelColor(ByVal img As Image) As
Color
| > |
| > | Dim bmp As Bitmap = New Bitmap(img)
| > |
| > | Return bmp.GetPixel(0, 0)
| > |
| > | End Function
| > |
| > | -----
| > |
| > | Some info about the problem:
| > |
| > | - it appeared after installing SP2.
| > | - the images in question are GIF files.
| > | - beside the color in the upper-left corner of the image, it also
| > | interprets everything closely resembling white (RGB 255/255/255) as
| > | transparent. I tried with a value of RGB 252/254/252.
| > |
| > | If you need any additional info, just yell. I'd really like this
resolved!
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ------
| > |
| > |
| > | Serg Kuryata [MS] wrote:
| > |
| > | > Hello Elisa,
| > | >
| > | > Please could you post a simple application that reproduces the
problem?
| > | >
| > | > Thank you in advance,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
| > | > Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: SP2 and transparent bitmaps
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 17
| > | > | Message-ID: <[email protected]>
| > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon, 02
Feb
| > 2004
| > | > 10:02:09 MET)
| > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | >
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | >
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > l
| > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:44559
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi,
| > | > |
| > | > | I just installed SP2 and think I found a bug:
| > | > |
| > | > | If have a custom-drawn button that can display an image (hands up
| > | > | everyone that think MS made a big mistake not including that in
the
| > | > | Compact Framework itself!).
| > | > |
| > | > | As taken from the FAQ, and as used in an example on the GotDotNet
| > | > | website, I use the Image Attributes to specify a transparent
color.
| > But
| > | > | with SP2, it not only makes the color I specify transparent, it
also
| > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | >
| > |
| >
|
 
Hi Elisa,

I totally understand that it is not always possible to turn off
transparency manually (like in case with a web browser). What I suggest is
to turn it off programmatically. Gif files that are transparent have a bit
in their data that is set to "1" to indicate that there is a transparent
color. We can try to set that bit to 0 in order to turn off transparency.
I'm not really familiar with gif format but, if this problem is very
critical for you and you can give me a few days, I can look into gif format
and provide you with some sample code that will turn off transparency of a
given gif file. Please let me know if you need this.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 305
| Message-ID: <C6IUb.1098$%[email protected]>
| Date: Fri, 06 Feb 2004 08:19:46 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06 Feb 2004
09:19:46 MET)
| NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
enet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45082
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Serg,
|
| Thanks for spending some time on this issue. I really appreciate it!
|
| Turning of transparancy is not always a possibility, no. Imagine a
| scenario where you would want to write a sort of web browser, you'd have
| to ask every webmaster to create a seperate set of images for Pocket
| PC's ;-)
|
|
| Regards,
|
| Elisa
|
| ----------
|
| Serg Kuryata [MS] wrote:
| > Hi Elisa,
| >
| > I think I found what caused this problem. Unfortunately, there is no
easy
| > workaround but I'll try to help you find one. So, here is description
of
| > the problem.
| >
| > The problem is due to the fact the gif file that you gave me has a
| > transparent background. The color that represents the transparent color
in
| > this image is (252, 2, 252). If the image did not have transparency,
you
| > would have never run into this problem (you would be able to use the
left
| > top pixel to specify the transparent color for your needs without any
| > problems).
| >
| > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll
belongs
| > to the operating system) to work with images. As you may know, Windows
CE
| > does not support transparent images and because of this fact, when
| > imgdcmp.dll loads a transparent image, it replaces the transparent
color
| > with the White color. But, due to some circumstances, probably due to a
bug
| > (I'm not sure about this), the RGB value of the White color that is
used by
| > imgdcmp.dll is (248, 248, 240) while RGB of the real white color on a
16
| > bits color device is (248, 248, 248). As a result, all transparent
pixels
| > are replaced with pixels that have color (248, 248, 240) and that's why
| > everything worked fine for you when you used v1 and SP1.
| >
| > After SP1, our team was forced to switch to a newer dll (imaging.dll)
to
| > work with images. This dll also replaces the transparent color with the
| > White color but unlike imgdcmp.dll it uses the correct RGB value (248,
248,
| > 248). As a result, when you query color of the left top pixel of the
image
| > on SP1, you get (248, 248, 240), which is not a real White, but on SP2
you
| > get (248, 248, 248), which is a real white.
| >
| > The only workaround that I see here is to turn off transparency of the
| > image. As I understood, you cannot edit your images, so if you could
give
| > me a few days, I would try to provide you with some code that would
turn
| > off transparency programmatically.
| >
| > Thank you,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
| > Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 193
| > | Message-ID: <[email protected]>
| > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05 Feb
2004
| > 09:56:43 MET)
| > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > enet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44939
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Serg,
| > |
| > | You can download a simple project exhibiting the mentioned behaviour
here:
| > |
| > | http://www.teutenhof.be/ImageBug.zip
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ---------
| > |
| > | Serg Kuryata [MS] wrote:
| > |
| > | > Elisa,
| > | >
| > | > If you could post a simple project that has all necessary code (so
I'd
| > just
| > | > need to hit F5 to run it) I would greatly appreciate it. It would
help
| > a
| > | > lot to narrow the problem down. If you cannot do it, please could
you
| > at
| > | > least post the image that causes the problem?
| > | >
| > | > Thank you,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
| > | > Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 127
| > | > | Message-ID: <[email protected]>
| > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04
Feb
| > 2004
| > | > 10:37:15 MET)
| > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | >
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | >
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:44804
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Here's some quick sample code:
| > | > |
| > | > | -----
| > | > |
| > | > | Public Class TransparentImageControl
| > | > | Inherits Control
| > | > |
| > | > | Public _img As Image
| > | > | Private _bmpOffscreen As Bitmap
| > | > |
| > | > | Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
| > | > |
| > | > | Dim gxOff As Graphics
| > | > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > | > |
| > | > | If _bmpOffscreen Is Nothing Then
| > | > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | > | Me.ClientSize.Height)
| > | > | End If
| > | > |
| > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | gxOff.Clear(Parent.BackColor)
| > | > |
| > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | GetUpperLeftPixelColor(_img))
| > | > |
| > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0,
32,
| > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > |
| > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > |
| > | > | MyBase.OnPaint(e)
| > | > |
| > | > | End Sub
| > | > |
| > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
| > PaintEventArgs)
| > | > |
| > | > | ' Prevents flicker
| > | > |
| > | > | End Sub
| > | > |
| > | > | Private Function GetUpperLeftPixelColor(ByVal img As Image)
As
| > Color
| > | > |
| > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > |
| > | > | Return bmp.GetPixel(0, 0)
| > | > |
| > | > | End Function
| > | > |
| > | > | -----
| > | > |
| > | > | Some info about the problem:
| > | > |
| > | > | - it appeared after installing SP2.
| > | > | - the images in question are GIF files.
| > | > | - beside the color in the upper-left corner of the image, it also
| > | > | interprets everything closely resembling white (RGB 255/255/255)
as
| > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > |
| > | > | If you need any additional info, just yell. I'd really like this
| > resolved!
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ------
| > | > |
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > |
| > | > | > Hello Elisa,
| > | > | >
| > | > | > Please could you post a simple application that reproduces the
| > problem?
| > | > | >
| > | > | > Thank you in advance,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
| > | > rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
| > rv:1.6)
| > | > | > Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 17
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon,
02
| > Feb
| > | > 2004
| > | > | > 10:02:09 MET)
| > | > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | > | >
| > | >
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | > | >
| > | >
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > | > l
| > | > | > | Xref: cpmsftngxa07.phx.gbl
| > | > | > microsoft.public.dotnet.framework.compactframework:44559
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Hi,
| > | > | > |
| > | > | > | I just installed SP2 and think I found a bug:
| > | > | > |
| > | > | > | If have a custom-drawn button that can display an image
(hands up
| > | > | > | everyone that think MS made a big mistake not including that
in
| > the
| > | > | > | Compact Framework itself!).
| > | > | > |
| > | > | > | As taken from the FAQ, and as used in an example on the
GotDotNet
| > | > | > | website, I use the Image Attributes to specify a transparent
| > color.
| > | > But
| > | > | > | with SP2, it not only makes the color I specify transparent,
it
| > also
| > | > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | >
| > | > |
| > | >
| > |
| >
|
 
Hi Sergiy,

thanks for looking into this problem. If Elisa is not interested in a
workaround it... I am! So if you can provide it, you would make me a
happy person. (see my problem described a few posts earlier)

Thanks,

Peter

Hi Elisa,

I totally understand that it is not always possible to turn off
transparency manually (like in case with a web browser). What I suggest is
to turn it off programmatically. Gif files that are transparent have a bit
in their data that is set to "1" to indicate that there is a transparent
color. We can try to set that bit to 0 in order to turn off transparency.
I'm not really familiar with gif format but, if this problem is very
critical for you and you can give me a few days, I can look into gif format
and provide you with some sample code that will turn off transparency of a
given gif file. Please let me know if you need this.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 305
| Message-ID: <C6IUb.1098$%[email protected]>
| Date: Fri, 06 Feb 2004 08:19:46 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06 Feb 2004
09:19:46 MET)
| NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
enet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45082
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Serg,
|
| Thanks for spending some time on this issue. I really appreciate it!
|
| Turning of transparancy is not always a possibility, no. Imagine a
| scenario where you would want to write a sort of web browser, you'd have
| to ask every webmaster to create a seperate set of images for Pocket
| PC's ;-)
|
|
| Regards,
|
| Elisa
|
| ----------
|
| Serg Kuryata [MS] wrote:
| > Hi Elisa,
| >
| > I think I found what caused this problem. Unfortunately, there is no
easy
| > workaround but I'll try to help you find one. So, here is description
of
| > the problem.
| >
| > The problem is due to the fact the gif file that you gave me has a
| > transparent background. The color that represents the transparent color
in
| > this image is (252, 2, 252). If the image did not have transparency,
you
| > would have never run into this problem (you would be able to use the
left
| > top pixel to specify the transparent color for your needs without any
| > problems).
| >
| > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll
belongs
| > to the operating system) to work with images. As you may know, Windows
CE
| > does not support transparent images and because of this fact, when
| > imgdcmp.dll loads a transparent image, it replaces the transparent
color
| > with the White color. But, due to some circumstances, probably due to a
bug
| > (I'm not sure about this), the RGB value of the White color that is
used by
| > imgdcmp.dll is (248, 248, 240) while RGB of the real white color on a
16
| > bits color device is (248, 248, 248). As a result, all transparent
pixels
| > are replaced with pixels that have color (248, 248, 240) and that's why
| > everything worked fine for you when you used v1 and SP1.
| >
| > After SP1, our team was forced to switch to a newer dll (imaging.dll)
to
| > work with images. This dll also replaces the transparent color with the
| > White color but unlike imgdcmp.dll it uses the correct RGB value (248,
248,
| > 248). As a result, when you query color of the left top pixel of the
image
| > on SP1, you get (248, 248, 240), which is not a real White, but on SP2
you
| > get (248, 248, 248), which is a real white.
| >
| > The only workaround that I see here is to turn off transparency of the
| > image. As I understood, you cannot edit your images, so if you could
give
| > me a few days, I would try to provide you with some code that would
turn
| > off transparency programmatically.
| >
| > Thank you,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 193
| > | Message-ID: <[email protected]>
| > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05 Feb
2004
09:56:43 MET)
| > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > enet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44939
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Serg,
| > |
| > | You can download a simple project exhibiting the mentioned behaviour
here:
| > |
| > | http://www.teutenhof.be/ImageBug.zip
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ---------
| > |
| > | Serg Kuryata [MS] wrote:
| > |
| > | > Elisa,
| > | >
| > | > If you could post a simple project that has all necessary code (so
I'd
just
| > | > need to hit F5 to run it) I would greatly appreciate it. It would
help
a
| > | > lot to narrow the problem down. If you cannot do it, please could
you
at
| > | > least post the image that causes the problem?
| > | >
| > | > Thank you,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
<[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 127
| > | > | Message-ID: <[email protected]>
| > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04
Feb
2004
10:37:15 MET)
| > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | >
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | >
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44804
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Here's some quick sample code:
| > | > |
| > | > | -----
| > | > |
| > | > | Public Class TransparentImageControl
| > | > | Inherits Control
| > | > |
| > | > | Public _img As Image
| > | > | Private _bmpOffscreen As Bitmap
| > | > |
| > | > | Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
| > | > |
| > | > | Dim gxOff As Graphics
| > | > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > | > |
| > | > | If _bmpOffscreen Is Nothing Then
| > | > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | > | Me.ClientSize.Height)
| > | > | End If
| > | > |
| > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | gxOff.Clear(Parent.BackColor)
| > | > |
| > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | GetUpperLeftPixelColor(_img))
| > | > |
| > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0,
32,
| > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > |
| > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > |
| > | > | MyBase.OnPaint(e)
| > | > |
| > | > | End Sub
| > | > |
| > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
PaintEventArgs)
| > | > |
| > | > | ' Prevents flicker
| > | > |
| > | > | End Sub
| > | > |
| > | > | Private Function GetUpperLeftPixelColor(ByVal img As Image)
As
Color
| > | > |
| > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > |
| > | > | Return bmp.GetPixel(0, 0)
| > | > |
| > | > | End Function
| > | > |
| > | > | -----
| > | > |
| > | > | Some info about the problem:
| > | > |
| > | > | - it appeared after installing SP2.
| > | > | - the images in question are GIF files.
| > | > | - beside the color in the upper-left corner of the image, it also
| > | > | interprets everything closely resembling white (RGB 255/255/255)
as
| > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > |
| > | > | If you need any additional info, just yell. I'd really like this
resolved!
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ------
| > | > |
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > |
| > | > | > Hello Elisa,
| > | > | >
| > | > | > Please could you post a simple application that reproduces the
problem?
| > | > | >
| > | > | > Thank you in advance,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 17
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon,
02
Feb
2004
10:02:09 MET)
| > | > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | > | >
| > | >
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | > | >
| > | >
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > | > l
| > | > | > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44559
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Hi,
| > | > | > |
| > | > | > | I just installed SP2 and think I found a bug:
| > | > | > |
| > | > | > | If have a custom-drawn button that can display an image
(hands up
| > | > | > | everyone that think MS made a big mistake not including that
in
the
| > | > | > | Compact Framework itself!).
| > | > | > |
| > | > | > | As taken from the FAQ, and as used in an example on the
GotDotNet
| > | > | > | website, I use the Image Attributes to specify a transparent
color.
But
| > | > | > | with SP2, it not only makes the color I specify transparent,
it
also
| > | > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | >
| > | > |
| > | >
| > |
| >
|
 
Hi Sergey,

Is there any progress on the workaround yet? I am about to release my
application, and it is vital to me it is compatible with sp2 (because
I cannot control who installs the sp and how does not)

I am not familiar with the gif format either, so a ready made solution
would come in very, very handy.

Thanks,

Peter


Hi Elisa,

I totally understand that it is not always possible to turn off
transparency manually (like in case with a web browser). What I suggest is
to turn it off programmatically. Gif files that are transparent have a bit
in their data that is set to "1" to indicate that there is a transparent
color. We can try to set that bit to 0 in order to turn off transparency.
I'm not really familiar with gif format but, if this problem is very
critical for you and you can give me a few days, I can look into gif format
and provide you with some sample code that will turn off transparency of a
given gif file. Please let me know if you need this.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 305
| Message-ID: <C6IUb.1098$%[email protected]>
| Date: Fri, 06 Feb 2004 08:19:46 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06 Feb 2004
09:19:46 MET)
| NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
enet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45082
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Serg,
|
| Thanks for spending some time on this issue. I really appreciate it!
|
| Turning of transparancy is not always a possibility, no. Imagine a
| scenario where you would want to write a sort of web browser, you'd have
| to ask every webmaster to create a seperate set of images for Pocket
| PC's ;-)
|
|
| Regards,
|
| Elisa
|
| ----------
|
| Serg Kuryata [MS] wrote:
| > Hi Elisa,
| >
| > I think I found what caused this problem. Unfortunately, there is no
easy
| > workaround but I'll try to help you find one. So, here is description
of
| > the problem.
| >
| > The problem is due to the fact the gif file that you gave me has a
| > transparent background. The color that represents the transparent color
in
| > this image is (252, 2, 252). If the image did not have transparency,
you
| > would have never run into this problem (you would be able to use the
left
| > top pixel to specify the transparent color for your needs without any
| > problems).
| >
| > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll
belongs
| > to the operating system) to work with images. As you may know, Windows
CE
| > does not support transparent images and because of this fact, when
| > imgdcmp.dll loads a transparent image, it replaces the transparent
color
| > with the White color. But, due to some circumstances, probably due to a
bug
| > (I'm not sure about this), the RGB value of the White color that is
used by
| > imgdcmp.dll is (248, 248, 240) while RGB of the real white color on a
16
| > bits color device is (248, 248, 248). As a result, all transparent
pixels
| > are replaced with pixels that have color (248, 248, 240) and that's why
| > everything worked fine for you when you used v1 and SP1.
| >
| > After SP1, our team was forced to switch to a newer dll (imaging.dll)
to
| > work with images. This dll also replaces the transparent color with the
| > White color but unlike imgdcmp.dll it uses the correct RGB value (248,
248,
| > 248). As a result, when you query color of the left top pixel of the
image
| > on SP1, you get (248, 248, 240), which is not a real White, but on SP2
you
| > get (248, 248, 248), which is a real white.
| >
| > The only workaround that I see here is to turn off transparency of the
| > image. As I understood, you cannot edit your images, so if you could
give
| > me a few days, I would try to provide you with some code that would
turn
| > off transparency programmatically.
| >
| > Thank you,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 193
| > | Message-ID: <[email protected]>
| > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05 Feb
2004
09:56:43 MET)
| > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > enet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44939
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Serg,
| > |
| > | You can download a simple project exhibiting the mentioned behaviour
here:
| > |
| > | http://www.teutenhof.be/ImageBug.zip
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ---------
| > |
| > | Serg Kuryata [MS] wrote:
| > |
| > | > Elisa,
| > | >
| > | > If you could post a simple project that has all necessary code (so
I'd
just
| > | > need to hit F5 to run it) I would greatly appreciate it. It would
help
a
| > | > lot to narrow the problem down. If you cannot do it, please could
you
at
| > | > least post the image that causes the problem?
| > | >
| > | > Thank you,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
<[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 127
| > | > | Message-ID: <[email protected]>
| > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04
Feb
2004
10:37:15 MET)
| > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | >
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | >
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44804
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Here's some quick sample code:
| > | > |
| > | > | -----
| > | > |
| > | > | Public Class TransparentImageControl
| > | > | Inherits Control
| > | > |
| > | > | Public _img As Image
| > | > | Private _bmpOffscreen As Bitmap
| > | > |
| > | > | Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
| > | > |
| > | > | Dim gxOff As Graphics
| > | > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > | > |
| > | > | If _bmpOffscreen Is Nothing Then
| > | > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | > | Me.ClientSize.Height)
| > | > | End If
| > | > |
| > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | gxOff.Clear(Parent.BackColor)
| > | > |
| > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | GetUpperLeftPixelColor(_img))
| > | > |
| > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0,
32,
| > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > |
| > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > |
| > | > | MyBase.OnPaint(e)
| > | > |
| > | > | End Sub
| > | > |
| > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
PaintEventArgs)
| > | > |
| > | > | ' Prevents flicker
| > | > |
| > | > | End Sub
| > | > |
| > | > | Private Function GetUpperLeftPixelColor(ByVal img As Image)
As
Color
| > | > |
| > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > |
| > | > | Return bmp.GetPixel(0, 0)
| > | > |
| > | > | End Function
| > | > |
| > | > | -----
| > | > |
| > | > | Some info about the problem:
| > | > |
| > | > | - it appeared after installing SP2.
| > | > | - the images in question are GIF files.
| > | > | - beside the color in the upper-left corner of the image, it also
| > | > | interprets everything closely resembling white (RGB 255/255/255)
as
| > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > |
| > | > | If you need any additional info, just yell. I'd really like this
resolved!
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ------
| > | > |
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > |
| > | > | > Hello Elisa,
| > | > | >
| > | > | > Please could you post a simple application that reproduces the
problem?
| > | > | >
| > | > | > Thank you in advance,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 17
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon,
02
Feb
2004
10:02:09 MET)
| > | > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | > | >
| > | >
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | > | >
| > | >
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > | > l
| > | > | > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44559
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Hi,
| > | > | > |
| > | > | > | I just installed SP2 and think I found a bug:
| > | > | > |
| > | > | > | If have a custom-drawn button that can display an image
(hands up
| > | > | > | everyone that think MS made a big mistake not including that
in
the
| > | > | > | Compact Framework itself!).
| > | > | > |
| > | > | > | As taken from the FAQ, and as used in an example on the
GotDotNet
| > | > | > | website, I use the Image Attributes to specify a transparent
color.
But
| > | > | > | with SP2, it not only makes the color I specify transparent,
it
also
| > | > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | >
| > | > |
| > | >
| > |
| >
|
 
he just posted it above your message

Peter van Rees said:
Hi Sergey,

Is there any progress on the workaround yet? I am about to release my
application, and it is vital to me it is compatible with sp2 (because
I cannot control who installs the sp and how does not)

I am not familiar with the gif format either, so a ready made solution
would come in very, very handy.

Thanks,

Peter


(e-mail address removed) (Serg Kuryata [MS]) wrote in message
Hi Elisa,

I totally understand that it is not always possible to turn off
transparency manually (like in case with a web browser). What I suggest is
to turn it off programmatically. Gif files that are transparent have a bit
in their data that is set to "1" to indicate that there is a transparent
color. We can try to set that bit to 0 in order to turn off transparency.
I'm not really familiar with gif format but, if this problem is very
critical for you and you can give me a few days, I can look into gif format
and provide you with some sample code that will turn off transparency of a
given gif file. Please let me know if you need this.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Elisa <[email protected]>
| Reply-To: (e-mail address removed)
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| X-Accept-Language: en-us, en, nl-be, nl
| MIME-Version: 1.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| In-Reply-To: <[email protected]>
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Lines: 305
| Message-ID: <C6IUb.1098$%[email protected]>
| Date: Fri, 06 Feb 2004 08:19:46 GMT
| NNTP-Posting-Host: 213.224.63.96
| X-Complaints-To: (e-mail address removed)
| X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06 Feb 2004
09:19:46 MET)
| NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| Organization: Telenet Internet
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
enet-ops.be.POSTED!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45082
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Serg,
|
| Thanks for spending some time on this issue. I really appreciate it!
|
| Turning of transparancy is not always a possibility, no. Imagine a
| scenario where you would want to write a sort of web browser, you'd have
| to ask every webmaster to create a seperate set of images for Pocket
| PC's ;-)
|
|
| Regards,
|
| Elisa
|
| ----------
|
| Serg Kuryata [MS] wrote:
| > Hi Elisa,
| >
| > I think I found what caused this problem. Unfortunately, there is no
easy
| > workaround but I'll try to help you find one. So, here is description
of
| > the problem.
| >
| > The problem is due to the fact the gif file that you gave me has a
| > transparent background. The color that represents the transparent color
in
| > this image is (252, 2, 252). If the image did not have transparency,
you
| > would have never run into this problem (you would be able to use the
left
| > top pixel to specify the transparent color for your needs without any
| > problems).
| >
| > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll
belongs
| > to the operating system) to work with images. As you may know, Windows
CE
| > does not support transparent images and because of this fact, when
| > imgdcmp.dll loads a transparent image, it replaces the transparent
color
| > with the White color. But, due to some circumstances, probably due to a
bug
| > (I'm not sure about this), the RGB value of the White color that is
used by
| > imgdcmp.dll is (248, 248, 240) while RGB of the real white color on a
16
| > bits color device is (248, 248, 248). As a result, all transparent
pixels
| > are replaced with pixels that have color (248, 248, 240) and that's why
| > everything worked fine for you when you used v1 and SP1.
| >
| > After SP1, our team was forced to switch to a newer dll (imaging.dll)
to
| > work with images. This dll also replaces the transparent color with the
| > White color but unlike imgdcmp.dll it uses the correct RGB value (248,
248,
| > 248). As a result, when you query color of the left top pixel of the
image
| > on SP1, you get (248, 248, 240), which is not a real White, but on SP2
you
| > get (248, 248, 248), which is a real white.
| >
| > The only workaround that I see here is to turn off transparency of the
| > image. As I understood, you cannot edit your images, so if you could
give
| > me a few days, I would try to provide you with some code that would
turn
| > off transparency programmatically.
| >
| > Thank you,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 193
| > | Message-ID: <[email protected]>
| > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05 Feb
2004
09:56:43 MET)
| > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > enet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44939
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Serg,
| > |
| > | You can download a simple project exhibiting the mentioned behaviour
here:
| > |
| > | http://www.teutenhof.be/ImageBug.zip
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ---------
| > |
| > | Serg Kuryata [MS] wrote:
| > |
| > | > Elisa,
| > | >
| > | > If you could post a simple project that has all necessary code (so
I'd
just
| > | > need to hit F5 to run it) I would greatly appreciate it. It would
help
a
| > | > lot to narrow the problem down. If you cannot do it, please could
you
at
| > | > least post the image that causes the problem?
| > | >
| > | > Thank you,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
<[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 127
| > | > | Message-ID: <[email protected]>
| > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed, 04
Feb
2004
10:37:15 MET)
| > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | >
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | >
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44804
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Here's some quick sample code:
| > | > |
| > | > | -----
| > | > |
| > | > | Public Class TransparentImageControl
| > | > | Inherits Control
| > | > |
| > | > | Public _img As Image
| > | > | Private _bmpOffscreen As Bitmap
| > | > |
| > | > | Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
| > | > |
| > | > | Dim gxOff As Graphics
| > | > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > | > |
| > | > | If _bmpOffscreen Is Nothing Then
| > | > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | > | Me.ClientSize.Height)
| > | > | End If
| > | > |
| > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | gxOff.Clear(Parent.BackColor)
| > | > |
| > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | GetUpperLeftPixelColor(_img))
| > | > |
| > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32), 0, 0,
32,
| > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > |
| > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > |
| > | > | MyBase.OnPaint(e)
| > | > |
| > | > | End Sub
| > | > |
| > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
PaintEventArgs)
| > | > |
| > | > | ' Prevents flicker
| > | > |
| > | > | End Sub
| > | > |
| > | > | Private Function GetUpperLeftPixelColor(ByVal img As Image)
As
Color
| > | > |
| > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > |
| > | > | Return bmp.GetPixel(0, 0)
| > | > |
| > | > | End Function
| > | > |
| > | > | -----
| > | > |
| > | > | Some info about the problem:
| > | > |
| > | > | - it appeared after installing SP2.
| > | > | - the images in question are GIF files.
| > | > | - beside the color in the upper-left corner of the image, it also
| > | > | interprets everything closely resembling white (RGB 255/255/255)
as
| > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > |
| > | > | If you need any additional info, just yell. I'd really like this
resolved!
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ------
| > | > |
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > |
| > | > | > Hello Elisa,
| > | > | >
| > | > | > Please could you post a simple application that reproduces the
problem?
| > | > | >
| > | > | > Thank you in advance,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 17
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075712529 213.224.63.96 (Mon,
02
Feb
2004
10:02:09 MET)
| > | > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | > | >
| > | >
| >
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | > | >
| > | >
| >
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > | > l
| > | > | > | Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:44559
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Hi,
| > | > | > |
| > | > | > | I just installed SP2 and think I found a bug:
| > | > | > |
| > | > | > | If have a custom-drawn button that can display an image
(hands up
| > | > | > | everyone that think MS made a big mistake not including that
in
the
| > | > | > | Compact Framework itself!).
| > | > | > |
| > | > | > | As taken from the FAQ, and as used in an example on the
GotDotNet
| > | > | > | website, I use the Image Attributes to specify a transparent
color.
But
| > | > | > | with SP2, it not only makes the color I specify transparent,
it
also
| > | > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | >
| > | > |
| > | >
| > |
| >
|
 
Hi sergey,

I am using google groups, and there your message did not arrive yet, so you
can forget my last post. I'll test the code and post my findings.

Thanks,

Peter
Serg Kuryata said:
Here is the sample that I promised to you. Unfortunately, I did not have a
chance to test it thoroughly but it worked fine with the gif file that you
gave me and with a few other gif files that I had.

The sample is written in C#. If you need it in VB, it should not be a
problem for you to convert it because the code is quite simple.

Please let me know if it works for you. Hope this helps.
Best regards,
Sergiy.

P.S. This problem with transparent images should not reproduce on Pocket PC
2002 because PPC2002 does not have imaging.dll and, as a result, SP2 falls
back to use the old imgdcmp.dll.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: (e-mail address removed) (Peter van Rees)
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| Date: 7 Feb 2004 00:40:59 -0800
| Organization: http://groups.google.com
| Lines: 413
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<C6IUb.1098$%[email protected]>
<[email protected]>
| NNTP-Posting-Host: 82.151.32.134
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1076143259 32755 127.0.0.1 (7 Feb 2004
08:40:59 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Sat, 7 Feb 2004 08:40:59 +0000 (UTC)
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
stnews1.google.com!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45182
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Sergiy,
|
| thanks for looking into this problem. If Elisa is not interested in a
| workaround it... I am! So if you can provide it, you would make me a
| happy person. (see my problem described a few posts earlier)
|
| Thanks,
|
| Peter
|
| (e-mail address removed) (Serg Kuryata [MS]) wrote in message
| > Hi Elisa,
| >
| > I totally understand that it is not always possible to turn off
| > transparency manually (like in case with a web browser). What I suggest
is
| > to turn it off programmatically. Gif files that are transparent have a
bit
| > in their data that is set to "1" to indicate that there is a
transparent
| > color. We can try to set that bit to 0 in order to turn off
transparency.
| > I'm not really familiar with gif format but, if this problem is very
| > critical for you and you can give me a few days, I can look into gif
format
| > and provide you with some sample code that will turn off transparency
of a
| > given gif file. Please let me know if you need this.
| >
| > Best regards,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
| > Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 305
| > | Message-ID: <C6IUb.1098$%[email protected]>
| > | Date: Fri, 06 Feb 2004 08:19:46 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06 Feb
2004
| > 09:19:46 MET)
| > | NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
| >
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
| > enet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:45082
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Serg,
| > |
| > | Thanks for spending some time on this issue. I really appreciate it!
| > |
| > | Turning of transparancy is not always a possibility, no. Imagine a
| > | scenario where you would want to write a sort of web browser, you'd
have
| > | to ask every webmaster to create a seperate set of images for Pocket
| > | PC's ;-)
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ----------
| > |
| > | Serg Kuryata [MS] wrote:
| > | > Hi Elisa,
| > | >
| > | > I think I found what caused this problem. Unfortunately, there is
no
| > easy
| > | > workaround but I'll try to help you find one. So, here is
description
| > of
| > | > the problem.
| > | >
| > | > The problem is due to the fact the gif file that you gave me has a
| > | > transparent background. The color that represents the transparent
color
| > in
| > | > this image is (252, 2, 252). If the image did not have
transparency,
| > you
| > | > would have never run into this problem (you would be able to use
the
| > left
| > | > top pixel to specify the transparent color for your needs without
any
| > | > problems).
| > | >
| > | > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll
| > belongs
| > | > to the operating system) to work with images. As you may know,
Windows
| > CE
| > | > does not support transparent images and because of this fact, when
| > | > imgdcmp.dll loads a transparent image, it replaces the transparent
| > color
| > | > with the White color. But, due to some circumstances, probably due
to a
| > bug
| > | > (I'm not sure about this), the RGB value of the White color that is
| > used by
| > | > imgdcmp.dll is (248, 248, 240) while RGB of the real white color on
a
| > 16
| > | > bits color device is (248, 248, 248). As a result, all transparent
| > pixels
| > | > are replaced with pixels that have color (248, 248, 240) and that's
why
| > | > everything worked fine for you when you used v1 and SP1.
| > | >
| > | > After SP1, our team was forced to switch to a newer dll
(imaging.dll)
| > to
| > | > work with images. This dll also replaces the transparent color with
the
| > | > White color but unlike imgdcmp.dll it uses the correct RGB value
(248,
| > 248,
| > | > 248). As a result, when you query color of the left top pixel of
the
| > image
| > | > on SP1, you get (248, 248, 240), which is not a real White, but on
SP2
| > you
| > | > get (248, 248, 248), which is a real white.
| > | >
| > | > The only workaround that I see here is to turn off transparency of
the
| > | > image. As I understood, you cannot edit your images, so if you
could
| > give
| > | > me a few days, I would try to provide you with some code that would
| > turn
| > | > off transparency programmatically.
| > | >
| > | > Thank you,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
| > Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 193
| > | > | Message-ID: <[email protected]>
| > | > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05
Feb
| > 2004
| > 09:56:43 MET)
| > | > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | >
| >
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > | > enet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44939
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi Serg,
| > | > |
| > | > | You can download a simple project exhibiting the mentioned
behaviour
| > here:
| > | > |
| > | > | http://www.teutenhof.be/ImageBug.zip
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ---------
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > |
| > | > | > Elisa,
| > | > | >
| > | > | > If you could post a simple project that has all necessary code
(so
| > I'd
| > just
| > | > | > need to hit F5 to run it) I would greatly appreciate it. It
would
| > help
| > a
| > | > | > lot to narrow the problem down. If you cannot do it, please
could
| > you
| > at
| > | > | > least post the image that causes the problem?
| > | > | >
| > | > | > Thank you,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
| > rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
| > rv:1.6)
| > Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | > | References: <[email protected]>
| > <[email protected]>
| > | > | > | In-Reply-To: <[email protected]>
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 127
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed,
04
| > Feb
| > 2004
| > 10:37:15 MET)
| > | > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | > | >
| > | >
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | > | >
| > | >
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44804
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Here's some quick sample code:
| > | > | > |
| > | > | > | -----
| > | > | > |
| > | > | > | Public Class TransparentImageControl
| > | > | > | Inherits Control
| > | > | > |
| > | > | > | Public _img As Image
| > | > | > | Private _bmpOffscreen As Bitmap
| > | > | > |
| > | > | > | Protected Overrides Sub OnPaint(ByVal e As
PaintEventArgs)
| > | > | > |
| > | > | > | Dim gxOff As Graphics
| > | > | > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > | > | > |
| > | > | > | If _bmpOffscreen Is Nothing Then
| > | > | > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | > | > | Me.ClientSize.Height)
| > | > | > | End If
| > | > | > |
| > | > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | > | gxOff.Clear(Parent.BackColor)
| > | > | > |
| > | > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | > | GetUpperLeftPixelColor(_img))
| > | > | > |
| > | > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32),
0, 0,
| > 32,
| > | > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > | > |
| > | > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > | > |
| > | > | > | MyBase.OnPaint(e)
| > | > | > |
| > | > | > | End Sub
| > | > | > |
| > | > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
| > PaintEventArgs)
| > | > | > |
| > | > | > | ' Prevents flicker
| > | > | > |
| > | > | > | End Sub
| > | > | > |
| > | > | > | Private Function GetUpperLeftPixelColor(ByVal img As
Image)
| > As
| > Color
| > | > | > |
| > | > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > | > |
| > | > | > | Return bmp.GetPixel(0, 0)
| > | > | > |
| > | > | > | End Function
| > | > | > |
| > | > | > | -----
| > | > | > |
| > | > | > | Some info about the problem:
| > | > | > |
| > | > | > | - it appeared after installing SP2.
| > | > | > | - the images in question are GIF files.
| > | > | > | - beside the color in the upper-left corner of the image, it
also
| > | > | > | interprets everything closely resembling white (RGB
255/255/255)
| > as
| > | > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > | > |
| > | > | > | If you need any additional info, just yell. I'd really like
this
| > resolved!
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | > | ------
| > | > | > |
| > | > | > |
| > | > | > | Serg Kuryata [MS] wrote:
| > | > | > |
| > | > | > | > Hello Elisa,
| > | > | > | >
| > | > | > | > Please could you post a simple application that reproduces
the
| > problem?
| > | > | > | >
| > | > | > | > Thank you in advance,
| > | > | > | > Sergiy.
| > | > | > | >
| > | > | > | > This posting is provided "AS IS" with no warranties, and
| > confers no
| > rights.
| > | > | > | > --------------------
| > | > | > | > | From: Elisa <[email protected]>
| > | > | > | > | Reply-To: (e-mail address removed)
| > | > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US;
| > rv:1.6)
| > Gecko/20040113
| > | > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | > | MIME-Version: 1.0
| > | > | > | > | Newsgroups:
microsoft.public.dotnet.framework.compactframework
| > | > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | > | Lines: 17
| > | > | > | > | Message-ID:
 
Sergey,

I converted your code to VB for the case of loading gifs from disk, and all
works fine now, with eiter sp1 or sp2. Also the loading speed seems not te
be affected (I load quite an array of gifs)

Thanks!

Peter

If anyone is interested in the VB code drop me an email at petervanrees
AT hotmail DOT com


Serg Kuryata said:
Here is the sample that I promised to you. Unfortunately, I did not have a
chance to test it thoroughly but it worked fine with the gif file that you
gave me and with a few other gif files that I had.

The sample is written in C#. If you need it in VB, it should not be a
problem for you to convert it because the code is quite simple.

Please let me know if it works for you. Hope this helps.
Best regards,
Sergiy.

P.S. This problem with transparent images should not reproduce on Pocket PC
2002 because PPC2002 does not have imaging.dll and, as a result, SP2 falls
back to use the old imgdcmp.dll.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: (e-mail address removed) (Peter van Rees)
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Re: SP2 and transparent bitmaps
| Date: 7 Feb 2004 00:40:59 -0800
| Organization: http://groups.google.com
| Lines: 413
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<C6IUb.1098$%[email protected]>
<[email protected]>
| NNTP-Posting-Host: 82.151.32.134
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1076143259 32755 127.0.0.1 (7 Feb 2004
08:40:59 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Sat, 7 Feb 2004 08:40:59 +0000 (UTC)
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
stnews1.google.com!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45182
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi Sergiy,
|
| thanks for looking into this problem. If Elisa is not interested in a
| workaround it... I am! So if you can provide it, you would make me a
| happy person. (see my problem described a few posts earlier)
|
| Thanks,
|
| Peter
|
| (e-mail address removed) (Serg Kuryata [MS]) wrote in message
| > Hi Elisa,
| >
| > I totally understand that it is not always possible to turn off
| > transparency manually (like in case with a web browser). What I suggest
is
| > to turn it off programmatically. Gif files that are transparent have a
bit
| > in their data that is set to "1" to indicate that there is a
transparent
| > color. We can try to set that bit to 0 in order to turn off
transparency.
| > I'm not really familiar with gif format but, if this problem is very
| > critical for you and you can give me a few days, I can look into gif
format
| > and provide you with some sample code that will turn off transparency
of a
| > given gif file. Please let me know if you need this.
| >
| > Best regards,
| > Sergiy.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| > | From: Elisa <[email protected]>
| > | Reply-To: (e-mail address removed)
| > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6)
| > Gecko/20040113
| > | X-Accept-Language: en-us, en, nl-be, nl
| > | MIME-Version: 1.0
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | In-Reply-To: <[email protected]>
| > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Lines: 305
| > | Message-ID: <C6IUb.1098$%[email protected]>
| > | Date: Fri, 06 Feb 2004 08:19:46 GMT
| > | NNTP-Posting-Host: 213.224.63.96
| > | X-Complaints-To: (e-mail address removed)
| > | X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06 Feb
2004
| > 09:19:46 MET)
| > | NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| > | Organization: Telenet Internet
| > | Path:
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
| >
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
| > enet-ops.be.POSTED!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:45082
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Serg,
| > |
| > | Thanks for spending some time on this issue. I really appreciate it!
| > |
| > | Turning of transparancy is not always a possibility, no. Imagine a
| > | scenario where you would want to write a sort of web browser, you'd
have
| > | to ask every webmaster to create a seperate set of images for Pocket
| > | PC's ;-)
| > |
| > |
| > | Regards,
| > |
| > | Elisa
| > |
| > | ----------
| > |
| > | Serg Kuryata [MS] wrote:
| > | > Hi Elisa,
| > | >
| > | > I think I found what caused this problem. Unfortunately, there is
no
| > easy
| > | > workaround but I'll try to help you find one. So, here is
description
| > of
| > | > the problem.
| > | >
| > | > The problem is due to the fact the gif file that you gave me has a
| > | > transparent background. The color that represents the transparent
color
| > in
| > | > this image is (252, 2, 252). If the image did not have
transparency,
| > you
| > | > would have never run into this problem (you would be able to use
the
| > left
| > | > top pixel to specify the transparent color for your needs without
any
| > | > problems).
| > | >
| > | > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this dll
| > belongs
| > | > to the operating system) to work with images. As you may know,
Windows
| > CE
| > | > does not support transparent images and because of this fact, when
| > | > imgdcmp.dll loads a transparent image, it replaces the transparent
| > color
| > | > with the White color. But, due to some circumstances, probably due
to a
| > bug
| > | > (I'm not sure about this), the RGB value of the White color that is
| > used by
| > | > imgdcmp.dll is (248, 248, 240) while RGB of the real white color on
a
| > 16
| > | > bits color device is (248, 248, 248). As a result, all transparent
| > pixels
| > | > are replaced with pixels that have color (248, 248, 240) and that's
why
| > | > everything worked fine for you when you used v1 and SP1.
| > | >
| > | > After SP1, our team was forced to switch to a newer dll
(imaging.dll)
| > to
| > | > work with images. This dll also replaces the transparent color with
the
| > | > White color but unlike imgdcmp.dll it uses the correct RGB value
(248,
| > 248,
| > | > 248). As a result, when you query color of the left top pixel of
the
| > image
| > | > on SP1, you get (248, 248, 240), which is not a real White, but on
SP2
| > you
| > | > get (248, 248, 248), which is a real white.
| > | >
| > | > The only workaround that I see here is to turn off transparency of
the
| > | > image. As I understood, you cannot edit your images, so if you
could
| > give
| > | > me a few days, I would try to provide you with some code that would
| > turn
| > | > off transparency programmatically.
| > | >
| > | > Thank you,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
| > Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 193
| > | > | Message-ID: <[email protected]>
| > | > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu, 05
Feb
| > 2004
| > 09:56:43 MET)
| > | > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | >
| >
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > | > enet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44939
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi Serg,
| > | > |
| > | > | You can download a simple project exhibiting the mentioned
behaviour
| > here:
| > | > |
| > | > | http://www.teutenhof.be/ImageBug.zip
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ---------
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > |
| > | > | > Elisa,
| > | > | >
| > | > | > If you could post a simple project that has all necessary code
(so
| > I'd
| > just
| > | > | > need to hit F5 to run it) I would greatly appreciate it. It
would
| > help
| > a
| > | > | > lot to narrow the problem down. If you cannot do it, please
could
| > you
| > at
| > | > | > least post the image that causes the problem?
| > | > | >
| > | > | > Thank you,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and
confers no
| > rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
| > rv:1.6)
| > Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | > | References: <[email protected]>
| > <[email protected]>
| > | > | > | In-Reply-To: <[email protected]>
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 127
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96 (Wed,
04
| > Feb
| > 2004
| > 10:37:15 MET)
| > | > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | > | >
| > | >
| >
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | > | >
| > | >
| >
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:44804
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Here's some quick sample code:
| > | > | > |
| > | > | > | -----
| > | > | > |
| > | > | > | Public Class TransparentImageControl
| > | > | > | Inherits Control
| > | > | > |
| > | > | > | Public _img As Image
| > | > | > | Private _bmpOffscreen As Bitmap
| > | > | > |
| > | > | > | Protected Overrides Sub OnPaint(ByVal e As
PaintEventArgs)
| > | > | > |
| > | > | > | Dim gxOff As Graphics
| > | > | > | Dim imgAttr As ImageAttributes = New ImageAttributes
| > | > | > |
| > | > | > | If _bmpOffscreen Is Nothing Then
| > | > | > | _bmpOffscreen = New Bitmap(Me.ClientSize.Width,
| > | > | > | Me.ClientSize.Height)
| > | > | > | End If
| > | > | > |
| > | > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | > | gxOff.Clear(Parent.BackColor)
| > | > | > |
| > | > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | > | GetUpperLeftPixelColor(_img))
| > | > | > |
| > | > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32, 32),
0, 0,
| > 32,
| > | > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > | > |
| > | > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > | > |
| > | > | > | MyBase.OnPaint(e)
| > | > | > |
| > | > | > | End Sub
| > | > | > |
| > | > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
| > PaintEventArgs)
| > | > | > |
| > | > | > | ' Prevents flicker
| > | > | > |
| > | > | > | End Sub
| > | > | > |
| > | > | > | Private Function GetUpperLeftPixelColor(ByVal img As
Image)
| > As
| > Color
| > | > | > |
| > | > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > | > |
| > | > | > | Return bmp.GetPixel(0, 0)
| > | > | > |
| > | > | > | End Function
| > | > | > |
| > | > | > | -----
| > | > | > |
| > | > | > | Some info about the problem:
| > | > | > |
| > | > | > | - it appeared after installing SP2.
| > | > | > | - the images in question are GIF files.
| > | > | > | - beside the color in the upper-left corner of the image, it
also
| > | > | > | interprets everything closely resembling white (RGB
255/255/255)
| > as
| > | > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > | > |
| > | > | > | If you need any additional info, just yell. I'd really like
this
| > resolved!
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | > | ------
| > | > | > |
| > | > | > |
| > | > | > | Serg Kuryata [MS] wrote:
| > | > | > |
| > | > | > | > Hello Elisa,
| > | > | > | >
| > | > | > | > Please could you post a simple application that reproduces
the
| > problem?
| > | > | > | >
| > | > | > | > Thank you in advance,
| > | > | > | > Sergiy.
| > | > | > | >
| > | > | > | > This posting is provided "AS IS" with no warranties, and
| > confers no
| > rights.
| > | > | > | > --------------------
| > | > | > | > | From: Elisa <[email protected]>
| > | > | > | > | Reply-To: (e-mail address removed)
| > | > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US;
| > rv:1.6)
| > Gecko/20040113
| > | > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | > | MIME-Version: 1.0
| > | > | > | > | Newsgroups:
microsoft.public.dotnet.framework.compactframework
| > | > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | > | Lines: 17
| > | > | > | > | Message-ID:
 
Hi Peter,

I'm glad to hear that it works for you. As you stated, performance should
not be affected very much because data from a file is loaded anyway (either
by the Bitmap's constructor or explicitly by your application) and the
modifications that are performed on the loaded data are quite simple.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Peter van Rees" <petervanreesREPLACEWITHAThotmail.com>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<C6IUb.1098$%[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: SP2 and transparent bitmaps
| Date: Tue, 17 Feb 2004 10:13:26 +0100
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Lines: 568
| Message-ID: <[email protected]>
| Organization: Kabeltex Nederland
| X-Complaints-To: (e-mail address removed)
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!newsfeed.freenet.de!fr.ip.ndsoftware.net!63.218.45
11.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!post01.iad01.newshos
ting.com!news.texel.com!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45916
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Sergey,
|
| I converted your code to VB for the case of loading gifs from disk, and
all
| works fine now, with eiter sp1 or sp2. Also the loading speed seems not te
| be affected (I load quite an array of gifs)
|
| Thanks!
|
| Peter
|
| If anyone is interested in the VB code drop me an email at
petervanrees
| AT hotmail DOT com
|
|
| "Serg Kuryata [MS]" <[email protected]> schreef in bericht
| | > Here is the sample that I promised to you. Unfortunately, I did not
have a
| > chance to test it thoroughly but it worked fine with the gif file that
you
| > gave me and with a few other gif files that I had.
| >
| > The sample is written in C#. If you need it in VB, it should not be a
| > problem for you to convert it because the code is quite simple.
| >
| > Please let me know if it works for you. Hope this helps.
| > Best regards,
| > Sergiy.
| >
| > P.S. This problem with transparent images should not reproduce on Pocket
| PC
| > 2002 because PPC2002 does not have imaging.dll and, as a result, SP2
falls
| > back to use the old imgdcmp.dll.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > --------------------
| > | From: (e-mail address removed) (Peter van Rees)
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | Subject: Re: SP2 and transparent bitmaps
| > | Date: 7 Feb 2004 00:40:59 -0800
| > | Organization: http://groups.google.com
| > | Lines: 413
| > | Message-ID: <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <C6IUb.1098$%[email protected]>
| > <[email protected]>
| > | NNTP-Posting-Host: 82.151.32.134
| > | Content-Type: text/plain; charset=ISO-8859-1
| > | Content-Transfer-Encoding: 8bit
| > | X-Trace: posting.google.com 1076143259 32755 127.0.0.1 (7 Feb 2004
| > 08:40:59 GMT)
| > | X-Complaints-To: (e-mail address removed)
| > | NNTP-Posting-Date: Sat, 7 Feb 2004 08:40:59 +0000 (UTC)
| > | Path:
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| >
|
l.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!po
| > stnews1.google.com!not-for-mail
| > | Xref: cpmsftngxa07.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:45182
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi Sergiy,
| > |
| > | thanks for looking into this problem. If Elisa is not interested in a
| > | workaround it... I am! So if you can provide it, you would make me a
| > | happy person. (see my problem described a few posts earlier)
| > |
| > | Thanks,
| > |
| > | Peter
| > |
| > | (e-mail address removed) (Serg Kuryata [MS]) wrote in message
| > | > | > Hi Elisa,
| > | >
| > | > I totally understand that it is not always possible to turn off
| > | > transparency manually (like in case with a web browser). What I
| suggest
| > is
| > | > to turn it off programmatically. Gif files that are transparent
have a
| > bit
| > | > in their data that is set to "1" to indicate that there is a
| > transparent
| > | > color. We can try to set that bit to 0 in order to turn off
| > transparency.
| > | > I'm not really familiar with gif format but, if this problem is very
| > | > critical for you and you can give me a few days, I can look into gif
| > format
| > | > and provide you with some sample code that will turn off
transparency
| > of a
| > | > given gif file. Please let me know if you need this.
| > | >
| > | > Best regards,
| > | > Sergiy.
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | > --------------------
| > | > | From: Elisa <[email protected]>
| > | > | Reply-To: (e-mail address removed)
| > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.6)
|
| > | > Gecko/20040113
| > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | MIME-Version: 1.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | In-Reply-To: <[email protected]>
| > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Lines: 305
| > | > | Message-ID: <C6IUb.1098$%[email protected]>
| > | > | Date: Fri, 06 Feb 2004 08:19:46 GMT
| > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | X-Complaints-To: (e-mail address removed)
| > | > | X-Trace: phobos.telenet-ops.be 1076055586 213.224.63.96 (Fri, 06
Feb
| > 2004
| > | > 09:19:46 MET)
| > | > | NNTP-Posting-Date: Fri, 06 Feb 2004 09:19:46 MET
| > | > | Organization: Telenet Internet
| > | > | Path:
| > | >
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | >
| >
|
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!switch.ch!ec
| > | >
| >
|
ngs!feeder.ecngs.de!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.tel
| > | > enet-ops.be.POSTED!not-for-mail
| > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:45082
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi Serg,
| > | > |
| > | > | Thanks for spending some time on this issue. I really appreciate
it!
| > | > |
| > | > | Turning of transparancy is not always a possibility, no. Imagine a
| > | > | scenario where you would want to write a sort of web browser,
you'd
| > have
| > | > | to ask every webmaster to create a seperate set of images for
Pocket
| > | > | PC's ;-)
| > | > |
| > | > |
| > | > | Regards,
| > | > |
| > | > | Elisa
| > | > |
| > | > | ----------
| > | > |
| > | > | Serg Kuryata [MS] wrote:
| > | > | > Hi Elisa,
| > | > | >
| > | > | > I think I found what caused this problem. Unfortunately, there
is
| > no
| > | > easy
| > | > | > workaround but I'll try to help you find one. So, here is
| > description
| > | > of
| > | > | > the problem.
| > | > | >
| > | > | > The problem is due to the fact the gif file that you gave me
has a
| > | > | > transparent background. The color that represents the
transparent
| > color
| > | > in
| > | > | > this image is (252, 2, 252). If the image did not have
| > transparency,
| > | > you
| > | > | > would have never run into this problem (you would be able to use
| > the
| > | > left
| > | > | > top pixel to specify the transparent color for your needs
without
| > any
| > | > | > problems).
| > | > | >
| > | > | > In v1 and SP1 the .NET Compact Framework used imgdcmp.dll (this
| dll
| > | > belongs
| > | > | > to the operating system) to work with images. As you may know,
| > Windows
| > | > CE
| > | > | > does not support transparent images and because of this fact,
when
| > | > | > imgdcmp.dll loads a transparent image, it replaces the
transparent
| > | > color
| > | > | > with the White color. But, due to some circumstances, probably
due
| > to a
| > | > bug
| > | > | > (I'm not sure about this), the RGB value of the White color that
| is
| > | > used by
| > | > | > imgdcmp.dll is (248, 248, 240) while RGB of the real white color
| on
| > a
| > | > 16
| > | > | > bits color device is (248, 248, 248). As a result, all
transparent
| > | > pixels
| > | > | > are replaced with pixels that have color (248, 248, 240) and
| that's
| > why
| > | > | > everything worked fine for you when you used v1 and SP1.
| > | > | >
| > | > | > After SP1, our team was forced to switch to a newer dll
| > (imaging.dll)
| > | > to
| > | > | > work with images. This dll also replaces the transparent color
| with
| > the
| > | > | > White color but unlike imgdcmp.dll it uses the correct RGB value
| > (248,
| > | > 248,
| > | > | > 248). As a result, when you query color of the left top pixel of
| > the
| > | > image
| > | > | > on SP1, you get (248, 248, 240), which is not a real White, but
on
| > SP2
| > | > you
| > | > | > get (248, 248, 248), which is a real white.
| > | > | >
| > | > | > The only workaround that I see here is to turn off transparency
of
| > the
| > | > | > image. As I understood, you cannot edit your images, so if you
| > could
| > | > give
| > | > | > me a few days, I would try to provide you with some code that
| would
| > | > turn
| > | > | > off transparency programmatically.
| > | > | >
| > | > | > Thank you,
| > | > | > Sergiy.
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and confers
| no
| > | > rights.
| > | > | > --------------------
| > | > | > | From: Elisa <[email protected]>
| > | > | > | Reply-To: (e-mail address removed)
| > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
| > rv:1.6)
| > | > Gecko/20040113
| > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | MIME-Version: 1.0
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | > | References: <[email protected]>
| > | > | > <[email protected]>
| > | > | > <[email protected]>
| > | > | > <[email protected]>
| > | > | > | In-Reply-To: <[email protected]>
| > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | Lines: 193
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Date: Thu, 05 Feb 2004 08:56:43 GMT
| > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | X-Trace: phobos.telenet-ops.be 1075971403 213.224.63.96 (Thu,
05
| > Feb
| > | > 2004
| > | > 09:56:43 MET)
| > | > | > | NNTP-Posting-Date: Thu, 05 Feb 2004 09:56:43 MET
| > | > | > | Organization: Telenet Internet
| > | > | > | Path:
| > | > | >
| > | >
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | > | >
| > | >
| >
|
l.t-online.de!t-online.de!skynet.be!skynet.be!ossa.telenet-ops.be!phobos.tel
| > | > | > enet-ops.be.POSTED!not-for-mail
| > | > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:44939
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.compactframework
| > | > | > |
| > | > | > | Hi Serg,
| > | > | > |
| > | > | > | You can download a simple project exhibiting the mentioned
| > behaviour
| > | > here:
| > | > | > |
| > | > | > | http://www.teutenhof.be/ImageBug.zip
| > | > | > |
| > | > | > |
| > | > | > | Regards,
| > | > | > |
| > | > | > | Elisa
| > | > | > |
| > | > | > | ---------
| > | > | > |
| > | > | > | Serg Kuryata [MS] wrote:
| > | > | > |
| > | > | > | > Elisa,
| > | > | > | >
| > | > | > | > If you could post a simple project that has all necessary
code
| > (so
| > | > I'd
| > | > just
| > | > | > | > need to hit F5 to run it) I would greatly appreciate it. It
| > would
| > | > help
| > | > a
| > | > | > | > lot to narrow the problem down. If you cannot do it, please
| > could
| > | > you
| > | > at
| > | > | > | > least post the image that causes the problem?
| > | > | > | >
| > | > | > | > Thank you,
| > | > | > | > Sergiy.
| > | > | > | >
| > | > | > | > This posting is provided "AS IS" with no warranties, and
| > confers no
| > | > rights.
| > | > | > | > --------------------
| > | > | > | > | From: Elisa <[email protected]>
| > | > | > | > | Reply-To: (e-mail address removed)
| > | > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US;
| > | > rv:1.6)
| > | > Gecko/20040113
| > | > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | > | MIME-Version: 1.0
| > | > | > | > | Newsgroups:
| microsoft.public.dotnet.framework.compactframework
| > | > | > | > | Subject: Re: SP2 and transparent bitmaps
| > | > | > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > | > | > | In-Reply-To: <[email protected]>
| > | > | > | > | Content-Type: text/plain; charset=us-ascii; format=flowed
| > | > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | > | Lines: 127
| > | > | > | > | Message-ID: <[email protected]>
| > | > | > | > | Date: Wed, 04 Feb 2004 09:37:15 GMT
| > | > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | > | X-Trace: phobos.telenet-ops.be 1075887435 213.224.63.96
| (Wed,
| > 04
| > | > Feb
| > | > 2004
| > | > 10:37:15 MET)
| > | > | > | > | NNTP-Posting-Date: Wed, 04 Feb 2004 10:37:15 MET
| > | > | > | > | Organization: Telenet Internet
| > | > | > | > | Path:
| > | > | > | >
| > | > | >
| > | >
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
| > | > | > | >
| > | > | >
| > | >
| >
|
5.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-o
| > | > | > | >
| > | > | >
| > | >
| >
|
nline.de!t-online.de!newsfeed.arcor-online.net!feed1.news.be.easynet.net!oss
| > | > | > | > a.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
| > | > | > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:44804
| > | > | > | > | X-Tomcat-NG:
| > microsoft.public.dotnet.framework.compactframework
| > | > | > | > |
| > | > | > | > | Here's some quick sample code:
| > | > | > | > |
| > | > | > | > | -----
| > | > | > | > |
| > | > | > | > | Public Class TransparentImageControl
| > | > | > | > | Inherits Control
| > | > | > | > |
| > | > | > | > | Public _img As Image
| > | > | > | > | Private _bmpOffscreen As Bitmap
| > | > | > | > |
| > | > | > | > | Protected Overrides Sub OnPaint(ByVal e As
| > PaintEventArgs)
| > | > | > | > |
| > | > | > | > | Dim gxOff As Graphics
| > | > | > | > | Dim imgAttr As ImageAttributes = New
| ImageAttributes
| > | > | > | > |
| > | > | > | > | If _bmpOffscreen Is Nothing Then
| > | > | > | > | _bmpOffscreen = New
Bitmap(Me.ClientSize.Width,
| > | > | > | > | Me.ClientSize.Height)
| > | > | > | > | End If
| > | > | > | > |
| > | > | > | > | gxOff = Graphics.FromImage(_bmpOffscreen)
| > | > | > | > | gxOff.Clear(Parent.BackColor)
| > | > | > | > |
| > | > | > | > | imgAttr.SetColorKey(GetUpperLeftPixelColor(_img),
| > | > | > | > | GetUpperLeftPixelColor(_img))
| > | > | > | > |
| > | > | > | > | gxOff.DrawImage(_img, New Rectangle(0, 0, 32,
32),
| > 0, 0,
| > | > 32,
| > | > | > | > | 32, GraphicsUnit.Pixel, imgAttr)
| > | > | > | > |
| > | > | > | > | e.Graphics.DrawImage(_bmpOffscreen, 0, 0)
| > | > | > | > |
| > | > | > | > | MyBase.OnPaint(e)
| > | > | > | > |
| > | > | > | > | End Sub
| > | > | > | > |
| > | > | > | > | Protected Overrides Sub OnPaintBackground(ByVal e As
| > | > PaintEventArgs)
| > | > | > | > |
| > | > | > | > | ' Prevents flicker
| > | > | > | > |
| > | > | > | > | End Sub
| > | > | > | > |
| > | > | > | > | Private Function GetUpperLeftPixelColor(ByVal img As
| > Image)
| > | > As
| > | > Color
| > | > | > | > |
| > | > | > | > | Dim bmp As Bitmap = New Bitmap(img)
| > | > | > | > |
| > | > | > | > | Return bmp.GetPixel(0, 0)
| > | > | > | > |
| > | > | > | > | End Function
| > | > | > | > |
| > | > | > | > | -----
| > | > | > | > |
| > | > | > | > | Some info about the problem:
| > | > | > | > |
| > | > | > | > | - it appeared after installing SP2.
| > | > | > | > | - the images in question are GIF files.
| > | > | > | > | - beside the color in the upper-left corner of the image,
it
| > also
| > | > | > | > | interprets everything closely resembling white (RGB
| > 255/255/255)
| > | > as
| > | > | > | > | transparent. I tried with a value of RGB 252/254/252.
| > | > | > | > |
| > | > | > | > | If you need any additional info, just yell. I'd really
like
| > this
| > | > resolved!
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | Regards,
| > | > | > | > |
| > | > | > | > | Elisa
| > | > | > | > |
| > | > | > | > | ------
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | Serg Kuryata [MS] wrote:
| > | > | > | > |
| > | > | > | > | > Hello Elisa,
| > | > | > | > | >
| > | > | > | > | > Please could you post a simple application that
reproduces
| > the
| > | > problem?
| > | > | > | > | >
| > | > | > | > | > Thank you in advance,
| > | > | > | > | > Sergiy.
| > | > | > | > | >
| > | > | > | > | > This posting is provided "AS IS" with no warranties, and
| > | > confers no
| > | > rights.
| > | > | > | > | > --------------------
| > | > | > | > | > | From: Elisa <[email protected]>
| > | > | > | > | > | Reply-To: (e-mail address removed)
| > | > | > | > | > | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0;
| > en-US;
| > | > rv:1.6)
| > | > Gecko/20040113
| > | > | > | > | > | X-Accept-Language: en-us, en, nl-be, nl
| > | > | > | > | > | MIME-Version: 1.0
| > | > | > | > | > | Newsgroups:
| > microsoft.public.dotnet.framework.compactframework
| > | > | > | > | > | Subject: SP2 and transparent bitmaps
| > | > | > | > | > | Content-Type: text/plain; charset=us-ascii;
| format=flowed
| > | > | > | > | > | Content-Transfer-Encoding: 7bit
| > | > | > | > | > | Lines: 17
| > | > | > | > | > | Message-ID:
| <[email protected]>
| > | > | > | > | > | Date: Mon, 02 Feb 2004 09:02:09 GMT
| > | > | > | > | > | NNTP-Posting-Host: 213.224.63.96
| > | > | > | > | > | X-Complaints-To: (e-mail address removed)
| > | > | > | > | > | X-Trace: phobos.telenet-ops.be 1075712529
213.224.63.96
| > (Mon,
| > | > 02
| > | > Feb
| > | > 2004
| > | > 10:02:09 MET)
| > | > | > | > | > | NNTP-Posting-Date: Mon, 02 Feb 2004 10:02:09 MET
| > | > | > | > | > | Organization: Telenet Internet
| > | > | > | > | > | Path:
| > | > | > | > | >
| > | > | > | >
| > | > | >
| > | >
| >
|
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
| > | > | > | > | >
| > | > | > | >
| > | > | >
| > | >
| >
|
l.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.tiscali.ch!feed1.news
| > | > | > | > | >
| > | > | > | >
| > | > | >
| > | >
| >
|
be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mai
| > | > | > | > | > l
| > | > | > | > | > | Xref: cpmsftngxa07.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:44559
| > | > | > | > | > | X-Tomcat-NG:
| > | > microsoft.public.dotnet.framework.compactframework
| > | > | > | > | > |
| > | > | > | > | > | Hi,
| > | > | > | > | > |
| > | > | > | > | > | I just installed SP2 and think I found a bug:
| > | > | > | > | > |
| > | > | > | > | > | If have a custom-drawn button that can display an
image
| > | > (hands up
| > | > | > | > | > | everyone that think MS made a big mistake not
including
| > that
| > | > in
| > | > the
| > | > | > | > | > | Compact Framework itself!).
| > | > | > | > | > |
| > | > | > | > | > | As taken from the FAQ, and as used in an example on
the
| > | > GotDotNet
| > | > | > | > | > | website, I use the Image Attributes to specify a
| > transparent
| > | > color.
| > | > But
| > | > | > | > | > | with SP2, it not only makes the color I specify
| > transparent,
| > | > it
| > | > also
| > | > | > | > | > | interprets RGB 255;255;255 (white) as transparent?!
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | > | Regards,
| > | > | > | > | > |
| > | > | > | > | > | Elisa
| > | > | > | > | > |
| > | > | > | > | >
| > | > | > | > |
| > | > | > | >
| > | > | > |
| > | > | >
| > | > |
| > |
|
|
|
 
Back
Top