can i create a texture line?

we can create a HPEN or HBRUSH.
but can i create a HPEN from an image?
Do you ever bother checking the internet before you ask questions here? You might find what you are looking for. Lots of information is available to those who look.

With GDI you can NOT create a pen from a texture.

Although you can specify any color for a pen when creating it, the system uses only colors that are available on the device.

With GDI+ you can.

FYI, here's the metasearch I used to find the links:
And to answer the inevitable question that probably won't be asked:

Yes, it is possible to draw lines from a texture (bitmap) in DirectX. Direct3D and Direct2D.

Trying to find out how to do that is not a simple 'net search, but IMO well worth the effort. Took me about 5 minutes to find usable link resources.
At the minimum you should have checked the WinAPI documentation for GDI pen creation. There are two functions: CreatePen & CreatPenIndirect.
If I read correctly or ExtCreatePen() function, with LOGBRUSH::lbHatch, can do it?
"A hatch style. The meaning depends on the brush style defined by lbStyle.

If lbStyle is BS_DIBPATTERN, the lbHatch member contains a handle to a packed DIB. To obtain this handle, an application calls the GlobalAlloc function with GMEM_MOVEABLE (or LocalAlloc with LMEM_MOVEABLE) to allocate a block of memory and then fills the memory with the packed DIB. A packed DIB consists of a BITMAPINFO structure immediately followed by the array of bytes that define the pixels of the bitmap."
(sorry been late to answer, but i didn't get the notification)
Last edited on
Topic archived. No new replies allowed.