I will put it on the wish list but if you would like us to provide transparency on the screen then that would require a complete reworking of the code.
EXPORT_IMAGE@
Paul,
Thanks very much for this. I will give it a try soon and report back. This could solve my colour palette problem and provide a concise dump file format. Thanks also for the Beta version.
John
Paul,
thanks again for your work! Png export is working without any probemes!
Detlef
Quoted from PaulLaidler I will put it on the wish list but if you would like us to provide transparency on the screen then that would require a complete reworking of the code.
How does the owner draw box format %dw work?
Could this be used as easy method for supporting image transparency? I mean, you could use GDI+ Graphics object and it's drawing functions.
Here is a quick sample written in MiniBASIC for creating a Graphics object from the DC handle and then loading and drawing the image.
##NOCONSOLE
##MAKEDLL
##USES 'gdiplus.lib'
type GdiplusStartupInput
int GdiplusVersion
int DebugEventCallback
int SuppressBackgroundThread
int SuppressExternalCodecs
endtype
@API GdiplusStartup(pointer pToken, pointer GdiplusStartupInput, int GdiplusStartupOutput),int
@API GdiplusShutdown(int token)
@API GdipCreateFromHDC(uint hDC, pointer pGraphics),int
@API GdipDeleteGraphics(int Graphics),int
@API GdipCreateBitmapFromGdiDib(pointer GdiBitmapInfo, pointer gdiBitmapData, pointer pBitmap),int
@API GdipLoadImageFromFile(wstring filename, pointer pImage),int
@API GdipSaveImageToFile(pointer GpImage, wstring filename, pointer clsidEncoder, pointer encoderParams),int
@API GdipDrawImageI(pointer pGraphics, pointer pImage, int x, int y),int
@API GdipDisposeImage(int image)
export import_image
func import_image(uint hDC, string filename, int x, int y)
int result
pointer pImage
pointer pToken
pointer pGraphics
GdiplusStartupInput gsi
gsi.GdiplusVersion = 1
gsi.DebugEventCallback = NULL
gsi.SuppressBackgroundThread = FALSE
gsi.SuppressExternalCodecs = FALSE
GdiplusStartup(&pToken,gsi,NULL)
result=GdipLoadImageFromFile(a2w(filename),&pImage)
result=GdipCreateFromHDC(hDC,&pGraphics)
GdipDrawImageI(pGraphics,pImage,x,y)
GdipDisposeImage(pImage)
GdipDeleteGraphics(pGraphics)
GdiplusShutdown(pToken)
endf
I don't have a quick answer about %dw. I will put this on this list of things to look at.
Quoted from PaulLaidler I don't have a quick answer about %dw. I will put this on this list of things to look at.
Just tested, my idea seems to work fine...
Edit: I updated the sample project. It includes a DLL-file with two procedures for drawing images with tranparency into the %dw.
procedures are:
import_image(uint hDC, string filename, int x, int y)
- Imports image from graphic file into %dw on desired position.
import_imageRect(uint hDC, string filename, int x, int y, int w, int h)
- Same as import_image, except you can also specify desired widht and height for the image.
Jalih,
Why did you choose %dw? I found it rather limited, and only ever made progress with Clearwin+ after I shifted over to using %gr - and I don't understand the difference between them.
Eddie
Quoted from LitusSaxonicum
Why did you choose %dw? Eddie
I don't know how %gr works internally. By using %dw allowed me to get the DC handle and use native GDI and GDI+ routines directly.
You can do some neat stuff with images, like alpha blending and transforms.
That explains a lot. When I tried to use it, it was in the belief that it would allow me to use the pre-Clearwin graphics routines with a minimum of fuss. I was wrong! I don't think %gr even existed back at the launch of Clearwin (I went to a seminar at Salford Software when it was launched).
I have to steer clear of trying to read too much Microsoft stuff, as it seems to me to be written in an alien language (Klingon?). Of course, this would be no obstacle for a native Klingon speaker!
Can't you get the DC handle for a %gr region? Paul will know.
Probably the person most interested in applying your discoveries would be Dan. I've got relatively simple needs.
Eddie
According to the help file you can use 'GRAPHICS_HDC' in CLEARWIN_INFO@
Paul,
I have now tested export_image@ and it is able to generate a .png file and support the 128 colour palette that I am defining. This solves the problem I have been having with .gif files. I have been able to export from both the visable screen and a virtual screen. I am not sure of the size of these files, in comparison to .gif files, but they appear to be similar in size to .jpg files. The advantage of .png over .jpg is that .jpg can compromise the colour resolution and also can have some unusual adapted colour patterns.
The .png is a better solution for the screen dumps I am making.
Thank you very much for this addition at Ver 6.36
John
PS I modified the code to dump out 5 types of formats. I have listed out the file sizes for two screen dumps, which are about 80% white and detail for light source shading or rainbow palette. The file sizes are (k bytes):
Format Rainbow Light
.gif 53k 37k
.png 140k 94k
.jpg 141k 128k
.pcx 489k 354k
.bmp 3,972k 3,972k
.png is a welcome format addition.
I have added .png files to import_image@ for the next release (not the current beta download).