Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdImage improvements #98

Open
25 of 36 tasks
sancarn opened this issue May 18, 2024 · 1 comment
Open
25 of 36 tasks

stdImage improvements #98

sancarn opened this issue May 18, 2024 · 1 comment
Labels
megathread Many bundled feature requests for an individual class

Comments

@sancarn
Copy link
Owner

sancarn commented May 18, 2024

Tracker

  • CreateFromBinary(ByRef b() As Byte, ByVal format as stdImgFormat) As stdImage
  • CreateFromDataURL(ByVal sURL as string) as stdImage
  • CreateFromFile(ByVal sPath As String, Optional ByVal format as stdImgFormat = stdImgFormatDefault, optional byval transparentColor as Long = 0) As stdImage
    • BMP, GIF, JPEG, PNG, TIFF, WMF, EMF
    • WEBP
  • CreateFromUrl(ByVal sURL As String, Optional ByVal format as stdImgFormat = stdImgFormatDefault) As stdImage
    • AutoProxy?
    • Possibly remove? stdHTTP should really be used...
  • CreateFromHBitmap(ByVal hBitmap As LongPtr) As stdImage
  • CreateFromClipboard() As stdImage
  • CreateFromIPictureDisp(ByVal picture As stdole.IPictureDisp) As stdImage
    • Need an example
  • CreateFromStdPicture(ByVal picture As stdole.stdPicture) As stdImage
  • CreateFromIPicture(ByVal picture As stdole.IPicture) As stdImage
    • Need an example
  • CreateFromExcelIPicture(ByVal picture As Excel.IPicture) As stdImage
    • Need an example
  • CreateFromShape(ByVal shp As Object) As stdImage
  • CreateFromChart(ByVal chart As Object) As stdImage
  • CreateFromHICON(ByVal hicon as LongPtr) as stdImage
  • Get HBitmap() as LongPtr
  • Get HICON() as LongPtr
  • ToBinary(Optional ByVal eFormat As stdImgFormat = stdImgFormatDefault) As Byte()
    • Remove hack
  • ToFile(ByVal FileName As String, Optional format As stdImgFormat = stdImgFormatDefault, Optional ByVal Quality As Byte = 80, Optional ByVal TIFF_ColorDepth As Long = 24, Optional ByVal TIFF_Compression As Long = 6)
  • ToClipboard()
    • Remove hack
  • ToTempFile(Optional ByVal eFormat As stdImgFormat = stdImgFormatDefault) as string
  • ToSheet(ByVal ws as Worksheet, Optional ByVal Top as Double = 0 , Optional ByVal Left as Double = 0, optional ByVal compress as MsoPictureCompress) as Object
  • ToUIControl(Byval oControl as object)
  • ToDataUrl(Optional ByVal eFormat As stdImgFormat = stdImgFormatDefault) as string
  • ToShapeFill(ByVal shp As Object)
  • ToStdPicture() as stdole.StdPicture
  • CreateFromScreen() - I.E. Screenshot
  • CreateFromWindow(ByVal hwnd as LongPtr) - Create screenshot from window
  • Colors() as Long() - Obtain colors from image

Resources

https://stackoverflow.com/questions/1507385/how-do-i-convert-a-stdole-stdpicture-to-a-different-type

@sancarn sancarn changed the title stdPicture stdImage May 19, 2024
@sancarn sancarn changed the title stdImage stdImage improvements May 20, 2024
@sancarn
Copy link
Owner Author

sancarn commented May 20, 2024

Some examples functional now:

Private Sub UserForm_Initialize()
  With stdWindow.CreateFromIUnknown(Me)
    Call .setOwnerHandle(0)
    .HICON = stdWindow.CreateFromHwnd(Application.VBE.MainWindow.hWnd).HICON
'    .HICON = stdImage.CreateFromStdPicture(Image1.picture).HICON
'    .HICON = stdImage.CreateFromShape(Sheet1.Shapes("Picture 2")).HICON
'    .HICON = stdImage.CreateFromFile("C:\Users\sancarn\Pictures\yuumi.png").HICON
    
    Image1.PictureSizeMode = fmPictureSizeModeStretch
    Set Image1.picture = stdImage.CreateFromShape(Sheet1.Shapes("Picture 2")).ToStdPicture
'    Set Image1.picture = stdImage.CreateFromFile("C:\Users\sancarn\Pictures\yuumi.png").ToStdPicture
    
    Call stdImage.CreateFromShape(Sheet1.Shapes("Picture 2")).ToFile("C:\Temp\poop.png")
    Call stdImage.CreateFromShape(Sheet1.Shapes("Picture 2")).ToFile("C:\Temp\poop.bmp")
    Call stdImage.CreateFromShape(Sheet1.Shapes("Picture 2")).ToFile("C:\Temp\poop.jpeg")
    Call stdImage.CreateFromShape(Sheet1.Shapes("Picture 2")).ToFile("C:\Temp\poop.tiff")
  End With
End Sub

@sancarn sancarn added this to Roadmap Jun 3, 2024
@sancarn sancarn added the megathread Many bundled feature requests for an individual class label Jun 3, 2024
@sancarn sancarn moved this to WIP in Roadmap Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
megathread Many bundled feature requests for an individual class
Projects
Status: WIP
Development

No branches or pull requests

1 participant