Hey, I have problem with drawitem function, here is my code:

Drawing a rectangle function:


function ItemRectangle:draw()
self.id = drawrect(self.x, self.y, self.w, self.h);
if(self:getItemId() > 100) then
setcompositionmode(0)
self.id = drawitem(self:getItemId(), self:getX()+2.5, self:getY()+2.5, 100, math.min(math.max(1,self:getItemCount()), 100), -1)
setcompositionmode(3)
end
end


and in a script:


setfillstyle('gradient', 'linear', 2, 0, 0, 0, 36)
addgradcolors(unpack(colorItem));
for _,v in pairs(itemRects) do
v:draw();
end


it looks like:


OK, it seems good. but when I reset itemid and drawitem is not executed anymore, one of rectangles gets invisible (only border is visible):


when I set itemid back, it is still invisible:



I am confused and dont know why it behaves like this. gradient should be visible