void iupPlot::DrawBackgroundImage(cdCanvas* canvas) const { Ihandle* image = iupImageGetHandle(mBack.GetImage()); if (image) { double theScreenMinX = mAxisX.mTrafo->Transform(mBack.mImageMinX); double theScreenMinY = mAxisY.mTrafo->Transform(mBack.mImageMinY); double theScreenMaxX = mAxisX.mTrafo->Transform(mBack.mImageMaxX); double theScreenMaxY = mAxisY.mTrafo->Transform(mBack.mImageMaxY); double theScreenW = theScreenMaxX - theScreenMinX + 1; double theScreenH = theScreenMaxY - theScreenMinY + 1; int theX = iupPlotRound(theScreenMinX); int theY = iupPlotRound(theScreenMinY); int theW = iupPlotRound(theScreenW); int theH = iupPlotRound(theScreenH); cdIupDrawImage(canvas, image, theX, theY, theW, theH, 0, mBack.mColor); } }
static int iMatrixListDrawImageCol(Ihandle *ih, ImatrixListData* mtxList, int lin, int col, int x1, int x2, int y1, int y2, cdCanvas *cnv) { char* image_name; int make_inactive = 0, itemactive, imageactive, imagevalue, showdelete, active = iupdrvIsActive(ih), linedelete; int lines_num = ih->data->lines.num; Ihandle* image; itemactive = IupGetIntId(ih, "ITEMACTIVE", lin); imageactive = IupGetIntId(ih, "IMAGEACTIVE", lin); imagevalue = IupGetIntId(ih, "IMAGEVALUE", lin); showdelete = IupGetInt(ih, "SHOWDELETE"); linedelete = IupGetIntId(ih, "LINEDELETE", lin); if (!active || !itemactive || !imageactive) make_inactive = 1; image_name = iupAttribGetId(ih, "IMAGE", lin); if (!image_name) { char* attrib_name; if (mtxList->editable) { if (lin == lines_num-1) attrib_name = "IMAGEADD"; else { if (showdelete || linedelete) attrib_name = "IMAGEDEL"; else { if (imagevalue) attrib_name = "IMAGECHECK"; else attrib_name = "IMAGEUNCHECK"; } } } else { if (imagevalue) attrib_name = "IMAGECHECK"; else attrib_name = "IMAGEUNCHECK"; } image_name = iupAttribGetStr(ih, attrib_name); /* this will check for the default values also */ } image = iupImageGetHandle(image_name); if (image) { int width = IupGetInt(image, "WIDTH"); int height = IupGetInt(image, "HEIGHT"); long bgcolor = cdIupConvertColor(IupGetAttributeId2(ih, "CELLBGCOLOR", lin, col)); /* Calc the image_name position */ int x = x2 - x1 - width; int y = y1 - y2 - 1 - height; x /= 2; x += x1; y /= 2; y += y2; cdIupDrawImage(cnv, image, x, y, 0, 0, make_inactive, bgcolor); } return IUP_DEFAULT; /* draw nothing more */ }