Click here to Skip to main content
16,018,805 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 12mins ago
mvePIEBALDconsult11hrs 12mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam7hrs 32mins ago
professionalmegaadam7hrs 32mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
pkfox5hrs 3mins ago
professionalpkfox5hrs 3mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
honey the codewitch4hrs 59mins ago
mvahoney the codewitch4hrs 59mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
pkfox4hrs 43mins ago
professionalpkfox4hrs 43mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam2hrs 17mins ago
professionalmegaadam2hrs 17mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
Rage7hrs 14mins ago
professionalRage7hrs 14mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
honey the codewitch4hrs 54mins ago
mvahoney the codewitch4hrs 54mins 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 31mins ago
professionalRage2hrs 31mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam2hrs 5mins ago
professionalmegaadam2hrs 5mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
Rage1 hr 43mins ago
professionalRage1 hr 43mins ago 
GeneralMilton Pin
Richard Andrew x6423hrs 15mins ago
professionalRichard Andrew x6423hrs 15mins ago 
GeneralRe: Milton Pin
Mike Hankey22hrs 44mins ago
mveMike Hankey22hrs 44mins ago 
GeneralRe: Milton Pin
Jeremy Falcon21hrs 12mins ago
professionalJeremy Falcon21hrs 12mins ago 
GeneralRe: Milton Pin
Mike Hankey20hrs 56mins ago
mveMike Hankey20hrs 56mins ago 
GeneralRe: Milton Pin
Jeremy Falcon18hrs 57mins ago
professionalJeremy Falcon18hrs 57mins ago 
GeneralRe: Milton Pin
Jeremy Falcon18hrs 56mins ago
professionalJeremy Falcon18hrs 56mins ago 
GeneralRe: Milton Pin
Mike Hankey18hrs 42mins ago
mveMike Hankey18hrs 42mins ago 
GeneralRe: Milton Pin
pkfox5hrs 50mins ago
professionalpkfox5hrs 50mins ago 
GeneralRe: Milton Pin
Maximilien21hrs 31mins ago
Maximilien21hrs 31mins ago 
JokeRe: Milton Pin
dandy7217hrs 6mins ago
dandy7217hrs 6mins ago 
GeneralRe: Milton Pin
theoldfool12hrs 53mins ago
professionaltheoldfool12hrs 53mins ago 
GeneralRe: Milton Pin
kmoorevs17hrs 55mins ago
kmoorevs17hrs 55mins ago 
GeneralRe: Milton Pin
Cp-Coder17hrs 30mins ago
Cp-Coder17hrs 30mins ago 
GeneralRe: Milton Pin
Roger Wright14hrs 32mins ago
professionalRoger Wright14hrs 32mins 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.