cdrapp.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #include "cdrapp.h"
  2. // sr.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0)
  3. bool fill_red(corel *cdr)
  4. {
  5. auto sr = cdr->ActiveSelectionRange;
  6. auto red = cdr->CreateCMYKColor(0, 100, 100, 0);
  7. sr->ApplyUniformFill(red);
  8. return true;
  9. }
  10. bool cql_OutlineColor(corel *cdr)
  11. {
  12. auto col = cdr->CreateCMYKColor(0, 100, 100, 0);
  13. auto s = cdr->ActiveShape;
  14. col-> CopyAssign(s->Outline->Color);
  15. col->ConvertToRGB();
  16. auto r = col->RGBRed;
  17. auto g = col->RGBGreen;
  18. auto b = col->RGBBlue;
  19. char buf[256] = { 0 };
  20. sprintf(buf, "@Outline.Color.rgb[.r='%d' And .g='%d' And .b='%d']", r, g, b);
  21. auto cql = _bstr_t(buf);
  22. // MessageBox(NULL, cql, "cql 轮廓颜色", MB_ICONSTOP);
  23. auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
  24. sr->CreateSelection();
  25. strcpy(infobuf , buf);
  26. return true;
  27. }
  28. bool cql_FillColor(corel *cdr)
  29. {
  30. auto col = cdr->CreateCMYKColor(0, 100, 100, 0);
  31. auto s = cdr->ActiveShape;
  32. col-> CopyAssign(s->Fill->UniformColor);
  33. col->ConvertToRGB();
  34. auto r = col->RGBRed;
  35. auto g = col->RGBGreen;
  36. auto b = col->RGBBlue;
  37. char buf[256] = { 0 };
  38. sprintf(buf, "@Fill.Color.rgb[.r='%d' And .g='%d' And .b='%d']", r, g, b);
  39. auto cql = _bstr_t(buf);
  40. auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
  41. sr->CreateSelection();
  42. strcpy(infobuf , buf);
  43. return true;
  44. }
  45. bool cql_SameSize(corel *cdr)
  46. {
  47. cdr->ActiveDocument->Unit = cdrMillimeter;
  48. auto s = cdr->ActiveShape;
  49. char buf[256] = { 0 };
  50. sprintf(buf, "@width = {%lf mm} and @height = {%lf mm}", s->SizeWidth, s->SizeHeight);
  51. auto cql = _bstr_t(buf);
  52. // MessageBox(NULL, cql, "cql 尺寸相同", MB_ICONSTOP);
  53. auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
  54. sr->CreateSelection();
  55. strcpy(infobuf , buf);
  56. return true;
  57. }
  58. bool Shapes_Filp(corel *cdr)
  59. {
  60. BeginOpt(cdr);
  61. auto sr = cdr->ActiveSelectionRange;
  62. // CorelDRAW Shapes 物件 Item 编号从1开始
  63. for (auto i = 0; i != sr->Count; i++)
  64. sr->Shapes->Item[i + 1]->Flip(VGCore::cdrFlipHorizontal);
  65. EndOpt(cdr);
  66. return true;
  67. }
  68. bool Clear_Fill(corel *cdr)
  69. {
  70. cdr->ActiveSelection->Fill->ApplyNoFill();
  71. return true;
  72. }