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

How can I implement LiveEffect with rasterization?

New Here ,
Feb 13, 2025 Feb 13, 2025

Copy link to clipboard

Copied

Hello! I am currently doing research on implementing LiveEffectPlugin in Deno (https://deno.com/) and I am strongly seeking information on LiveEffect with rasterization.

 

The LiveEffect built into Illustrator implements things like “rasterize”, “blur”, and “drop shadow” that involve rasterization processing, but I am having trouble finding examples of implementing such effects. (Even after searching through the SDK documentation, open source projects on GitHub, and other references)

 

Does anyone know how to do this?

 

The GoLiveEffect method of the plugin has been implemented so far, but the set pixels are not reflected on the screen. (To make it easier to understand the result, I have made the bonding box red.)

```

ASErr HelloWorldPlugin::GoLiveEffect(AILiveEffectGoMessage *message)

{

    ASErr error = kNoErr;

    PluginParams params;

    this->getDictionaryValues(message->parameters, params);

    

    try {

        AIArtHandle art = message->art;

   

        AIArtSet artSet;

        error = sAIArtSet->NewArtSet(&artSet); CHKERR;

        error = sAIArtSet->AddArtToArtSet(artSet, art); CHKERR;

 

        AIRasterizeSettings settings;

        settings.type = kRasterizeARGB;

        settings.resolution = 300.0;

        settings.antialiasing = 4;

        settings.options = kRasterizeOptionsNone;

        settings.preserveSpotColors = false;

       

        AIRealRect bounds;

        error = sAIRasterize->ComputeArtBounds(artSet, &bounds, false); CHKERR;

 

        AIArtHandle rasterArt;

        AIRasterRecord rasterRecord;

       

        error = sAIRasterize->Rasterize(artSet, &settings, &bounds,

                                      kPlaceAbove, art, &rasterArt, NULL); CHKERR;

        error = sAIRaster->GetRasterInfo(rasterArt, &rasterRecord); CHKERR;

        

        std::cout << rasterRecord.bounds.top << " "

            << rasterRecord.bounds.right << " "

            << rasterRecord.bounds.bottom << " "

            << rasterRecord.bounds.left << std::endl;

 

        ai::uint32 width = rasterRecord.bounds.right - rasterRecord.bounds.left;

        ai::uint32 height = rasterRecord.bounds.bottom - rasterRecord.bounds.top;

        

        AISlice artSlice = {0, 0, static_cast<ai::int32>(width), static_cast<ai::int32>(height), 0, 4};

        AISlice workSlice = artSlice;

        

        // !! THIS IS NOT WORKING (No any appearance changed) !! //

        AITile workTile;

        error = sAIRaster->GetRasterTile(rasterArt, &artSlice, &workTile, &workSlice); CHKERR;

        

        for(ai::uint32 i = 0; i < width * height * 4; i += 4) {

           static_cast<ai::uint8*>(workTile.data)[i] = 255;     // Red

           static_cast<ai::uint8*>(workTile.data)[i+1] = 0;     // Green

           static_cast<ai::uint8*>(workTile.data)[i+2] = 0;     // Blue

           static_cast<ai::uint8*>(workTile.data)[i+3] = 255;   // Alpha

        }

 

        error = sAIRaster->SetRasterTile(rasterArt, &artSlice, &workTile, &workSlice);

        delete[] static_cast<ai::uint8*>(workTile.data);

        message->art = rasterArt;

        // !! THIS IS NOT WORKING (No any appearance changed) !! //

        

        sAIArtSet->DisposeArtSet(&artSet);

    } catch (...) {

        

    }

    

    return error;

}

```

 

Regards

TOPICS
SDK

Views

91
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
Adobe
New Here ,
Mar 17, 2025 Mar 17, 2025

Copy link to clipboard

Copied

LATEST

Sorry this problem solved!

Votes

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