 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TheGood
Joined: 30 Jul 2007 Posts: 399
|
Posted: Wed Mar 25, 2009 7:09 pm Post subject: |
|
|
| Smurth wrote: | | I've done this like that |
Thank you! Exactly what I needed!  |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 27, 2009 2:04 pm Post subject: |
|
|
| Lexikos wrote: | tic, I have a few suggestions:
- When the source co-ordinates are omitted from DrawImage, default to the entire image. Currently if I say "draw an image at 0,0 and make it 100x100" and the image is only 16x16, the result will be 16x16. GDI+ offers overloads of DrawImage() which accept only a pair of co-ordinates, and will draw the entire image at those co-ordinates. These are available in the flat API; alternatively, you could simulate them by retrieving the size of the image.
- Similarly, allow the destination size to be omitted.
- Implement a wrapper for GdipGraphicsClear (I've suggested this before).
|
I definitely agree with those suggestions.
How would I go about using GdipGraphicsClear manually for now? I tried looking for it on MSDN but only found the .NET equivalent. Would it just be DllCall("GdipGraphicsClear", "UInt", graph, "UInt", BackGroundColor) ? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4469 Location: Qld, Australia
|
Posted: Fri Mar 27, 2009 2:23 pm Post subject: |
|
|
Close, but the function must be qualified with the DLL name.
| Code: | | DllCall("gdiplus\GdipGraphicsClear", "UInt", graph, "UInt", BackGroundColor) | Btw, you may refer to MSDN: GDI+ Flat API. It lists and defines flat functions by category, linking to the corresponding C++ wrapper methods. (These are almost the same as their .NET counterparts.) I find the Windows SDK headers to be more useful (accurate and complete), though. |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1458
|
Posted: Fri Mar 27, 2009 2:44 pm Post subject: |
|
|
Ok, things I will bring out shortly (and posting this here just to have a written to do list) are:
- An example showing how to use matrices when drawing to change colours
- Edit Gdip_DrawImage to be able to leave out the source coordinates, but also resize. Also allow destination size to be omitted
- Create better functions for GdipCreateBitmapFromScan0, similar to the BRA functions
- Add GdipGraphicsClear
- Improve support for BRAs and give examples
- Give example of updating an area of a graphics context, without updating the whole thing
|
|
| Back to top |
|
 |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Wed Apr 01, 2009 12:25 am Post subject: |
|
|
Hi,
What I'm trying to do is paint an pixel matrix onto the screen at specific locations...
I have 3x3 (for example) pixel matrices loaded into a variable in the following format:
0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF0xFFFFFF
I wanted to try and paint them out onto the screen (and later specifically remove them)
At the very least, I wanted to work out how to paint an individual pixel of a specific color, onto a specific point on the screen.
Does anyone have any clues on this? Cheers  |
|
| Back to top |
|
 |
Nicklea Guest
|
Posted: Fri Apr 03, 2009 4:46 pm Post subject: |
|
|
| tic wrote: | Ok, things I will bring out shortly (and posting this here just to have a written to do list) are:
[*]An example showing how to use matrices when drawing to change colours |
Thank you Tic, I am so grateful for your knowledge & assistance on that one. Looking forward. Have best day! |
|
| Back to top |
|
 |
tkoi
Joined: 26 Jun 2008 Posts: 56
|
Posted: Wed Apr 22, 2009 12:59 am Post subject: |
|
|
tic, I think SetImage() should return ErrorLevel. Currently it returns nothing. This came to my attention because I just spent 20 minutes trying to figure out why my script was leaking 256kb and a GDI object every time a certain routine was called. Turns out, STM_SETIMAGE returns a handle to a copy of the bitmap that was previously set to the static control (or NULL if none).
See MSDN: http://msdn.microsoft.com/en-us/library/bb760782%28VS.85%29.aspx
| Quote: | Important
In version 6 of the Microsoft Win32 controls, a bitmap passed to a static control using the STM_SETIMAGE message was the same bitmap returned by a subsequent STM_SETIMAGE message. The client is responsible to delete any bitmap sent to a static control.
With Microsoft Windows XP, if the bitmap passed in the STM_SETIMAGE message contains pixels with non-zero alpha, the static control takes a copy of the bitmap. This copied bitmap is returned by the next STM_SETIMAGE message. The client code may independently track the bitmaps passed to the static control, but if it does not check and release the bitmaps returned from STM_SETIMAGE messages, the bitmaps are leaked. |
|
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1458
|
Posted: Thu Apr 30, 2009 12:16 am Post subject: |
|
|
Thanks for pointing this out tkoi. Any suggestions for how you would like the function to look? You're right it should have a return value
Also, some minor updates just released. Still need to work on the big stuff... |
|
| Back to top |
|
 |
sorockinalex Guest
|
Posted: Mon May 04, 2009 10:48 am Post subject: |
|
|
Please Help!
I'm printing... The code at the bottom is not working when xPos or yPos<>0. Where is my mistake? Or CreateRectF didn't working with xPos and yPos<>0???
| Code: |
CreateRectF(RectF,xPos,yPos, 1000,1000)
DllCall("User32.dll\DrawTextEx", "UInt", hDC, "Str", "some ksj sdfkjshd fjksdhkfj shkdjf hskjdf hsdftext", "UInt", 3000, "UInt", &RectF, "UInt", DT_WORDBREAK, "UInt", 0) |
|
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4469 Location: Qld, Australia
|
Posted: Mon May 04, 2009 11:01 am Post subject: |
|
|
CreateRectF creates a RectF structure, which contains four Floating-point numbers. DrawTextEx accepts LPRECT, a pointer to a RECT structure, which contains four integers. Zero is probably the only number which has the same binary representation in the two formats (floating-point and integer).
Use either of the following instead:
| Code: | VarSetCapacity(RECT, 16)
NumPut(left, RECT, 0)
NumPut(top, RECT, 4)
NumPut(right, RECT, 8)
NumPut(bottom, RECT, 12)
|
| Code: | VarSetCapacity(RECT, 16), NumPut(bottom, NumPut(right, NumPut(top, NumPut(left, RECT))))
| Btw, DrawTextEx is a GDI function, not GDI+. RectF and Rect are defined in the GDI+ headers and used by GDI+ functions. They define a position, width and height. RECT is used by GDI, and its fields have different meanings: it defines two points - the top-left and bottom-right. |
|
| Back to top |
|
 |
sorockinalex Guest
|
Posted: Mon May 04, 2009 8:41 pm Post subject: |
|
|
Thanks!
hm... i'm finding a way to do text narrowing to width... How can i do this?
I supposed, that i can do it with DrawTextEx and print it in the rectangle area...
Am i wright? |
|
| Back to top |
|
 |
Guest
|
Posted: Tue May 26, 2009 4:12 am Post subject: |
|
|
Hi Tic, after I draw graphics objects, do you have any best practices recommended in terms of making sure all memory resources are cleared out?  |
|
| Back to top |
|
 |
garkin
Joined: 27 May 2009 Posts: 17
|
Posted: Wed May 27, 2009 10:46 pm Post subject: |
|
|
Found a little error at v1.28.
| Code: | | ;MatrixNegative := "-1|0|0|0|0|" "0|-1|0|0|0|" "0|0|-1|0|0|" "0|0|0|1|0|" "0|0|0|0|1" |
Must be:
| Code: | | ;MatrixNegative := "-1|0|0|0|0|" "0|-1|0|0|0|" "0|0|-1|0|0|" "0|0|0|1|0|" "1|1|1|0|1 |
Would be functions for work with DrawImageFx and Effects classes added in future releases? |
|
| Back to top |
|
 |
Nicklea Guest
|
Posted: Wed Jun 03, 2009 8:37 am Post subject: |
|
|
HI Tic May I pplease ask, the demonstrations you spoke of, about transforming bitmaps to some different solid color. May I please ask if there is anything yet you can show us? Have a wonderful day! |
|
| Back to top |
|
 |
garkin
Joined: 27 May 2009 Posts: 17
|
Posted: Sun Jun 07, 2009 10:18 pm Post subject: |
|
|
Small usefull function, that was not found in 1.28.
| Code: | Gdip_GraphicsFromHWND(hwnd)
{
DllCall("gdiplus\GdipCreateFromHWND", "UInt", hwnd, "UInt*", pGraphics)
Return, pGraphics
}
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|