AutoHotkey Community

It is currently May 26th, 2012, 4:33 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1000 posts ]  Go to page Previous  1 ... 12, 13, 14, 15, 16, 17, 18 ... 67  Next
Author Message
 Post subject:
PostPosted: March 25th, 2009, 7:09 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Smurth wrote:
I've done this like that

Thank you! Exactly what I needed! :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2009, 2:04 pm 
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) ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2009, 2:23 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2009, 2:44 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2009, 12:25 am 
Offline

Joined: October 30th, 2008, 10:13 pm
Posts: 27
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 4:46 pm 
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


:D Thank you Tic, I am so grateful for your knowledge & assistance on that one. Looking forward. Have best day!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2009, 12:59 am 
Offline

Joined: June 26th, 2008, 3:58 am
Posts: 56
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 ... 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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2009, 12:16 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2009, 10:48 am 
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)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2009, 11:01 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2009, 8:41 pm 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 4:12 am 
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? :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2009, 10:46 pm 
Offline

Joined: May 27th, 2009, 10:44 pm
Posts: 17
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 3rd, 2009, 8:37 am 
HI Tic :D :D 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? :cool: Have a wonderful day!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2009, 10:18 pm 
Offline

Joined: May 27th, 2009, 10:44 pm
Posts: 17
Small usefull function, that was not found in 1.28.
Code:
Gdip_GraphicsFromHWND(hwnd)
{
    DllCall("gdiplus\GdipCreateFromHWND", "UInt", hwnd, "UInt*", pGraphics)
    Return, pGraphics
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1000 posts ]  Go to page Previous  1 ... 12, 13, 14, 15, 16, 17, 18 ... 67  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, maul.esel and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group