Jump to content
Developer Wiki and Function Reference Links ×

RGB values ​​are different


shiori

Recommended Posts

Hi everybody.

 

I am setting the color to the object.

However, the set color is not reflected correctly.

 

PROCEDURE Test;
VAR
    leftTop,rightDown:POINT;
    hdl:HANDLE;

    r,g,b:LONGINT;
BEGIN
    {Create Rectangle}
    leftTop.x := 0;
    leftTop.y := 100;
    rightDown.x := 100;
    rightDown.y := 0;
    Rect(leftTop.x,leftTop.y,rightDown.x,rightDown.y);
    hdl := LNewObj;

    {Set Color (RGB(50,0,200))}
    r := ROUND(50/255*65535);
    g := ROUND(0/255*65535);
    b := ROUND(200/255*65535);
    SetFillBack(hdl,r,g,b);
END;
Run(Test);

 

The settings of the drawn object are like this.

→R:49/G:0/B:200

 

Green and blue values are correct.

But the red value is wrong.

 

What's wrong?

 

By the way, some colors are set correctly with the same code.

For example, RGB(220,220,220) and RGB(255,0,99) etc...

 

Thanks.

 

Link to comment

Thank you for your reply.

 

I tried it but no change.

{Set Color (RGB(50,0,200))}
r := ROUND(50/255*65535);
g := ROUND(0/255*65535);
b := ROUND(200/255*65535);
SetFillBack(hdl,r,g,b);

↓Change

{Set Color (RGB(50,0,200))}
r := 50*257;
g := 0*257;
b := 200*257;
SetFillBack(hdl,r,g,b);

 

 

RGBsample.png

Link to comment

Hi @shiori,

   I just tried setting the fill color of a rectangle to 50, 0, 200 using your new script snippet and I get the expected result. When I open the color palette to show Active Document Colors, the last color is the newly created color, and as you can see from the screen shot it is correct. This is using VW 2020 SP6. I also tried it in VW 2022 SP4 and it also works.

 

image.png.632de34db44841f63d690f0c36e313e8.png

 

 

   I think you are seeing a bug with the RGB Color Picker. It does not report correct values. I see you are on a PC. I am using a MAC, and I see a similar distortion in the RGB numbers when I look at the RGB slider values, and the Spectrum displays.

 

   When you select an object, open the color picker in the Attributes Palette and select the Active Document button (it's the top button at the bottom of the color window). One of the colors will be highlighted which corresponds to your selected object. Hover your cursor over that color swatch and the color values should popup in about a second. Use these values to determine your color.

 

HTH,

Raymond

 

PS - I believe this bug has been reported. If not I'll enter one tomorrow.

 

Edited by MullinRJ
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...