I am using a GDI+ Graphic to draw a 4000*3000 image to screen, but it is really slow. It takes about 300ms. I wish it just occupy less than 10ms.
Bitmap *bitmap = Bitmap::FromFile("XXXX",...);
//--------------------------------------------
// this part takes about 300ms, terrible!
int width = bitmap->GetWidth();
int height = bitmap->...
So I have been posting all over and have yet to get a solid answer:
I have created an image resizing class, with a crop method. The cropping works great. The issue that I am having is the background color that I specify in the drawImage function of Graphics is not working correctly. It defaults to black as the background regardless of w...
I have 3 Bitmap point .
Bitmap* totalCanvas = new Bitmap(400, 300, PixelFormat32bppARGB); // final canvas
Bitmap* bottomLayer = new Bitmap(400, 300,PixelFormat32bppARGB); // background
Bitmap* topLayer = new Bitmap(XXX); // always changed.
I will draw complex background on bottomLayer. I don't want to redraw complex background on to...
I am trying to draw two images side-by-side using the C# Drawing namespace.
Here is a very simple example that assumes we have two images of the same height:
Image[] oldImages = GetOldImages();
var newImage = new Bitmap(oldImages[0].Width + oldImages[1].Width, 800);
using (var newImageGraphics = Graphics.FromImage(newImage))
{
ne...
Hi, Having a small problem finding a function or method to do what I'm looking for, hoping someone might be able to give a bit of insight here.
I've got a function that's supposed to extract and return a 32x32px bitmap from a larger bitmap which has a set of 32x32 tiles inside it.
Here's the code I have now, but it's wrong since the Ti...
Is it possible to draw a transperancy mask of an image (that is, paint all visible pixels with a constant color) using Graphics::DrawImage? I am not looking for manually scanning the image pixel-by-pixel and creating a seperate mask image, I wonder if it's possible to draw one directly from the original image.
My guessing is that it sho...
How should Java's drawImage() be used? I do not find the JDK documentation very forthcoming. For example all drawImage signatures require an ImageObserver but the documentation for this is not very helpful for new users.
...
In my user control's paint handler I iterate over a collection of predefined Bitmap objects and draw them to the client area thusly:
C# version:
private void Control_Paint(object sender, PaintEventArgs e) {
Graphics g = e.Graphics;
foreach (BitmapObj bmpObj in _bitmapObjCollection) {
g.DrawImageUnscaled(bmpObj.Bitmap, b...
I'm displaying a PNG with a transparent background that looks good in Windows 7, but then I run my app in XP Mode or remote desktop to a Windows XP machine and the PNG looks incorrect. I noticed that if I disable "Integration Mode" or run the app on XP without remote desktop, the image looks fine.
How do I get DrawImage to render the PN...
I have the following piece of HTML:
<style type="text/css">
#c{width:200px;height:500px}
</style>
<canvas id="c"></canvas>
<script type="text/javascript">
var i = new Image();
i.onload = function () {
var ctx = document.getElementById('c').getContext('2d');
ctx.drawImage(i, 0, 0);
}
i.width = i.height...
OK so, I am making an applet that paints 32x32 square tiles (to make a map) and my problem is that they are going diagonally when I want them to go 8 by 8 (hence the way the array is shaped 8 by 8). So... how do I fix this?
Thanks. Anyway, since the code bbcode is being a butthead... here is the pastebin URL :-)
http://www.danflow.past...
I have this problem with my applet. It only paints ONE row before it produces the error.
Here's my code: http://www.so.pastebin.com/RkG5YHVQ
Here's the error: http://www.so.pastebin.com/z1qWpFS6
...
I am drawing on a canvas with the following line:
ctx.drawImage(compositeImage, 0, 0, image.width, image.height, i, j, scaledCompositeImageWidth, scaledCompositeImageHeight);
This code has executed error free on Safari, Chrome, Firefox (and even IE using google's excanvas library). However, a recent update to Chrome now throws the fol...
Hi all,
I was just wondering, is Graphics.DrawImage() asynchronous?
I'm struggling with a thread safety issue and can't figure out where the problem is.
if i use the following code in the GUI thread:
protected override void OnPaint(PaintEventArgs e)
{
lock (_bitmapSyncRoot)
{
e.Graphics.DrawImage(_bitmap, _xPos, _yPos);
...
I am writing some code that uses HTML5 canvas. Genereally it works well, but now I found a very strange behaviour. The weird thing is that it is consistent on different browsers, so must be that I understood the thing wrong... despite this the docs seem to say exactly what I do. Here is the code (it's an object method):
MyCanvas.prot...
Sorry asking so many questions but believe me.. I tried Google first. :)
When you use the g.drawImage in paint() on an Applet... is there a way you can remove it? What I mean is remove the image that was drawn.
...
I'm making an overloaded TableLayoutPanel which draws some fancy borders, but for some reason the call to Graphics::DrawImage isn't working as expected. It seems to fade out my 1x10 pixel source image when I stretch it:
This is the function which does the rendering:
void GTableLayoutPanel::RenderSides(Graphics^ g, array<Drawing::Imag...
I've got an animation on my canvas where I have some images (drawn using drawImage()). For the sake of simplicity, let's say there's only two images. These images are following a circular path in faux-3d space such that sometimes one image overlaps the other and other times the second image overlaps the first. These images are also sca...
I'm trying to paint a Welcome Screen for my game, but only when the game loads. I don't want it to repaint everytime during the game.
So I did this (where isStart is instantiated as true):
public myClass(String name){
setSize(800, 800);
setVisible(true);
setResizable(false);
runGame()
}
public void paint(Graphics g) {
...
I am experimenting with animation in <canvas> and can't work out how to draw an image at an angle. The desired effect is a few images drawn as usual, with one image rotating slowly. (This image is not at the centre of the screen, if that makes any difference).
...