void fillRect(SDL_Surface *surf, uint8_t grey, int x, int y, int w, int h) { fillRect(surf, x, y, w, h, grey, grey, grey); }
void fillRect (const Rectangle<int>& r, bool /*replaceExistingContents*/) { fillRect (r.toFloat()); }
void paintButton(Canvas* canvas, State, const Rect& rect, const ButtonExtraParams&) const { Color red = 0xFFFF0000; fillRect(canvas, rect, red); }
/*! * Fill the specified rectangle with color defined by "c". The dimensions * of UT_Rect are in logical units. */ void GR_Graphics::fillRect(const UT_RGBColor& c, const UT_Rect &r) { fillRect(c, r.left, r.top, r.width, r.height); }
void GfxPaint16::eraseRect(const Common::Rect &rect) { fillRect(rect, GFX_SCREEN_MASK_VISUAL, _ports->_curPort->backClr); }
void GfxPaint16::kernelGraphFillBox(const Common::Rect &rect, uint16 colorMask, int16 color, int16 priority, int16 control) { fillRect(rect, colorMask, color, priority, control); }
void Adafruit_SSD1351::fillScreen(uint16_t fillcolor) { fillRect(0, 0, SSD1351WIDTH, SSD1351HEIGHT, fillcolor); }
void GfxPaint16::clearScreen(byte color) { fillRect(_ports->_curPort->rect, GFX_SCREEN_MASK_ALL, color, 0, 0); }
void MI0283QT9::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { int16_t dx, dy, dx2, dy2, err, stepx, stepy; if(x0 >= lcd_width) { x0 = lcd_width-1; } if(x1 >= lcd_width) { x1 = lcd_width-1; } if(y0 >= lcd_height) { y0 = lcd_height-1; } if(y1 >= lcd_height) { y1 = lcd_height-1; } if((x0 == x1) || (y0 == y1)) //horizontal or vertical line { fillRect(x0, y0, x1, y1, color); } else { //calculate direction dx = x1 - x0; dy = y1 - y0; if(dx < 0) { dx = -dx; stepx = -1; } else { stepx = +1; } if(dy < 0) { dy = -dy; stepy = -1; } else { stepy = +1; } dx2 = dx << 1; dy2 = dy << 1; //draw line setArea(0, 0, lcd_width-1, lcd_height-1); drawPixel(x0, y0, color); if(dx > dy) { err = dy2 - dx; while(x0 != x1) { if(err >= 0) { y0 += stepy; err -= dx2; } x0 += stepx; err += dy2; drawPixel(x0, y0, color); } } else { err = dx2 - dy; while(y0 != y1) { if(err >= 0) { x0 += stepx; err -= dy2; } y0 += stepy; err += dx2; drawPixel(x0, y0, color); } } } return; }
void SkyQPainter::drawSkyBackground() { //FIXME use projector fillRect( 0, 0, m_size.width(), m_size.height(), KStarsData::Instance()->colorScheme()->colorNamed( "SkyColor" ) ); }
void TipsPainter::eraseRect(const QRect& rect) { setCompositionMode(QPainter::CompositionMode_Source); fillRect(rect, Qt::transparent); }
void TipsPainter::eraseRect(const int x, const int y, const int w, const int h) { setCompositionMode(QPainter::CompositionMode_Source); fillRect(x,y,w,h, Qt::transparent); }
void fillRectList (const RectangleList<float>& list) { for (const Rectangle<float>* r = list.begin(), * const e = list.end(); r != e; ++r) fillRect (*r); }
void Adafruit_GFX::fillScreen(uint16_t color) { fillRect(0, 0, _width, _height, color); }
void CSDL_Ext::fillRectBlack( SDL_Surface *dst, SDL_Rect *dstrect) { const Uint32 black = SDL_MapRGB(dst->format,0,0,0); fillRect(dst,dstrect,black); }
size_t Adafruit_GFX::write(uint8_t c) { #else void Adafruit_GFX::write(uint8_t c) { #endif if (c == '\n') { cursor_y += textsize*8; cursor_x = 0; } else if (c == '\r') { // skip em } else { drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize); cursor_x += textsize*6; if (wrap && (cursor_x > (_width - textsize*6))) { cursor_y += textsize*8; cursor_x = 0; } } #if ARDUINO >= 100 return 1; #endif } // draw a character void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size) { if((x >= _width) || // Clip right (y >= _height) || // Clip bottom ((x + 5 * size - 1) < 0) || // Clip left ((y + 8 * size - 1) < 0)) // Clip top return; for (int8_t i=0; i<6; i++ ) { uint8_t line; if (i == 5) line = 0x0; else line = pgm_read_byte(font+(c*5)+i); for (int8_t j = 0; j<8; j++) { if (line & 0x1) { if (size == 1) // default size drawPixel(x+i, y+j, color); else { // big size fillRect(x+(i*size), y+(j*size), size, size, color); } } else if (bg != color) { if (size == 1) // default size drawPixel(x+i, y+j, bg); else { // big size fillRect(x+i*size, y+j*size, size, size, bg); } } line >>= 1; } } } void Adafruit_GFX::setCursor(int16_t x, int16_t y) { cursor_x = x; cursor_y = y; }
//============================================================================== void LowLevelGraphicsPostScriptRenderer::fillRect (const Rectangle<int>& r, const bool /*replaceExistingContents*/) { fillRect (r.toFloat()); }
void GfxPaint16::invertRect(const Common::Rect &rect) { int16 oldpenmode = _ports->_curPort->penMode; _ports->_curPort->penMode = 2; fillRect(rect, GFX_SCREEN_MASK_VISUAL, _ports->_curPort->penClr, _ports->_curPort->backClr); _ports->_curPort->penMode = oldpenmode; }
void Graphics::fillAll() const { fillRect (context->getClipBounds()); }
void GfxPaint16::paintRect(const Common::Rect &rect) { fillRect(rect, GFX_SCREEN_MASK_VISUAL, _ports->_curPort->penClr); }
void fillScreen(unsigned int fillcolor) { fillRect(0, 0, SSD1351WIDTH, SSD1351HEIGHT, fillcolor); }
reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) { reg_t displayArg; TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT; int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1; bool doSaveUnder = false; Common::Rect rect; reg_t result = NULL_REG; // Make a "backup" of the port settings (required for some SCI0LATE and // SCI01+ only) Port oldPort = *_ports->getPort(); // setting defaults _ports->penMode(0); _ports->penColor(0); _ports->textGreyedOutput(false); // processing codes in argv while (argc > 0) { displayArg = argv[0]; if (displayArg.getSegment()) displayArg.setOffset(0xFFFF); argc--; argv++; switch (displayArg.getOffset()) { case SCI_DISPLAY_MOVEPEN: _ports->moveTo(argv[0].toUint16(), argv[1].toUint16()); argc -= 2; argv += 2; break; case SCI_DISPLAY_SETALIGNMENT: alignment = argv[0].toSint16(); argc--; argv++; break; case SCI_DISPLAY_SETPENCOLOR: colorPen = argv[0].toUint16(); _ports->penColor(colorPen); argc--; argv++; break; case SCI_DISPLAY_SETBACKGROUNDCOLOR: colorBack = argv[0].toUint16(); argc--; argv++; break; case SCI_DISPLAY_SETGREYEDOUTPUT: _ports->textGreyedOutput(!argv[0].isNull()); argc--; argv++; break; case SCI_DISPLAY_SETFONT: _text16->SetFont(argv[0].toUint16()); argc--; argv++; break; case SCI_DISPLAY_WIDTH: width = argv[0].toUint16(); argc--; argv++; break; case SCI_DISPLAY_SAVEUNDER: doSaveUnder = true; break; case SCI_DISPLAY_RESTOREUNDER: bitsGetRect(argv[0], &rect); rect.translate(-_ports->getPort()->left, -_ports->getPort()->top); bitsRestore(argv[0]); kernelGraphRedrawBox(rect); // finishing loop argc = 0; break; case SCI_DISPLAY_DONTSHOWBITS: bRedraw = 0; break; // The following three dummy calls are not supported by the Sierra SCI // interpreter, but are erroneously called in some game scripts. case SCI_DISPLAY_DUMMY1: // Longbow demo (all rooms) and QFG1 EGA demo (room 11) case SCI_DISPLAY_DUMMY2: // Longbow demo (all rooms) case SCI_DISPLAY_DUMMY3: // QFG1 EGA demo (room 11) and PQ2 (room 23) if (!(g_sci->getGameId() == GID_LONGBOW && g_sci->isDemo()) && !(g_sci->getGameId() == GID_QFG1 && g_sci->isDemo()) && !(g_sci->getGameId() == GID_PQ2)) error("Unknown kDisplay argument %d", displayArg.getOffset()); if (displayArg.getOffset() == SCI_DISPLAY_DUMMY2) { if (!argc) error("No parameter left for kDisplay(115)"); argc--; argv++; } break; default: SciTrackOriginReply originReply; SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply); if (solution.type == WORKAROUND_NONE) error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)", PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset); assert(solution.type == WORKAROUND_IGNORE); break; } } // now drawing the text _text16->Size(rect, text, -1, width); rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop); // Note: This code has been found in SCI1 middle and newer games. It was // previously only for SCI1 late and newer, but the LSL1 interpreter contains // this code. if (getSciVersion() >= SCI_VERSION_1_MIDDLE) { int16 leftPos = rect.right <= _screen->getWidth() ? 0 : _screen->getWidth() - rect.right; int16 topPos = rect.bottom <= _screen->getHeight() ? 0 : _screen->getHeight() - rect.bottom; _ports->move(leftPos, topPos); rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop); } if (doSaveUnder) result = bitsSave(rect, GFX_SCREEN_MASK_VISUAL); if (colorBack != -1) fillRect(rect, GFX_SCREEN_MASK_VISUAL, colorBack, 0, 0); _text16->Box(text, false, rect, alignment, -1); if (_screen->_picNotValid == 0 && bRedraw) bitsShow(rect); // restoring port and cursor pos Port *currport = _ports->getPort(); uint16 tTop = currport->curTop; uint16 tLeft = currport->curLeft; if (!g_sci->_features->usesOldGfxFunctions()) { // Restore port settings for some SCI0LATE and SCI01+ only. // // The change actually happened inbetween .530 (hoyle1) and .566 (heros // quest). We don't have any detection for that currently, so we are // using oldGfxFunctions (.502). The only games that could get // regressions because of this are hoyle1, kq4 and funseeker. If there // are regressions, we should use interpreter version (which would // require exe version detection). // // If we restore the port for whole SCI0LATE, at least sq3old will get // an issue - font 0 will get used when scanning for planets instead of // font 600 - a setfont parameter is missing in one of the kDisplay // calls in script 19. I assume this is a script bug, because it was // added in sq3new. *currport = oldPort; } currport->curTop = tTop; currport->curLeft = tLeft; return result; }
void RWS_TFTLCD_TS::clrCR(void) { fillRect(_CRstartX,_CRstartY,_CRsX,_CRsY,_CRbg); _CRscrCurrent = _CRstartX; }
/*! This function decodes some data into image changes. Returns the number of bytes consumed. */ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, int *nextFrameDelay, int *loopCount) { // We are required to state that // "The Graphics Interchange Format(c) is the Copyright property of // CompuServe Incorporated. GIF(sm) is a Service Mark property of // CompuServe Incorporated." image->detach(); int bpl = image->bytesPerLine(); unsigned char *bits = image->bits(); #define LM(l, m) (((m)<<8)|l) digress = false; const int initial = length; while (!digress && length) { length--; unsigned char ch=*buffer++; switch (state) { case Header: hold[count++]=ch; if (count==6) { // Header gif89=(hold[3]!='8' || hold[4]!='7'); state=LogicalScreenDescriptor; count=0; } break; case LogicalScreenDescriptor: hold[count++]=ch; if (count==7) { // Logical Screen Descriptor swidth=LM(hold[0], hold[1]); sheight=LM(hold[2], hold[3]); gcmap=!!(hold[4]&0x80); //UNUSED: bpchan=(((hold[4]&0x70)>>3)+1); //UNUSED: gcmsortflag=!!(hold[4]&0x08); gncols=2<<(hold[4]&0x7); bgcol=(gcmap) ? hold[5] : -1; //aspect=hold[6] ? double(hold[6]+15)/64.0 : 1.0; trans_index = -1; count=0; ncols=gncols; if (gcmap) { ccount=0; state=GlobalColorMap; globalcmap = new QRgb[gncols+1]; // +1 for trans_index globalcmap[gncols] = Q_TRANSPARENT; } else { state=Introducer; } } break; case GlobalColorMap: case LocalColorMap: hold[count++]=ch; if (count==3) { QRgb rgb = qRgb(hold[0], hold[1], hold[2]); if (state == LocalColorMap) { if (ccount < lncols) localcmap[ccount] = rgb; } else { globalcmap[ccount] = rgb; } if (++ccount >= ncols) { if (state == LocalColorMap) state=TableImageLZWSize; else state=Introducer; } count=0; } break; case Introducer: hold[count++]=ch; switch (ch) { case ',': state=ImageDescriptor; break; case '!': state=ExtensionLabel; break; case ';': // ### Changed: QRect(0, 0, swidth, sheight) state=Done; break; default: digress=true; // Unexpected Introducer - ignore block state=Error; } break; case ImageDescriptor: hold[count++]=ch; if (count==10) { int newleft=LM(hold[1], hold[2]); int newtop=LM(hold[3], hold[4]); int newwidth=LM(hold[5], hold[6]); int newheight=LM(hold[7], hold[8]); // disbelieve ridiculous logical screen sizes, // unless the image frames are also large. if (swidth/10 > qMax(newwidth,200)) swidth = -1; if (sheight/10 > qMax(newheight,200)) sheight = -1; if (swidth <= 0) swidth = newleft + newwidth; if (sheight <= 0) sheight = newtop + newheight; QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32; if (image->isNull()) { (*image) = QImage(swidth, sheight, format); bpl = image->bytesPerLine(); bits = image->bits(); memset(bits, 0, image->byteCount()); } disposePrevious(image); disposed = false; left = newleft; top = newtop; width = newwidth; height = newheight; right=qMax(0, qMin(left+width, swidth)-1); bottom=qMax(0, qMin(top+height, sheight)-1); lcmap=!!(hold[9]&0x80); interlace=!!(hold[9]&0x40); //bool lcmsortflag=!!(hold[9]&0x20); lncols=lcmap ? (2<<(hold[9]&0x7)) : 0; if (lncols) { if (localcmap) delete [] localcmap; localcmap = new QRgb[lncols+1]; localcmap[lncols] = Q_TRANSPARENT; ncols = lncols; } else { ncols = gncols; } frame++; if (frame == 0) { if (left || top || width<swidth || height<sheight) { // Not full-size image - erase with bg or transparent if (trans_index >= 0) { fillRect(image, 0, 0, swidth, sheight, color(trans_index)); // ### Changed: QRect(0, 0, swidth, sheight) } else if (bgcol>=0) { fillRect(image, 0, 0, swidth, sheight, color(bgcol)); // ### Changed: QRect(0, 0, swidth, sheight) } } } if (disposal == RestoreImage) { int l = qMin(swidth-1,left); int r = qMin(swidth-1,right); int t = qMin(sheight-1,top); int b = qMin(sheight-1,bottom); int w = r-l+1; int h = b-t+1; if (backingstore.width() < w || backingstore.height() < h) { // We just use the backing store as a byte array backingstore = QImage(qMax(backingstore.width(), w), qMax(backingstore.height(), h), QImage::Format_RGB32); memset(bits, 0, image->byteCount()); } const int dest_bpl = backingstore.bytesPerLine(); unsigned char *dest_data = backingstore.bits(); for (int ln=0; ln<h; ln++) { memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, ln), FAST_SCAN_LINE(bits, bpl, t+ln) + l, w*sizeof(QRgb)); } } count=0; if (lcmap) { ccount=0; state=LocalColorMap; } else { state=TableImageLZWSize; } x = left; y = top; accum = 0; bitcount = 0; sp = stack; firstcode = oldcode = 0; needfirst = true; out_of_bounds = left>=swidth || y>=sheight; } break; case TableImageLZWSize: { lzwsize=ch; if (lzwsize > max_lzw_bits) { state=Error; } else { code_size=lzwsize+1; clear_code=1<<lzwsize; end_code=clear_code+1; max_code_size=2*clear_code; max_code=clear_code+2; int i; for (i=0; i<clear_code; i++) { table[0][i]=0; table[1][i]=i; } state=ImageDataBlockSize; } count=0; break; } case ImageDataBlockSize: expectcount=ch; if (expectcount) { state=ImageDataBlock; } else { state=Introducer; digress = true; newFrame = true; } break; case ImageDataBlock: count++; accum|=(ch<<bitcount); bitcount+=8; while (bitcount>=code_size && state==ImageDataBlock) { int code=accum&((1<<code_size)-1); bitcount-=code_size; accum>>=code_size; if (code==clear_code) { if (!needfirst) { code_size=lzwsize+1; max_code_size=2*clear_code; max_code=clear_code+2; } needfirst=true; } else if (code==end_code) { bitcount = -32768; // Left the block end arrive } else { if (needfirst) { firstcode=oldcode=code; if (!out_of_bounds && image->height() > y && firstcode!=trans_index) ((QRgb*)FAST_SCAN_LINE(bits, bpl, y))[x] = color(firstcode); x++; if (x>=swidth) out_of_bounds = true; needfirst=false; if (x>=left+width) { x=left; out_of_bounds = left>=swidth || y>=sheight; nextY(bits, bpl); } } else { incode=code; if (code>=max_code) { *sp++=firstcode; code=oldcode; } while (code>=clear_code+2) { *sp++=table[1][code]; if (code==table[0][code]) { state=Error; break; } if (sp-stack>=(1<<(max_lzw_bits))*2) { state=Error; break; } code=table[0][code]; } *sp++=firstcode=table[1][code]; code=max_code; if (code<(1<<max_lzw_bits)) { table[0][code]=oldcode; table[1][code]=firstcode; max_code++; if ((max_code>=max_code_size) && (max_code_size<(1<<max_lzw_bits))) { max_code_size*=2; code_size++; } } oldcode=incode; const int h = image->height(); const QRgb *map = lcmap ? localcmap : globalcmap; QRgb *line = 0; if (!out_of_bounds && h > y) line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); while (sp>stack) { const uchar index = *(--sp); if (!out_of_bounds && h > y && index!=trans_index) { if (index > ncols) line[x] = Q_TRANSPARENT; else line[x] = map ? map[index] : 0; } x++; if (x>=swidth) out_of_bounds = true; if (x>=left+width) { x=left; out_of_bounds = left>=swidth || y>=sheight; nextY(bits, bpl); if (!out_of_bounds && h > y) line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y); } } } } } partialNewFrame = true; if (count==expectcount) { count=0; state=ImageDataBlockSize; } break; case ExtensionLabel: switch (ch) { case 0xf9: state=GraphicControlExtension; break; case 0xff: state=ApplicationExtension; break; #if 0 case 0xfe: state=CommentExtension; break; case 0x01: break; #endif default: state=SkipBlockSize; } count=0; break; case ApplicationExtension: if (count<11) hold[count]=ch; count++; if (count==hold[0]+1) { if (qstrncmp((char*)(hold+1), "NETSCAPE", 8)==0) { // Looping extension state=NetscapeExtensionBlockSize; } else { state=SkipBlockSize; } count=0; } break; case NetscapeExtensionBlockSize: expectcount=ch; count=0; if (expectcount) state=NetscapeExtensionBlock; else state=Introducer; break; case NetscapeExtensionBlock: if (count<3) hold[count]=ch; count++; if (count==expectcount) { *loopCount = hold[1]+hold[2]*256; state=SkipBlockSize; // Ignore further blocks } break; case GraphicControlExtension: if (count<5) hold[count]=ch; count++; if (count==hold[0]+1) { disposePrevious(image); disposal=Disposal((hold[1]>>2)&0x7); //UNUSED: waitforuser=!!((hold[1]>>1)&0x1); int delay=count>3 ? LM(hold[2], hold[3]) : 1; // IE and mozilla use a minimum delay of 10. With the minimum delay of 10 // we are compatible to them and avoid huge loads on the app and xserver. *nextFrameDelay = (delay < 2 ? 10 : delay) * 10; bool havetrans=hold[1]&0x1; trans_index = havetrans ? hold[4] : -1; count=0; state=SkipBlockSize; } break; case SkipBlockSize: expectcount=ch; count=0; if (expectcount) state=SkipBlock; else state=Introducer; break; case SkipBlock: count++; if (count==expectcount) state=SkipBlockSize; break; case Done: digress=true; /* Netscape ignores the junk, so we do too. length++; // Unget state=Error; // More calls to this is an error */ break; case Error: return -1; // Called again after done. } }
void RWS_TFTLCD_TS::leftCR(void) { if(_CRscrCurrent < _CRstartX + _CRsX - 8) fillRect(_CRscrCurrent - _CRjumpX, _CRstartY, 9+_CRjumpX, _CRsY, _CRbg); _CRscrCurrent = _CRstartX; }
void QPaintEngineEx::fillRect(const QRectF &r, const QColor &color) { fillRect(r, QBrush(color)); }
void RS_Painter::drawHandle(const RS_Vector& p, const RS_Color& c, int size) { if (size<0) { size = 2; } fillRect((int)(p.x-size), (int)(p.y-size), 2*size, 2*size, c); }
void strokeLineV(SDL_Surface *surf, uint8_t grey, int x, int y, int length, int width) { fillRect(surf, grey, x-width/2, y, width, length); }
void Bitmap::fillRect(int x, int y, int width, int height, const Vec4 &color) { fillRect(IntRect(x, y, width, height), color); }