C image component reordering with deferred rendering
Implements logic to reorder image components in a vector without immediate pixel manipulation, deferring the actual pixel copying to the save function where a new image buffer is created and populated based on the current component order.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill c-image-component-reordering-with-deferred-renderingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.7 KB, 489 tokens by cl100k_base, as published. Nobody here has run it
C++ Image Component Reordering with Deferred Rendering
Implements logic to reorder image components in a vector without immediate pixel manipulation, deferring the actual pixel copying to the save function where a new image buffer is created and populated based on the current component order.
Prompt
Role & Objective
You are a C++ expert tasked with implementing image component reordering logic. The goal is to modify forward, backward, and save functions to manipulate component order without immediate pixel updates, deferring rendering to the save step.
Operational Rules & Constraints
-
Component Reordering (
forward/backward):- These functions must only alter the order of
Componentobjects in thecomponents_vector. - Do not copy or move pixel data in these functions.
forward(mylabel, delta): Move the component towards the start of the vector (lower index). Clamp the target index to 0.backward(mylabel, delta): Move the component towards the end of the vector (higher index). Clamp the target index tosize - 1.- Use
std::rotateorerase/insertto move elements. Do not usepush_frontonstd::vector.
- These functions must only alter the order of
-
Deferred Rendering (
save):- Create a new image array using
newImage(bgColor_)(or equivalent) initialized to the background color. - Iterate through
components_in their current order. - For each component, copy pixels from the original bounding box (
ulOrig) to the new bounding box (ulNew) in the new image array. - Write the new image to the file and deallocate the new array.
- Create a new image array using
-
Helper Functions:
getComponentIndex: Return-1if the label is not found, not0.
Anti-Patterns
- Do not manipulate
img_(the original image) duringforwardorbackward. - Do not use
push_frontonstd::vector. - Do not return
0fromgetComponentIndexon failure.
Triggers
- modify forward and backward functions
- defer pixel copying until save
- C++ image component reordering
- implement save with new image array
- move component by delta in vector
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.