• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

indesign plug-in develop,how to conver rgb to cmyk?

Explorer ,
Dec 01, 2024 Dec 01, 2024

Copy link to clipboard

Copied

In InDesign plugin development, I want to perform color conversions, such as converting colors from RGB, HSB, and other color spaces to the CMYK color space. I found that the SDK provides the IColorConverter interface that can accomplish this functionality, but I haven’t figured out how to use it or how to obtain a pointer to the interface object. However, the SDK documentation and sample code do not provide any guidance or examples on this topic. Does anyone have sample code related to this?

TOPICS
SDK

Views

129

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2024 Dec 01, 2024

Copy link to clipboard

Copied

Why do you need it. WHat should it what Adobe's Colormanagement and Adobe Color Engine cannot not do? That is built in functionality in all CC Print applications.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2024 Dec 01, 2024

Copy link to clipboard

Copied

When I use the IGraphicsPort interface to draw some text, I need to display the color in the CMYK color space with C=100, M=0, Y=0, K=0. I called the color setting function g_port->setcmykcolor(1,0,0,0);, but the displayed color is incorrect. After carefully comparing the colors, I found that the displayed color is actually converted to an RGB color, and it matches R=0, G=160, B=233. So, do I also need to call the function virtual void setcolorspace(AGMColorSpace* colorSpace) = 0; to set the color space? I haven’t called this function yet. Also, I couldn’t find the definition of the AGMColorSpace parameter for this function. In the SDK, it’s always just a pointer. Where can I obtain this value?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2024 Dec 01, 2024

Copy link to clipboard

Copied

@lyj2871

 

Is your document for display or for printing?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2024 Dec 01, 2024

Copy link to clipboard

Copied

Here’s the situation: I need to use the IGraphicsPort interface to draw a piece of text and set the text color to a CMYK color.     

I created a swatch with the color values C=1, M=0, Y=0, K=0 and used InDesign's control panel to directly apply this color to a piece of text. However, when I used the IGraphicsPort interface to draw a piece of text programmatically and called g_port->setcmykcolor(1,0,0,0) to set the color, the color displayed on the screen is different from the color of the text I set earlier. Why is the displayed color inconsistent?

Snipaste_2024-12-02_01-16-53.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

On your original question: Let's look at the object model (not the scripting one). I generate such reports on my own, but you can also grep the SDK docs.

 

There is only one implementation of IColorConverter, aggregated on the kACEColorSpaceMgrBoss. The name suggests it deals with all those color spaces. Answering Willi, usage of "Adobe Color Engine" / ACE is exactly the question here. Some generic cross application engine, and associated wrapper interfaces to access them the InDesign way. Main interface should be IColorSpaceMgr. It is also a service provider, so you could get a hold via service registry, asking for kColorSpaceMgrService if there were no dedicated Utils function. Yup, see IGraphicsUtils.

 

Regarding your graphics port, there are 20+ boss classes that aggregate the interface, 5 different implementations of the interface itself if I did not miss one, and there are plenty ways to reach them. Receive a pointer during a drawing operation (draw event of a layout window, or is it a widget in a panel, some ongoing export) or did you create it yourself? The window may vary regarding preview mode, active separations preview and so forth. All of this configured in some way or the other. So the question is still open how you reach yours.

 

If this is about the composer of your other thread, IGraphicsPort is the wrong means of output. You're supposed to produce the various IWax objects. Think of a "display list". The composer is not involved in drawing. Open a document created in InDesign CS 20 years ago and the latest & greatest composer is not triggered, InDesign will instead render the wax.

 

For usage I'd myself search the SDK (how often is ColorSpace mentioned in IGraphicsPort.h, oh - Rendering Intent sounds like something), write a test plugin, construct several test cases, and if it gets tough set breakpoints and wade thru assembler code for a few days. Know your tools (Xcode, VStudio) and those provided via the SDK (headers, docs, ITK …).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

LATEST

 

Thank you for your reply. When using the IGraphicsPort interface and directly calling setcmykcolor(1, 0, 0, 0), the color displayed on the screen is indeed incorrect, but the exported PDF shows the correct color. However, when using the following two functions to set CMYK colors:

 

cpp
复制代码
virtual void setcolorspace(AGMColorSpace* colorSpace) = 0; virtual void setcolorvalues(const float* colorVals) = 0;
 

the colors rendered on the screen and in the exported PDF are both correct. I have already obtained the pointer to AGMColorSpace using IColorSystemUtils.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines