initialize_screen_buffer(bitmap, width, height, 0); // HALFTONE
bitmap->hPainter.begin(&(bitmap->pImage));
bitmap->hPainter.fillRect(0, 0, width, height, col);
- bitmap->hPainter.begin(&(bitmap->pImage));
bitmap->hPainter.end();
+ AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Create bitmap: %08x %d x %d", bitmap, width, height);
}
void OSD::release_bitmap(bitmap_t *bitmap)
{
release_screen_buffer(bitmap);
+ AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Release bitmap: %08x", bitmap);
}
void OSD::create_font(font_t *font, const _TCHAR *family, int width, int height, int rotate, bool bold, bool italic)
{
QString fontName;
+ fontName = QString::fromUtf8(family);
if(fontName == QString::fromUtf8("Gothic")) {
fontName = QString::fromUtf8("Sans Serif");
} else if(fontName == QString::fromUtf8("Mincho")) {
font->hFont.setStretch((width * 10000) / (metric.width("F") * 100));
font->rotate = rotate;
font->init_flag = true;
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Create Font: Family=%s WIDTH=%d HEIGHT=%d",fontName.toUtf8().constData(), width, height);
// Qt uses substitution font if not found.
}
void OSD::release_font(font_t *font)
{
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Release Font");
}
void OSD::create_pen(pen_t *pen, int width, uint8 r, uint8 g, uint8 b)
QColor color = QColor(r, g, b, 255);
pen->hPen.setColor(color);
pen->hPen.setWidth(width);
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Create PEN %08x to width=%d (RGB)=(%d,%d,%d)\n", pen, width, r, g, b);
}
void OSD::release_pen(pen_t *pen)
{
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Release Pen %08x", pen);
}
void OSD::clear_bitmap(bitmap_t *bitmap, uint8 r, uint8 g, uint8 b)
{
+ //lock_vm();
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Clear bitmap %08x", bitmap);
draw_rectangle_to_bitmap(bitmap, 0, 0, bitmap->width, bitmap->height, r, g, b);
+ //unlock_vm();
}
int OSD::get_text_width(bitmap_t *bitmap, font_t *font, const char *text)
{
QColor col(r, g, b, 255);
QPoint loc = QPoint(x, y);
- //QString str = QString::fromUtf8(text);
QTextCodec *codec = QTextCodec::codecForName("Shift-JIS");
QString str = codec->toUnicode(text);
bitmap->hPainter.begin(&(bitmap->pImage));
- bitmap->hPainter.setBackgroundMode(Qt::TransparentMode);
+ //bitmap->hPainter.setBackgroundMode(Qt::OpaqueMode);
bitmap->hPainter.setPen(col);
bitmap->hPainter.rotate((qreal)font->rotate);
bitmap->hPainter.setFont(font->hFont);
bitmap->hPainter.drawText(loc, str);
bitmap->hPainter.end();
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Draw Text to BITMAP %08x : (%d,%d) %s : Color(%d,%d,%d)", bitmap, x, y, str.toUtf8().constData(), r, g, b);
}
void OSD::draw_line_to_bitmap(bitmap_t *bitmap, pen_t *pen, int sx, int sy, int ex, int ey)
{
QLine line(sx, sy, ex, ey);
bitmap->hPainter.begin(&(bitmap->pImage));
- bitmap->hPainter.setBackgroundMode(Qt::TransparentMode);
+ //bitmap->hPainter.setBackgroundMode(Qt::TransparentMode);
bitmap->hPainter.setPen(pen->hPen);
bitmap->hPainter.drawLine(line);
bitmap->hPainter.end();
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Draw Line from (%d,%d) to (%d,%d) to BITMAP %08x", sx, sy, ex, ey, bitmap);
}
void OSD::draw_point_to_bitmap(bitmap_t *bitmap, int x, int y, uint8 r, uint8 g, uint8 b)
QColor d_col(r, g, b);
QPen d_pen(d_col);
bitmap->hPainter.begin(&(bitmap->pImage));
- bitmap->hPainter.setBackgroundMode(Qt::TransparentMode);
+ //bitmap->hPainter.setBackgroundMode(Qt::OpaqueMode);
bitmap->hPainter.setPen(d_pen);
bitmap->hPainter.drawPoint(point);
bitmap->hPainter.end();
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Draw Point to BITMAP %08x :(%d,%d) Color=(%d,%d,%d)", bitmap, x, y, r, g, b);
}
void OSD::draw_rectangle_to_bitmap(bitmap_t *bitmap, int x, int y, int width, int height, uint8 r, uint8 g, uint8 b)
{
- QColor d_col(r, g, b);
+ QColor d_col(r, g, b, 255);
QBrush d_brush(d_col);
bitmap->hPainter.begin(&(bitmap->pImage));
- bitmap->hPainter.setBackgroundMode(Qt::TransparentMode);
+ //bitmap->hPainter.setBackgroundMode(Qt::OpaqueMode);
bitmap->hPainter.fillRect(x, y, width, height, d_brush);
bitmap->hPainter.end();
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Draw Rect BITMAP %08x :from (%d,%d) size=(%d,%d) Color=(%d,%d,%d)", bitmap, x, y, width, height, r, g, b);
}
void OSD::stretch_bitmap(bitmap_t *dest, int dest_x, int dest_y, int dest_width, int dest_height, bitmap_t *source, int source_x, int source_y, int source_width, int source_height)
QRect src_r(source_x, source_y, source_width, source_height);
QRect dest_r(dest_x, dest_y, dest_width, dest_height);
dest->hPainter.begin(&(dest->pImage));
- dest->hPainter.setBackgroundMode(Qt::OpaqueMode);
+ //dest->hPainter.setBackgroundMode(Qt::OpaqueMode);
dest->hPainter.drawImage(dest_r, source->pImage, src_r);
dest->hPainter.end();
+ //AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Scale (%d,%d, %d, %d) to (%d,%d, %d, %d)", source_x, source_y, source_width, source_height,
+ // dest_x, dest_y, dest_width, dest_height);
}
#endif
void OSD::write_bitmap_to_file(bitmap_t *bitmap, const _TCHAR *file_path)
{
bitmap->pImage.save(QString::fromUtf8(file_path));
+ AGAR_DebugLog(AGAR_LOG_DEBUG, "PRINTER: Save bitmap %08x to %s", bitmap, file_path);
}