Click here to Skip to main content
16,018,797 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Shot in the dark for any photoshop users out there Pin
PIEBALDconsult11hrs 10mins ago
mvePIEBALDconsult11hrs 10mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam7hrs 30mins ago
professionalmegaadam7hrs 30mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
pkfox5hrs 1 min ago
professionalpkfox5hrs 1 min ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
honey the codewitch4hrs 57mins ago
mvahoney the codewitch4hrs 57mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
pkfox4hrs 41mins ago
professionalpkfox4hrs 41mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam2hrs 15mins ago
professionalmegaadam2hrs 15mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
Rage7hrs 12mins ago
professionalRage7hrs 12mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
honey the codewitch4hrs 52mins ago
mvahoney the codewitch4hrs 52mins ago 
In essence:

This function works, but it uses callbacks, and does the alpha blending during the callback's destination call:

C++
static void composition_solid_source_over(const composition_params& params)
{
    uint32_t color=params.color;
    if(params.const_alpha != 255) color = BYTE_MUL(params.color, params.const_alpha);
    uint32_t ialpha = 255 - plutovg_alpha(color);
    for(int i = 0; i < params.length; i++) {
        uint32_t col;
        if(params.canvas->read_callback!=nullptr) {
            ::gfx::vector_pixel c;
            params.canvas->read_callback(::gfx::point16(params.x+i,params.y),&c,params.canvas->callback_state);
            col = color + BYTE_MUL(c.native_value, ialpha);
        } else {
            col = color;
        }
        if(params.canvas->write_callback!=nullptr) {
            params.canvas->write_callback(::gfx::rect16(params.x+i,params.y,params.x+i,params.y),::gfx::vector_pixel(col,true),params.canvas->callback_state);
        }
    }
}


This one works too, even though it could be more efficient if I updated BYTE_MUL() to handle RGBA instead of ARGB:

C++
static void direct_rgba32_composition_solid_source_over(const composition_params& params)
{
    uint32_t* dest = (uint32_t*)(((uint8_t*)params.direct_rgba32) + (params.y * params.stride)) + params.x;
    uint32_t color = params.color;
    if(params.const_alpha != 255) color = BYTE_MUL(params.color, params.const_alpha);
    uint32_t ialpha = 255 - plutovg_alpha(color);
    for(int i = 0; i < params.length; i++) {
        dest[i] = vector_to_rgba32(color + BYTE_MUL(rgba32_to_vector(dest[i]), ialpha));
    }
}


This does not:

C++
static void direct_rgb16_composition_solid_source_over(const composition_params& params)
{
    uint16_t* dest = (uint16_t*)(((uint8_t*)params.direct_rgb16) + (params.y * params.stride)) + params.x;
    uint32_t color=params.color;
    if(params.const_alpha != 255) color = BYTE_MUL(params.color, params.const_alpha);
    uint32_t ialpha = 255 - plutovg_alpha(color);
    for(int i = 0; i < params.length; i++) {
        
        uint32_t read_col=rgb16_to_vector(dest[i]);
        uint32_t col = color + BYTE_MUL(read_col, ialpha);
        dest[i]=vector_to_rgb16(col);
        
    }
}

Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix

GeneralRe: Shot in the dark for any photoshop users out there Pin
Rage2hrs 29mins ago
professionalRage2hrs 29mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam2hrs 3mins ago
professionalmegaadam2hrs 3mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
Rage1 hr 41mins ago
professionalRage1 hr 41mins ago 
GeneralMilton Pin
Richard Andrew x6423hrs 13mins ago
professionalRichard Andrew x6423hrs 13mins ago 
GeneralRe: Milton Pin
Mike Hankey22hrs 42mins ago
mveMike Hankey22hrs 42mins ago 
GeneralRe: Milton Pin
Jeremy Falcon21hrs 10mins ago
professionalJeremy Falcon21hrs 10mins ago 
GeneralRe: Milton Pin
Mike Hankey20hrs 54mins ago
mveMike Hankey20hrs 54mins ago 
GeneralRe: Milton Pin
Jeremy Falcon18hrs 55mins ago
professionalJeremy Falcon18hrs 55mins ago 
GeneralRe: Milton Pin
Jeremy Falcon18hrs 54mins ago
professionalJeremy Falcon18hrs 54mins ago 
GeneralRe: Milton Pin
Mike Hankey18hrs 40mins ago
mveMike Hankey18hrs 40mins ago 
GeneralRe: Milton Pin
pkfox5hrs 48mins ago
professionalpkfox5hrs 48mins ago 
GeneralRe: Milton Pin
Maximilien21hrs 29mins ago
Maximilien21hrs 29mins ago 
JokeRe: Milton Pin
dandy7217hrs 4mins ago
dandy7217hrs 4mins ago 
GeneralRe: Milton Pin
theoldfool12hrs 51mins ago
professionaltheoldfool12hrs 51mins ago 
GeneralRe: Milton Pin
kmoorevs17hrs 53mins ago
kmoorevs17hrs 53mins ago 
GeneralRe: Milton Pin
Cp-Coder17hrs 28mins ago
Cp-Coder17hrs 28mins ago 
GeneralRe: Milton Pin
Roger Wright14hrs 30mins ago
professionalRoger Wright14hrs 30mins ago 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.