Title: RE: [UMN_MAPSERVER-USERS] Mapserver Color Binding: Blue and Green swapped (bug?)

Thanks, Milo. But I am confident that I converted my colours correctly out of MapInfo. My resulting RGB values are what they should be for the colour it should draw. Just that it draws it based on RBG. Which makes sense, looking at the code snipped that Frank supplied. It clearly uses the second value for blue, and the third for green.

Regards,

Jacob


-----Original Message-----
From: UMN MapServer Users List on behalf of Milo van der Linden
Sent: Thu 11/1/2007 14:49
To: MAPSERVER-USERS@LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Mapserver Color Binding: Blue and Green swapped (bug?)

Extra note:

MapInfo uses a large integer to describe it's internaly used colors.
Here is a C# function to convert MapInfo color code to RGB: as you can
see, the MapInfo color code is in format BGR instead of RGB.

Maybe this has to do with your problem?


 private static Color miColorCodeToRGB(Int32 miColorCode)
    {
        Int32 iRed;
        Int32 iGreen;
        Int32 iBlue;
        Int32 _miColorCode;

        try
        {
        _miColorCode = miColorCode;

        //lColor = lColor \ &H100  'divide
        //iGreen = lColor Mod &H100 'get green component

        iRed = _miColorCode % 0x100;
        _miColorCode = _miColorCode / 0x100;
        iGreen = _miColorCode % 0x100;
        _miColorCode = _miColorCode / 0x100;
        iBlue = _miColorCode % 0x100;

            Color _Color = Color.FromArgb(255,iBlue, iGreen, iRed);
          
            return _Color;
        }
        catch
        {
            return Color.Transparent;
        }

Frank Warmerdam schreef:
> Delfos, Jacob wrote:
>> Hi List
>>
>> I am trying to make use of the colour binding feature, and it
>> basically works, except... the colours are not quite right. My
>> colours do not match those in MapInfo, although I can make MapInfo
>> emulate the MapServer colours by swapping blue and green around. So
>> basically: my RGB values are interpreted by MapServer as RBG.
>>
>> This happens for polygons as well as lines (haven't tried points). My
>> data has been translated from MapInfo to PostGIS.
>>
>> I tried to lodge a bug in Trac, but it says "TICKET_CREATE privileges
>> are required to perform this operation"
>>
>> Does anyone know more about this colour problem?
>
> Jacob,
>
> With some pointers from Howard, I found this segment of code in
> bindColorAttribute() in maputil.c:
>
>     attribute->red = atoi(tokens[0]);
>     attribute->blue = atoi(tokens[1]);
>     attribute->green = atoi(tokens[2]);
>
>
> I think this is responsible.  If you are building from source, try just
> changing it to the more obvious organization.  I'd also suggest you
> file a bug in Trac on the issue we will see if there is a subtle reason
> for this, or it's just a typo.
>
> To file bugs you need an OSGeo Userid.  The pointer to get an osgeo
> userid which you can use to login with is under the title "Important
> Notice" on the http://trac.osgeo.org/mapserver page.  The same userid
> can be used for other OSGeo services like subversion, and other
> trac instances (like GDAL's).
>
> Best regards,


--


       

Milo van der Linden
skype: milovanderlinden <skype:milovanderlinden?add>
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.3dsite.nl

               

De informatie in dit bericht reflecteert mijn persoonlijke mening en
niet die van een bedrijf of instantie. Aan de informatie kunnen geen
rechten worden ontleend. Indien dit bericht onderdeel is van een forum,
mailing-list of community dan gelden automatisch de bij het betreffende
medium behorende voorwaarden. The information in this message reflects
my personal opinion and not that of a company or public body. All rights
reserved.If this message is contained in a mailing-list or community,
the rights on the medium are automatically adapted.


This email and any attachments are intended solely for the named recipient and 
are confidential. The copying or distribution of them or any information they 
contain by anyone other than the named recipient is prohibited. If you have 
received this document in error, please notify the sender and delete all copies 
from your computer system and destroy all hard copies. It is the recipient's 
responsibility to check this email and any attachments to this email for 
viruses before use.

Reply via email to