public void draw_background(object hdc, background_paint bg) { make_url(bg.image, bg.baseurl, out var url); if (_images.TryGetValue(url, out var img) && img is GameObject bmp) { draw_img_bg(hdc, bmp, bg); } }
public void draw_background(object hdc, background_paint bg) { var root = (GameObject)hdc; make_url(bg.image, bg.baseurl, out var url); if (_images.TryGetValue(url, out var img) && img is Texture tex) { draw_img_bg(root, tex, bg); } }
public void draw_background(object hdc, background_paint bg) { var gdi = (Graphics)hdc; apply_clip(gdi); make_url(bg.image, bg.baseurl, out var url); if (_images.TryGetValue(url, out var img) && img is Bitmap bmp) { draw_img_bg(gdi, bmp, bg); } release_clip(gdi); }
protected void draw_img_bg(Graphics hdc, Bitmap bmp, background_paint bg) { var bmp_Width = bmp.Width; var bmp_Height = bmp.Height; hdc.InterpolationMode = InterpolationMode.NearestNeighbor; hdc.PixelOffsetMode = PixelOffsetMode.Half; var rect = new Rectangle(bg.clip_box.left, bg.clip_box.top, bg.clip_box.width, bg.clip_box.height); hdc.SetClip(rect); switch (bg.repeat) { case background_repeat.no_repeat: { hdc.DrawImage(bmp, bg.position_x, bg.position_y, bmp_Width, bmp_Height); } break; case background_repeat.repeat_x: { // var bmp = new CachedBitmap(bgbmp, hdc); // for (var x = pos.left; x < pos.right; x += bgbmp_Width) // hdc.DrawCachedBitmap(bmp, x, pos.top); // for (var x = pos.left - bgbmp_Width; x + bgbmp_Width > draw_pos.left; x -= bgbmp_Width) // hdc.DrawCachedBitmap(&bmp, x, pos.top); } break; case background_repeat.repeat_y: { // var bmp = new CachedBitmap(bgbmp, hdc); // for (var y = pos.top; y < pos.bottom; y += bgbmp_Height) // hdc.DrawCachedBitmap(bmp, pos.left, y); // for (var y = pos.top - bgbmp_Height; y + bgbmp_Height > draw_pos.top; y -= bgbmp_Height) // hdc.DrawCachedBitmap(&bmp, pos.left, y); } break; case background_repeat.repeat: { // var bmp = new CachedBitmap(bgbmp, hdc); // if (bgbmp_Height >= 0) // for (var x = pos.left; x < pos.right; x += bgbmp_Width) // for (var y = pos.top; y < pos.bottom; y += bgbmp_Height) // hdc.DrawCachedBitmap(&bmp, x, y); } break; } }
public background_paint(background_paint val) { image = val.image; baseurl = val.baseurl; attachment = val.attachment; repeat = val.repeat; color = val.color; clip_box = val.clip_box; origin_box = val.origin_box; border_box = val.border_box; border_radius = val.border_radius; image_size = val.image_size; position_x = val.position_x; position_y = val.position_y; position_z = val.position_z; //:h3ml is_root = val.is_root; }
protected void draw_img_bg(GameObject hdc, Texture tex, background_paint bg) { var tex_width = tex.width; var tex_height = tex.height; switch (bg.repeat) { case background_repeat.no_repeat: { hdc_DrawImage(hdc, tex, bg.position_x, bg.position_y, bg.position_z); } break; case background_repeat.repeat_x: { // var bmp = new CachedBitmap(bgbmp, hdc); // for (var x = pos.left; x < pos.right; x += bgbmp_Width) // hdc.DrawCachedBitmap(bmp, x, pos.top); // for (var x = pos.left - bgbmp_Width; x + bgbmp_Width > draw_pos.left; x -= bgbmp_Width) // hdc.DrawCachedBitmap(&bmp, x, pos.top); } break; case background_repeat.repeat_y: { // var bmp = new CachedBitmap(bgbmp, hdc); // for (var y = pos.top; y < pos.bottom; y += bgbmp_Height) // hdc.DrawCachedBitmap(bmp, pos.left, y); // for (var y = pos.top - bgbmp_Height; y + bgbmp_Height > draw_pos.top; y -= bgbmp_Height) // hdc.DrawCachedBitmap(&bmp, pos.left, y); } break; case background_repeat.repeat: { // var bmp = new CachedBitmap(bgbmp, hdc); // if (bgbmp_Height >= 0) // for (var x = pos.left; x < pos.right; x += bgbmp_Width) // for (var y = pos.top; y < pos.bottom; y += bgbmp_Height) // hdc.DrawCachedBitmap(&bmp, x, y); } break; } }
public void draw_background(object hdc, background_paint bg) { }
protected void draw_img_bg(object hdc, GameObject bmp, background_paint bg) { }