Click here to Skip to main content
16,018,650 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
PIEBALDconsult9hrs 7mins ago
mvePIEBALDconsult9hrs 7mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam5hrs 27mins ago
professionalmegaadam5hrs 27mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
pkfox2hrs 58mins ago
professionalpkfox2hrs 58mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
honey the codewitch2hrs 54mins ago
mvahoney the codewitch2hrs 54mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
pkfox2hrs 38mins ago
professionalpkfox2hrs 38mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadam12mins ago
professionalmegaadam12mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
Rage5hrs 9mins ago
professionalRage5hrs 9mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
honey the codewitch2hrs 49mins ago
mvahoney the codewitch2hrs 49mins 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
Rage26mins ago
professionalRage26mins ago 
GeneralRe: Shot in the dark for any photoshop users out there Pin
megaadamJust Posted
professionalmegaadamJust Posted 
GeneralMilton Pin
Richard Andrew x6421hrs 10mins ago
professionalRichard Andrew x6421hrs 10mins ago 
GeneralRe: Milton Pin
Mike Hankey20hrs 39mins ago
mveMike Hankey20hrs 39mins ago 
GeneralRe: Milton Pin
Jeremy Falcon19hrs 7mins ago
professionalJeremy Falcon19hrs 7mins ago 
GeneralRe: Milton Pin
Mike Hankey18hrs 51mins ago
mveMike Hankey18hrs 51mins ago 
GeneralRe: Milton Pin
Jeremy Falcon16hrs 52mins ago
professionalJeremy Falcon16hrs 52mins ago 
GeneralRe: Milton Pin
Jeremy Falcon16hrs 51mins ago
professionalJeremy Falcon16hrs 51mins ago 
GeneralRe: Milton Pin
Mike Hankey16hrs 37mins ago
mveMike Hankey16hrs 37mins ago 
GeneralRe: Milton Pin
pkfox3hrs 45mins ago
professionalpkfox3hrs 45mins ago 
GeneralRe: Milton Pin
Maximilien19hrs 26mins ago
Maximilien19hrs 26mins ago 
JokeRe: Milton Pin
dandy7215hrs 1 min ago
dandy7215hrs 1 min ago 
GeneralRe: Milton Pin
theoldfool10hrs 48mins ago
professionaltheoldfool10hrs 48mins ago 
GeneralRe: Milton Pin
kmoorevs15hrs 50mins ago
kmoorevs15hrs 50mins ago 
GeneralRe: Milton Pin
Cp-Coder15hrs 25mins ago
Cp-Coder15hrs 25mins ago 
GeneralRe: Milton Pin
Roger Wright12hrs 27mins ago
professionalRoger Wright12hrs 27mins ago 
GeneralRe: Milton Pin
pkfox3hrs 39mins ago
professionalpkfox3hrs 39mins 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.