Drawing to an existing image with X-window - linux

I am using X-window (X11) to render 2D graphics (lines, circles, text...). But rather than drawing to a window, I need to draw to an existing bitmap image. Is there a way to achieve this ? If yes, are there restrictions on the bitmap format ?
(Notice: I am not trying to render an image to a window.)

Create a pixmap via: XCreatePixmap
Create a context via XCreateGC, specifying the pixmap as the drawable.
Transfer the contents of your existing image via XPutImage (see also Transferring Images between Client and Server), specifying the pixmap as the drawable and the related context.
do your renderings via GC Convenience Routines and Graphics Functions
Get the contents from the pixmap via: XGetImage, see also Transferring Images between Client and Server
Save the image data.

Related

Load image from JS to Phaser Game

I'm doing a custom game which I'd like to change the background and a character picture according to a file they upload.
The input file is outside phaser. If possible, I'd like to show the picture directly without uploading to the server.
If you use a file loader to get the base64 encoding of the image, you can use this.textures.addBase64 to load the image into the texture manager, after that loads you can create new objects with that image tag, or set existing images to that texture.
Working Example =>
https://stackblitz.com/edit/phaser-use-uploaded-image

How to combine multiple image as single image in UWP

I have multiple image(near by 40 images), I need to combine these images as single image. I have referred the below link,
Combine two Images into one new Image
but I dint find anything like Graphics in UWP. How toacheive this requirement
Making a render target bitmap and draw the image to render target bitmap.
The example that how to draw image to render target bitmap.
And you can save render target bitmap to file, see http://jamescroft.co.uk/blog/how-to/storing-a-uwp-inkcanvas-drawing-as-an-image-in-a-storagefile/

How to get the background image of canvas after loading with loadFromJSON fabricjs?

When I load json string of canvas with background image and objects. I can not get the background image. when I console the data i can not see the background image there.
How can I bind the background image in JSON.stringify() function when saving the canvas in database?
As you mentioned, it is important when to call canvas.toJSON().
It is also very important to note this: you might see the background image property in your json string, but the image would not be saved properly at the time of canvas.toJSON() call. So as a result when you call loadFromJSON, every object is loaded into canvas except the background image.
Also, make sure you always use the latest fabricjs version.

Node create image by mixing 2 images

I've got app based on google maps. Each user is one pin on it.
I want to create pin image basing on user profile photo.
What I need to do is
Resize given image to given size (50x50px)
Make this image circle
Below this image, put base pin image (png) that has place on it for circle photo
Save final image as pin photo
Final image should be png with transparency enabled.
Is there any node library that can do such things?
Imagemagick supports image composition, and node has Imagemagick bindings.
Even though, I guess you can achieve your goal via CSS only:
resize -> browser will do;
make it circle -> border-radius: 50%;
base pin image background -> background-image.

What manager is suggested for Gallery Manager?

I am working on implementing a gallery, I tried GridFieldManager for this, but the images of the thumbnail are not of same size. I sneaked through the gridfieldclass but there are no methods for making the cell size of each image constant.
Is it worth to use flowfieldmnager? When I tried overriding sublayout method for the above two managers it is not giving the desired reults.
Is it possible to sublayout flowfieldmanager?
Device : Blackberry 9780, OS 6.0
The below image is the desired result I am trying to get
I advice you to use a simple FlowFieldManager. But instead of BitmapField inside it, extend a Field to do the following:
setExtent to 1/4 of the Display width in the sublayout method
draw your own focus in the border of the image
draw your own borders and draw the image in the center of the field's extent

Resources